SaaS Scaffolder
Generate a complete, production-ready SaaS application boilerplate including authentication (NextAuth, Clerk, or Supabase Auth), database schemas with multi-tenancy, billing integration (Stripe or Lemon Squeezy), API routes with validation, dashboard UI with shadcn/ui, and deployment configuration. Produces a working application from a product specification in under 30 minutes.
Core Capabilities
- Spec-driven scaffolding — produce a full Next.js App Router + TypeScript + Tailwind + shadcn/ui file tree from a short product spec (auth/db/payments/tenancy/features).
- Multi-tenant database schema — Drizzle ORM schema with workspaces (tenancy boundary), users, members, OAuth accounts, and sessions, with proper indexes and cascade rules.
- Authentication — NextAuth v5 with Drizzle adapter, OAuth (Google/GitHub) and magic-link (Resend) providers, route-protection middleware.
- Stripe billing — checkout session, customer portal, and signature-verified webhook handler keeping subscription state in sync.
- Multi-tenancy patterns — workspace-scoped queries and plan-based feature gating (free/pro/enterprise).
- Phased build + quality bar — 5 ordered scaffolding phases with per-phase validation, pitfalls, best practices, troubleshooting, and success criteria.
Keywords: SaaS, boilerplate, scaffolding, Next.js, authentication, Stripe, billing, multi-tenancy, subscription, starter template, NextAuth, Drizzle ORM, shadcn/ui
When to Use
- Starting a new SaaS product, subscription app, or multi-tenant platform.
- Standing up auth + billing + tenancy boilerplate quickly before building product features.
- Adding workspace/organization tenancy with role-based access and plan gating.
- Generating a baseline
.env.example, schema, and API routes for a Next.js stack.
Clarify First
Before scaffolding, confirm these inputs. If any is unknown or vague, ASK — do not assume:
Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact.
Tools
| Tool |
Purpose |
Command |
saas_scaffolder.py |
Generate a production-ready SaaS project structure (auth, billing, tenancy) |
python scripts/saas_scaffolder.py --name my-saas --auth nextauth --db neondb --payments stripe --tenancy workspace |
feature_flag_manager.py |
CRUD + evaluate feature flags on a JSON store |
python scripts/feature_flag_manager.py evaluate --key dark-mode --environment production --plan pro |
tenant_config_validator.py |
Validate multi-tenant config and scan source for missing tenant scoping / isolation issues |
python scripts/tenant_config_validator.py --config tenant_config.json --src ./app |
References
Load the reference that matches the task — keep this file lean and pull detail on demand:
- references/project-structure-and-schema.md — input spec format, the full generated file tree, the multi-tenant Drizzle schema, and the
.env.example variables. Read when defining the spec, laying out files, or writing the schema/env config.
- references/auth-billing-and-tenancy.md — complete NextAuth config, Stripe checkout + webhook handlers, route-protection middleware, and workspace-scoped query / plan-gating code. Read when wiring auth, billing, or tenancy.
- references/workflow-and-quality.md — the 5 ordered scaffolding phases with per-phase validation, common pitfalls, best practices, the troubleshooting table, and success criteria. Read before scaffolding and before shipping.
Scope & Limitations
This skill covers:
- Full-stack SaaS scaffolding with Next.js App Router, TypeScript, Tailwind, and shadcn/ui
- Authentication setup with NextAuth v5, Clerk, or Supabase Auth including OAuth and magic link providers
- Stripe and Lemon Squeezy billing integration with checkout, webhooks, and customer portal
- Multi-tenancy patterns (workspace/organization) with role-based access and plan-based feature gating
This skill does NOT cover:
- Ongoing Stripe billing logic beyond initial integration (metered billing, usage-based pricing, invoicing customization) — see
stripe-integration-expert
- Database schema design decisions beyond the core tenancy model (complex relational modeling, indexing strategies) — see
database-schema-designer
- CI/CD pipeline configuration, deployment automation, or infrastructure provisioning — see
ci-cd-pipeline-builder
- API design standards, versioning, or OpenAPI specification generation — see
api-design-reviewer
Integration Points
| Skill |
Integration |
Data Flow |
stripe-integration-expert |
Extends the scaffolded Stripe setup with advanced billing patterns (metered, tiered, usage-based) |
Scaffolder outputs base Stripe config and webhook handler; Stripe expert refines pricing models and adds invoice customization |
database-schema-designer |
Designs extended schemas beyond the core tenancy tables |
Scaffolder provides baseline users/workspaces/members schema; schema designer adds domain-specific entities and optimizes indexes |
api-design-reviewer |
Reviews and improves the generated API routes for consistency and standards compliance |
Scaffolder generates initial API routes; reviewer audits naming, error handling, and response formats |
ci-cd-pipeline-builder |
Creates deployment pipelines for the scaffolded project |
Scaffolder outputs the application code; pipeline builder adds GitHub Actions, preview deployments, and production release workflows |
env-secrets-manager |
Audits and secures the environment variable configuration |
Scaffolder generates .env.example; secrets manager validates no secrets are hardcoded and recommends vault integration |
observability-designer |
Adds logging, tracing, and monitoring to the scaffolded application |
Scaffolder provides the application structure; observability designer instruments API routes, webhooks, and auth flows |
1---2name: saas-scaffolder3description: Generate SaaS boilerplate with auth, database schemas, Stripe billing, multi-tenancy, API routes, and dashboard UI on a Next.js/TypeScript/Tailwind stack. Use when starting a new SaaS product, subscription app, or multi-tenant platform.4license: MIT + Commons Clause5---6# SaaS Scaffolder
7
8Generate a complete, production-ready SaaS application boilerplate including authentication (NextAuth, Clerk, or Supabase Auth), database schemas with multi-tenancy, billing integration (Stripe or Lemon Squeezy), API routes with validation, dashboard UI with shadcn/ui, and deployment configuration. Produces a working application from a product specification in under 30 minutes.
9
10## Core Capabilities
11
12- **Spec-driven scaffolding** — produce a full Next.js App Router + TypeScript + Tailwind + shadcn/ui file tree from a short product spec (auth/db/payments/tenancy/features).
13- **Multi-tenant database schema** — Drizzle ORM schema with workspaces (tenancy boundary), users, members, OAuth accounts, and sessions, with proper indexes and cascade rules.
14- **Authentication** — NextAuth v5 with Drizzle adapter, OAuth (Google/GitHub) and magic-link (Resend) providers, route-protection middleware.
15- **Stripe billing** — checkout session, customer portal, and signature-verified webhook handler keeping subscription state in sync.
16- **Multi-tenancy patterns** — workspace-scoped queries and plan-based feature gating (free/pro/enterprise).
17- **Phased build + quality bar** — 5 ordered scaffolding phases with per-phase validation, pitfalls, best practices, troubleshooting, and success criteria.
18
19**Keywords:** SaaS, boilerplate, scaffolding, Next.js, authentication, Stripe, billing, multi-tenancy, subscription, starter template, NextAuth, Drizzle ORM, shadcn/ui
20
21## When to Use
22
23- Starting a new SaaS product, subscription app, or multi-tenant platform.
24- Standing up auth + billing + tenancy boilerplate quickly before building product features.
25- Adding workspace/organization tenancy with role-based access and plan gating.
26- Generating a baseline `.env.example`, schema, and API routes for a Next.js stack.
27
28## Clarify First
29
30Before scaffolding, confirm these inputs. If any is unknown or vague, ASK — do not assume:
31
32- [ ] **Auth provider** — NextAuth / Clerk / Supabase Auth (`--auth`; changes the auth config and middleware generated)
33- [ ] **Payments provider** — Stripe / Lemon Squeezy / none (`--payments`; determines the billing + webhook handler)
34- [ ] **Tenancy model** — workspace / organization / single-tenant (`--tenancy`; shapes the entire database schema and scoped queries)
35- [ ] **Database** — Neon / Supabase / other Postgres (`--db`; sets the Drizzle adapter and connection config)
36
37Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact.
38
39## Tools
40
41| Tool | Purpose | Command |
42|------|---------|---------|
43| `saas_scaffolder.py` | Generate a production-ready SaaS project structure (auth, billing, tenancy) | `python scripts/saas_scaffolder.py --name my-saas --auth nextauth --db neondb --payments stripe --tenancy workspace` |
44| `feature_flag_manager.py` | CRUD + evaluate feature flags on a JSON store | `python scripts/feature_flag_manager.py evaluate --key dark-mode --environment production --plan pro` |
45| `tenant_config_validator.py` | Validate multi-tenant config and scan source for missing tenant scoping / isolation issues | `python scripts/tenant_config_validator.py --config tenant_config.json --src ./app` |
46
47## References
48
49Load the reference that matches the task — keep this file lean and pull detail on demand:
50
51- **[references/project-structure-and-schema.md](references/project-structure-and-schema.md)** — input spec format, the full generated file tree, the multi-tenant Drizzle schema, and the `.env.example` variables. Read when defining the spec, laying out files, or writing the schema/env config.
52- **[references/auth-billing-and-tenancy.md](references/auth-billing-and-tenancy.md)** — complete NextAuth config, Stripe checkout + webhook handlers, route-protection middleware, and workspace-scoped query / plan-gating code. Read when wiring auth, billing, or tenancy.
53- **[references/workflow-and-quality.md](references/workflow-and-quality.md)** — the 5 ordered scaffolding phases with per-phase validation, common pitfalls, best practices, the troubleshooting table, and success criteria. Read before scaffolding and before shipping.
54
55## Scope & Limitations
56
57**This skill covers:**
58- Full-stack SaaS scaffolding with Next.js App Router, TypeScript, Tailwind, and shadcn/ui
59- Authentication setup with NextAuth v5, Clerk, or Supabase Auth including OAuth and magic link providers
60- Stripe and Lemon Squeezy billing integration with checkout, webhooks, and customer portal
61- Multi-tenancy patterns (workspace/organization) with role-based access and plan-based feature gating
62
63**This skill does NOT cover:**
64- Ongoing Stripe billing logic beyond initial integration (metered billing, usage-based pricing, invoicing customization) — see `stripe-integration-expert`
65- Database schema design decisions beyond the core tenancy model (complex relational modeling, indexing strategies) — see `database-schema-designer`
66- CI/CD pipeline configuration, deployment automation, or infrastructure provisioning — see `ci-cd-pipeline-builder`
67- API design standards, versioning, or OpenAPI specification generation — see `api-design-reviewer`
68
69## Integration Points
70
71| Skill | Integration | Data Flow |
72|-------|-------------|-----------|
73| `stripe-integration-expert` | Extends the scaffolded Stripe setup with advanced billing patterns (metered, tiered, usage-based) | Scaffolder outputs base Stripe config and webhook handler; Stripe expert refines pricing models and adds invoice customization |
74| `database-schema-designer` | Designs extended schemas beyond the core tenancy tables | Scaffolder provides baseline users/workspaces/members schema; schema designer adds domain-specific entities and optimizes indexes |
75| `api-design-reviewer` | Reviews and improves the generated API routes for consistency and standards compliance | Scaffolder generates initial API routes; reviewer audits naming, error handling, and response formats |
76| `ci-cd-pipeline-builder` | Creates deployment pipelines for the scaffolded project | Scaffolder outputs the application code; pipeline builder adds GitHub Actions, preview deployments, and production release workflows |
77| `env-secrets-manager` | Audits and secures the environment variable configuration | Scaffolder generates `.env.example`; secrets manager validates no secrets are hardcoded and recommends vault integration |
78| `observability-designer` | Adds logging, tracing, and monitoring to the scaffolded application | Scaffolder provides the application structure; observability designer instruments API routes, webhooks, and auth flows |