In 48 hours, created License Key use-cases using Supabase.

In 48 hours, created License Key use-cases using Supabase.

Built backend APIs using Supabase

·

3 min read

Background - TL;DR

I have business use cases around license keys for my macOS app so I went with Paddle who has both license keys + payments, after I’ve provided my passport copy and domain name, for no reason, they’ve suspended my account. Literally, the next step I had taken was to build my own(not a fun thing to do because it is like reinventing the wheel) using Supabase. Doing something from scratch will always take time so I've decided if I can do within 2 days I will go ahead and do it otherwise use some third party paid APIs.

To get started, I went through Stripe, Paddle to understand how license key works based on that

Day 1: I scoped down my business use cases as follows:

  1. License generation
  2. License activation
  3. License de-activation
  4. License verification
  5. License re-activation
  6. License revocation

This is the app where I am using the License key use-cases zenmode.carrd.co

License generation:

  • Basically generate unique license keys, so I simply went with UUID and in Supabase you can find the property.

License activation:

  • Since this is a macOS app, validate the license key with user details + some magic to ensure the license is activated for the first time user.

License de-activation:

  • If a user wants to deactivate the license temporarily or switching to a new device then user has to deactivate the license key first before activating to a new device.

License verification:

  • Basically X number of times per week the backend validates with frontend whether the license key is valid or not.

License re-activation:

  • When a user needs to use the app on their new device, they have to unregister first on their old device and re-activate on new device.

License revocation:

  • For any bad reason, revoke the license

Day 2: Build tables based on the use-cases and write procedural functions to handle backend logic

Tables

  • Table to maintain user information
  • Table to maintain user license information and activities

Procedural functions

  • Translated each business usecase as function or functions, behind the scenes Supabase converts each function as an API.

Pros:

  • I pretty much created all the APIs using procedural functions which is just like writing sql queries.
  • All functions are automagically converted to APIs

Cons:

  • There is more error prone using procedural functions than writing down in server less functions(hoping supabase launches as soon as they can)
  • Because supabase functions are still wip, I can’t integrate with email services to send license keys so I had to manually send license keys to the user email.

You can checkout my app here: zenmode.carrd.co