Usage-based restrictions for SaaS subscription tiers

Поделиться
HTML-код
  • Опубликовано: 19 янв 2025

Комментарии • 33

  • @yarapolana
    @yarapolana 10 месяцев назад +9

    this is exactly what I was looking for, understanding the db side of subscriptions, with rules and such. Thank you so much for the video.

    • @JonMeyers
      @JonMeyers 10 месяцев назад

      Awesome! Glad you enjoyed it! 🙌

  • @ewwitsantonio
    @ewwitsantonio 10 месяцев назад +3

    Supa helpful tutorials! Thanks for creating these videos. :)

    • @JonMeyers
      @JonMeyers 10 месяцев назад

      Thanks for watching! Glad you’re enjoying them 🙌

  • @Im_KamilYT
    @Im_KamilYT 3 месяца назад +1

    It'd be great to make another tutorial implementing the notes functionality into the app to bring everything together!

  • @Oreoezi
    @Oreoezi 10 месяцев назад +2

    Why can't we use the RLS insert policy instead of a trigger to make sure a user cannot insert a row if they exceed the limit?

    • @JonMeyers
      @JonMeyers 10 месяцев назад +3

      You can enforce this with RLS but it is better practice to separate your security and business logic. Security-wise you want the user to be authenticated to insert, and only insert a row that belongs to them. Enforcing the limits of each subscription tier is business logic.
      Security -> RLS
      Business Logic -> Trigger
      But you can implement it however you prefer in your app 👍

  • @nicken86
    @nicken86 7 месяцев назад +2

    So thankful for this playlist! Any chance you could walk through how to handle if a user downgrades from a higher level subscription to a lower one, and how to handle that with the rules setup?

  • @selambengp
    @selambengp 10 месяцев назад +2

    What a lovely reminder of the db password 😂❤

    • @JonMeyers
      @JonMeyers 10 месяцев назад

      I wish projects had analytics on number of times the database password had been reset! Much faster than a password manager! 😂

  • @jrdnrc
    @jrdnrc 10 месяцев назад +2

    jon the legend did it again

    • @JonMeyers
      @JonMeyers 10 месяцев назад

      Thanks Jordi! Glad you enjoyed it! 🙌

  • @damianocellai1783
    @damianocellai1783 10 месяцев назад +1

    Hello, what happen if i go to a plan that let me create a 5 notes and later i downgrade? They let me downgrade? How handle this with Stripe, Next and Supabase? Thanks a lot for your content

    • @JonMeyers
      @JonMeyers 10 месяцев назад

      Currently, this would allow you to keep the notes, you just couldn’t add any new notes until you upgrade again. But you handle this anyway you prefer. Could add an “active” column to each of the notes and automatically deactivate the ones above 5 if they downgrade their subscriptions

  • @codewrangler
    @codewrangler 10 месяцев назад +1

    Yet another great video Jon! The way you walked us through the function logic was fantastic. Question: does the raise exception message get passed back to the supabase query on the client side or just in the PG backend?

    • @JonMeyers
      @JonMeyers 10 месяцев назад

      Thanks! Glad you enjoyed it! Yep, the exception gets returned as an ‘error’ in supabase-js 👍

  • @R0cky0
    @R0cky0 10 месяцев назад +2

    Great tutorial Jon. A couple of questions: 1. did you generate the random text IDs with prefix for product/sub/price_* through JS? does Supabase have such function other than generating uuid? 2. Would do a quick walkthrough on how to apply the expiration date rule and possibly with a notification before the plan expires? Many Thanks! 🙏

    • @JonMeyers
      @JonMeyers 10 месяцев назад

      Thanks for watching! Glad you enjoyed it! 🙌
      1. These were created in the Stripe dashboard, triggering webhook events that are sent to Supabase 👍
      2. That’s a great idea! Will add it to the list!

  • @rtorcato
    @rtorcato 10 месяцев назад +1

    if the user goes pro adds more notes then the limit then cancels their pro plan they still get to keep more notes allowed.

    • @JonMeyers
      @JonMeyers 10 месяцев назад +3

      Yep, correct! Currently, they would keep the extra notes, but you can handle this in your app any way you want 👍
      One option would be add a column for “is_active” to the notes table. You could automatically set the notes above 5 to inactive when the user downgrades their subscription. Or set up a grace period of 7 days for them to delete the additional notes or upgrade their subscription

  • @StefanRows
    @StefanRows 10 месяцев назад

    For those where pnpm supabase:pull doesn't work: npx supabase db pull
    Also, npx supabase migration up works.
    No idea why the pnpm commands fail for me (latest version on everything)

    • @JonMeyers
      @JonMeyers 10 месяцев назад

      Good call! I think I tinkered with the package.json scripts to record the video - need to push those up to the template 👍

    • @brandonhargitay7098
      @brandonhargitay7098 5 месяцев назад

      thanks man!

  • @sourceblocks62
    @sourceblocks62 4 месяца назад

    Awesome! Question: is it recommended to check subscriptions and usage limits in Supabase (at database level) with functions and triggers or in my codebase? For example, in my Nextjs app I'm fetching the user's subscription status before doing any action like adding notes. I'm also deducting credits from a user after they add a note, using the Supabase client from my route in my app. Should all this be handled in Supabase functions at database level and in my routes just have basic fetching, updating without subscription or usage logic? Or is it ok as I'm doing?

    • @iminoaruu
      @iminoaruu Месяц назад

      did you get the answer to your query?? you asked this 3 months age, which strategy did you choose and what was
      your experience?

    • @sourceblocks62
      @sourceblocks62 Месяц назад

      @@iminoaruu i quit making saas apps altogether. was a waste of time. im doing gardening now and trying to live a better life.

    • @iminoaruu
      @iminoaruu Месяц назад

      @@sourceblocks62 nah man

  • @Tanner-cz4bd
    @Tanner-cz4bd 10 месяцев назад +1

    Can we get a full next js tutorial building a high quality CRUD app

    • @JonMeyers
      @JonMeyers 10 месяцев назад +1

      Will add it to the list 👍

    • @Tanner-cz4bd
      @Tanner-cz4bd 10 месяцев назад

      @@JonMeyers thanks

  • @sux0r1z0r
    @sux0r1z0r 3 месяца назад

    You’re moving so much I can’t focus on what you’re saying

  • @yarapolana
    @yarapolana 10 месяцев назад +1

    Can we get another remix auth tutorial with @supabase/ssr?

    • @JonMeyers
      @JonMeyers 10 месяцев назад

      Working on it! 👍