A production-minded SaaS foundation for Cloudflare Workers.
Nextbase combines React Router SSR, TanStack Query, Better Auth, D1, R2, Queues, and Durable Objects in one deployable monorepo.
What is included
- Verified identity, sessions, onboarding, recovery, and account deletion
- Tenant-safe workspaces, invitations, projects, approval workflows, and comments
- Stripe billing, content, feedback, notifications, AI, email, media, and realtime primitives
- Forward-only D1 migrations and retryable, idempotent background jobs
Request lifecycle
Browser -> web Worker -> authorized service -> D1 / R2
|-> transactional outbox -> Queue -> jobs Worker
|-> Durable Object invalidation -> browser refetch
The browser never supplies an authoritative workspace identifier. A route slug and the current session resolve a workspace context before each tenant mutation.
Design principles
| Concern | Guarantee |
|---|---|
| Tenant isolation | Session-derived context plus capability checks and D1 invariants |
| External side effects | Stable idempotency key and durable outbox state |
| Billing arithmetic | Integer minor units or decimal string plus explicit scale |
| Realtime | Payload-free hints followed by authorized refetches |