Built for AI Agents and Discerning Humans
Agent-Scannable Architecture
Three route groups. Two database tables. Zero magic.
Landing, pricing, features. Shared header and footer layout. No auth required.
Minimal layout with just a logo. Clerk handles the forms. Redirects to dashboard on success.
Sidebar navigation layout. Auth required via middleware. Your product lives here.
users and subscriptions. That's it. Add your own tables as you build.The Stack
A collection of the industries most widely adopted technologies, implemented for developer and AI agent experience.
App Router, Server Actions, Turbopack. End-to-end type safety with runtime validation.
Type-safe ORM and serverless PostgreSQL. Schema defined in one code file, so agents understand data immediately.
Vendor-lock removed. We wrap Clerk in a clean abstraction layer, keeping business logic decoupled.
Optimized Project Structure
Designed for context window efficiency. Logic is colocated, distinct, and predictable.
src/
├── app/
│ ├── (auth)/ # Auth routes (minimal layout)
│ │ ├── sign-in/[[...sign-in]]/page.tsx
│ │ └── sign-up/[[...sign-up]]/page.tsx
│ ├── (marketing)/ # Public routes (landing, pricing)
│ │ ├── layout.tsx # Shared header/footer
│ │ ├── page.tsx # Landing page
│ │ └── pricing/page.tsx # Pricing page
│ ├── (app)/ # Protected routes (dashboard)
│ │ ├── layout.tsx # Sidebar layout
│ │ └── dashboard/
│ │ ├── page.tsx # Dashboard home
│ │ └── profile/page.tsx # User profile
│ ├── setup/page.tsx # Setup status page
│ └── api/
│ ├── v1/ # Versioned API routes
│ └── webhooks/ # Clerk & Stripe webhooks
├── components/
│ ├── auth/ # Auth abstraction components
│ ├── dashboard/ # Dashboard layout components
│ └── ui/ # Shadcn components
├── server/db/
│ ├── index.ts # Drizzle client
│ ├── schema.ts # Table definitions
│ └── ensure-user.ts # User provisioning helper
├── lib/
│ ├── auth/ # Auth abstraction layer
│ ├── api.ts # API response helpers
│ ├── plans.ts # Subscription plans
│ ├── stripe.ts # Stripe client
│ └── resend.ts # Email client
├── env.ts # Type-safe env validation
└── proxy.ts # Auth middlewareEnvironment Variables
Copy .env.example to .env.local and fill these in
# Database
DATABASE_URL= # Neon PostgreSQL connection string
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY= # Clerk publishable key
CLERK_SECRET_KEY= # Clerk secret key
CLERK_WEBHOOK_SECRET= # Clerk webhook signing secret
# Stripe Payments
STRIPE_SECRET_KEY= # Stripe secret key
STRIPE_WEBHOOK_SECRET= # Stripe webhook signing secret
# Email
RESEND_API_KEY= # Resend API key
# App Config
NEXT_PUBLIC_APP_URL= # Your app URL (e.g., http://localhost:3000)API Routes
What's already wired up
Key Files
The files you'll work with most often
src/server/db/schema.tsDatabase table definitions (users, subscriptions)
src/server/db/ensure-user.tsUser provisioning helper for protected pages
src/lib/auth/Auth abstraction layer (swappable providers)
src/lib/api.tsAPI response helpers (success, error, handleApiError)
src/app/api/webhooks/Clerk and Stripe webhook handlers
Service Configuration
Includes a Setup Status Widget, showing the services configured and active.
Frequently Asked Questions
Start Building
Start building from a production-ready SaaS foundation with auth, billing, database, and email.