SaaS, booking & store guides

Three production blueprints — multi-tier SaaS, deposit-backed booking, and branded e-commerce — with exact tables, roles, payment flows, and prompts.

How to use these playbooks

Each playbook below gives you the complete production blueprint for a proven online business: relational database schema, server-enforced roles, Stripe payment and webhook logic, the hardest real-world edge case to handle up front, and a ready-to-paste starter prompt.

PlaybookBest forCore tablesPayment modelHard edge case solved
1. Multi-tier SaaSSoftware tools, AI utilities, member portalsusers, subscriptions, projectsMonthly / annual Stripe subscriptions + Customer PortalServer-side quota & feature gating across active, past_due, and canceled states
2. Studio booking + depositSalons, courts, coaches, photo studios, clinicsservices, staff_schedules, bookingsUpfront $20 Stripe deposit + on-site remainderTemporary 10-minute slot holds preventing simultaneous double bookings
3. Branded storefrontCoffee roasters, apparel drops, craft goodsproducts, product_variants, orders, order_itemsOne-off Stripe Checkout + flat shipping ruleSnapshotting unit_price_cents on order lines + atomic inventory decrement

Build each app in two focused passes: paste the starter prompt to generate the working foundation, verify every flow in Preview (using Cloud and Stripe test cards), then layer on your custom domain, branded sending email, and launch creatives.

Playbook 1: Multi-tier SaaS with Stripe subscriptions

Use this architecture whenever you offer a free tier that lets visitors experience value immediately, paired with a monthly or annual Pro plan that lifts usage quotas and unlocks power features.

Data model

text
users
  id                      PK (uuid)
  email                   text, unique, not null
  full_name               text, not null
  role                    enum('member', 'admin'), default 'member'
  stripe_customer_id      text, unique, nullable
  created_at              timestamp (UTC)

subscriptions
  id                      PK (uuid)
  user_id                 FK -> users.id, unique, not null
  stripe_subscription_id  text, unique, not null
  plan_code               enum('free', 'pro_monthly', 'pro_annual'), not null
  status                  enum('trialing', 'active', 'past_due', 'canceled'), not null
  current_period_end      timestamp (UTC), not null
  cancel_at_period_end    boolean, default false
  updated_at              timestamp (UTC)

projects
  id                      PK (uuid)
  user_id                 FK -> users.id, not null
  title                   text, not null
  status                  enum('active', 'archived'), default 'active'
  created_at              timestamp (UTC)
  INDEX (user_id, created_at)

Roles and access boundaries

  • Guest. Views landing page and monthly/annual pricing; redirected to sign-in when starting a trial.
  • Free Member. Holds up to 3 active projects where projects.user_id === session.user.id. The server blocks a 4th active project — never relying on hidden buttons.
  • Pro Member. Verified server-side via subscriptions.status IN ('trialing', 'active'). Unlocks unlimited projects, CSV exports, and custom templates.
  • Admin. Inspects MRR, active vs past_due subscribers, and workspace totals from an admin-only dashboard.

Payment and lifecycle flow

Offer a clear $19/month or $180/year toggle. Stripe webhooks (checkout.session.completed and invoice.paid) upsert subscriptions and unlock Pro immediately, while Manage billing opens the Stripe Customer Portal and past_due shows a slim update-card strip.

Starter prompt · App

Build a SaaS app with Google and email sign-in, plus `users`, `subscriptions`, and `projects` tables. Enforce limits server-side: Free members get 3 active projects; Pro members ($19/month or $180/year with a 7-day trial via Stripe Checkout) get unlimited projects and CSV export. Add idempotent Stripe webhooks (`checkout.session.completed`, `invoice.paid`, `invoice.payment_failed`, `customer.subscription.updated`, `customer.subscription.deleted`), a Customer Portal link, and a `past_due` update-card banner.

Playbook 2: Local service or studio booking app with $20 deposit

Local studios, coaches, clinics, and court venues lose thousands per year to last-minute no-shows. Collecting a small upfront $20 deposit at booking time cuts no-shows dramatically while keeping checkout friction low.

Data model

text
services
  id                          PK (uuid)
  name                        text, not null            -- e.g. "60-Min Portrait Session"
  duration_minutes            integer, not null         -- e.g. 60
  total_price_cents           integer, not null         -- e.g. 12000 ($120.00)
  deposit_cents               integer, not null         -- e.g. 2000 ($20.00)
  is_active                   boolean, default true

staff_schedules
  id                          PK (uuid)
  staff_name                  text, not null
  weekday                     integer, not null         -- 0 (Sun) .. 6 (Sat)
  start_time_local            text, not null            -- "09:00"
  end_time_local              text, not null            -- "18:00"

bookings
  id                          PK (uuid)
  user_id                     FK -> users.id, not null
  service_id                  FK -> services.id, not null
  slot_start                  timestamp (UTC), not null
  slot_end                    timestamp (UTC), not null
  deposit_cents               integer, not null
  balance_due_cents           integer, not null
  status                      enum('held', 'confirmed', 'completed', 'canceled', 'no_show')
  hold_expires_at             timestamp (UTC), nullable
  stripe_checkout_session_id  text, unique, nullable
  notes                       text, nullable
  created_at                  timestamp (UTC)
  INDEX (slot_start, status)

