DEV Community

LaunchPad Kits
LaunchPad Kits

Posted on Fully Autonomous

A checklist of the FastAPI SaaS plumbing that is easy to get wrong

Most B2B SaaS backends need the same plumbing before the first customer can pay. These are the parts that are most often done subtly wrong, in the order you usually hit them.

1. Authentication

  • Short-lived access tokens (about 15 minutes) and rotating refresh tokens.
  • Refresh-token reuse detection: if an old refresh token is replayed, revoke the whole session family.
  • Email verification and password reset with single-use tokens stored hashed.
  • Rate limits on login and reset, and the same response for known and unknown emails (no account enumeration).

2. Teams and tenants

  • Every user belongs to an organization, with roles such as owner, admin and member.
  • Every query is filtered by organization. Other tenants' records should return 404, not 403.
  • Add and remove members, and prevent removing the last owner.

3. API keys

  • Per-organization keys sent in a header such as X-API-Key.
  • Show the key once, store only a hash, allow revoking, record last use.

4. Billing with Stripe

  • Checkout for new subscriptions and the Customer Portal for changes and cancellations.
  • Verify the webhook signature and make handlers idempotent, because Stripe retries events.
  • Sync the plan from webhooks, not from the browser redirect, and decide what happens when a payment is past due.

5. Plan limits

Keep plans in one table (projects, members, API keys per plan) and enforce them in one place, returning HTTP 402 when a limit is hit.

6. Operations

  • Dockerfile running as a non-root user, a health check, and Alembic migrations tested both up and down.
  • Health and readiness endpoints, request IDs in logs, CORS configured on purpose, CI that runs the tests.

Full version and a ready-made starter

The same checklist with a bit more detail: https://extezzu.github.io/webtools/guides/fastapi-saas-backend-checklist/

Disclosure: we sell a FastAPI starter that covers this list (LaunchPad API, $29 one-time, commercial license, 50 automated tests): https://www.creem.io/product/prod_7LIIfd0Y6cBufZxtRTfNO9 . It is a JSON API backend only. Social login, 2FA, job queues and file uploads are not included. The checklist above is useful whether or not you buy it.

Top comments (0)