Preventing double bookings cleanly

The trickiest real-world booking bug happens when two clients pick the same Saturday 2:00 PM slot five seconds apart. If you save the booking only after Stripe Checkout finishes, both customers pay $20 for one room.

Solve it with a 10-minute slot hold. When Customer A clicks Pay $20 deposit, your server atomically inserts a bookings row with status = 'held' and hold_expires_at = now + 10 minutes, blocking anyone else from selecting that slot.

When Stripe's checkout.session.completed webhook arrives, the row flips to confirmed. If Customer A abandons checkout, expired unpaid holds release automatically after 10 minutes.

Roles and payment flow

  • Guest. Browses services, deposit rules, and live open slots in local time.
  • Member. Signs in via Google or magic link, pays the $20 deposit via Stripe Checkout, receives a confirmation email with remaining balance, and reschedules up to 24 hours ahead.
  • Staff & Admin. Checks in clients, edits schedules and blackout dates, marks completed or no_show, and records on-site balances.
Starter prompt · App

Build a studio booking app with Google and magic-link sign-in and Guest, Member, and Admin roles. Model `services`, `staff_schedules`, and `bookings` in integer cents. Selecting an open slot creates a 10-minute `held` row to block double bookings, launches Stripe Checkout for a $20 USD deposit, and flips the booking to `confirmed` via webhook (`checkout.session.completed`) while releasing expired holds automatically. Email confirmation details and allow rescheduling up to 24 hours ahead.

Playbook 3: Branded storefront with cart, flat shipping, and receipts

Independent consumer brands — coffee roasters, ceramics studios, apparel drops, and specialty food makers — need crisp product storytelling, variant inventory tracking, predictable shipping, and trustworthy order emails without paying per-order platform commissions.

Data model

text
products
  id                      PK (uuid)
  slug                    text, unique, not null
  title                   text, not null
  description             text, not null
  is_published            boolean, default false
  created_at              timestamp (UTC)

product_variants
  id                      PK (uuid)
  product_id              FK -> products.id, not null
  sku                     text, unique, not null
  option_label            text, not null            -- e.g. "Whole Bean / 340g"
  price_cents             integer, not null         -- e.g. 2200 ($22.00)
  stock_qty               integer, not null

orders
  id                      PK (uuid)
  order_number            text, unique, not null    -- e.g. "ORD-1042"
  customer_email          text, not null
  user_id                 FK -> users.id, nullable  -- supports guest checkout
  subtotal_cents          integer, not null
  shipping_cents          integer, not null         -- $6 flat, $0 if subtotal >= $60
  total_cents             integer, not null
  shipping_address_json   jsonb, not null
  tracking_number         text, nullable
  status                  enum('pending', 'paid', 'shipped', 'refunded')
  stripe_checkout_id      text, unique, not null
  created_at              timestamp (UTC)

order_items
  id                      PK (uuid)
  order_id                FK -> orders.id, not null
  variant_id              FK -> product_variants.id, not null
  product_title_snapshot  text, not null
  variant_label_snapshot  text, not null
  unit_price_cents        integer, not null         -- frozen at checkout time
  quantity                integer, not null

Why order_items snapshots the price

Never calculate a past order's total by looking up today's price in product_variants. If you raise your flagship ceramic mug from $24 to $28 next month, historical invoices and refund calculations must still reflect $24. Copying unit_price_cents, product_title_snapshot, and variant_label_snapshot onto order_items keeps accounting rock-solid forever.

Roles and fulfillment flow

  • Guest & Member. Browses multi-photo product pages, picks variants, builds a persistent cart ($6 flat shipping, free at $60+), and completes Stripe Checkout with address collection.
  • Automated webhook. Verifies checkout.session.completed, marks the order paid, decrements stock_qty atomically, and emails an itemized receipt.
  • Admin. Uploads catalog photos, updates stock counts, filters unshipped orders, adds tracking numbers, and triggers branded shipping notifications.
Starter prompt · Web

Build an indie coffee storefront with guest checkout and optional member order history. Create `products`, `product_variants` (`sku`, `price_cents`, `stock_qty`), `orders`, and `order_items` (snapshotting title, variant label, and `unit_price_cents`). Add a cart with $6 flat shipping (free at $60+), Stripe Checkout with shipping addresses, and an idempotent webhook that marks orders `paid` and decrements stock. Include an Admin panel for product uploads, inventory edits, tracking numbers, and branded confirmation/shipping emails.

Going from prototype to live revenue

Once your Preview screens feel right, ship in five quick steps:

  • Test edge cases in Preview. Verify privacy boundaries, slot holds, stock guards, and Stripe test declines via Testing & subscriptions.
  • Authenticate sending DNS. Configure SPF, DKIM, and DMARC in Branded email & delivery for inbox delivery.
  • Connect your custom domain. Add automatic SSL and remove the badge on Starter or Pro via Custom domains & DNS.
  • Switch Stripe to Live and Publish. Run one real-card smoke test on Live and refund it to confirm webhook sync.
  • Track growth. Monitor live health in Analytics & health and optional Pro campaigns in Google & TikTok Ads.

Next steps

Still have a question?Ask our team and other builders on Discord.

From the blog