The full-stack framework built for AI.
Ship production apps faster. Every project ships with typed contracts, predictable patterns, and AI agent instructions โ so AI writes better code from the start.
Keel is a full-stack template framework for building web + mobile apps. It gives you auth, database, email, and native mobile support out of the box โ and it's designed so that AI coding agents (Cursor, Copilot, Windsurf, etc.) produce better code when working in Keel projects.
Every generated project includes CLAUDE.md, .cursor/rules, .github/copilot-instructions.md, and more โ giving AI agents full context about your architecture, conventions, and patterns.
| Layer | Stack |
|---|---|
| Frontend | Vite + React 19 + TypeScript + TailwindCSS v4 |
| Backend | Express 5 + TypeScript (ESM) |
| Auth | BetterAuth โ email/password, sessions, email verification |
| Resend + React Email โ verification, welcome, password reset | |
| Database | PostgreSQL + Drizzle ORM (migrations) |
| Mobile | Capacitor 8 โ iOS + Android via WebView |
| Hosting | Docker, Fly.io, Railway, Vercel, or self-hosted |
# Create a new project
npx @codaijs/keel create my-app
# Follow the setup wizard โ it configures everything:
# โ Project name & branding
# โ Database connection
# โ Auth secrets
# โ Email provider (optional)
# โ Which sails to installnpx @codaijs/keel create my-app --yes --db=pglite
cd my-app
keel devUses PGlite (embedded PostgreSQL via WASM) โ full PostgreSQL compatibility without Docker.
git clone https://github.com/Chafficui/keel.git my-app
cd my-app
npm install
# Start PostgreSQL
docker compose up -d
# Copy environment files
cp packages/backend/.env.example packages/backend/.env
# Edit .env with your database URL, secrets, etc.
# Run database migrations
npm run db:migrate
# Start development
npm run devpackages/
shared/ โ @keel/shared โ Types + Zod validators
email/ โ @keel/email โ React Email templates
frontend/ โ @keel/frontend โ Vite + React SPA + Capacitor
backend/ โ @keel/backend โ Express 5 API server
sails/ โ Tracks installed sails (minimal, no code shipped)
cli/ โ create-keel CLI + sail definitions
docs/ โ Architecture, auth flow, mobile, sail development guides
brand/ โ Keel brand assets + design guide
npm run dev # Frontend (:5173) + Backend (:3005) concurrently
npm run dev:frontend # Frontend only
npm run dev:backend # Backend only
npm run dev:email # Email template preview (:3010)npm run db:generate # Generate migration from schema changes
npm run db:migrate # Apply pending migrations
npm run db:push # Push schema directly (dev only)
npm run db:studio # Open Drizzle Studio GUInpm run cap:sync # Sync web build to native projects
npm run cap:ios # Open iOS project
npm run cap:android # Open Android projectnpm run build # Build all packages
npm run typecheck # Type-check everything
keel deploy # Show deployment guides| Platform | Config File | Command |
|---|---|---|
| Docker (self-hosted) | docker-compose.prod.yml |
docker compose -f docker-compose.prod.yml up -d |
| Fly.io | fly.toml |
fly launch --copy-config && fly deploy |
| Railway | packages/backend/railway.json |
railway up |
| Vercel (frontend) | packages/frontend/vercel.json |
vercel --cwd packages/frontend |
| Any container host | packages/backend/Dockerfile |
docker build -f packages/backend/Dockerfile -t my-app . |
Sails are optional packages that add functionality to your Keel project. They're not bundled into your app โ install only what you need.
# List available sails
npx @codaijs/keel list
# Install a sail (runs interactive setup wizard)
npx @codaijs/keel sail add google-oauth
# Get info about a sail before installing
npx @codaijs/keel info stripe| Sail | Category | What it adds |
|---|---|---|
| google-oauth | Auth | Google sign-in button + OAuth provider config |
| stripe | Payments | Subscriptions, checkout, webhooks, customer portal |
| gdpr | Compliance | Consent tracking, data export, account deletion (30-day grace), privacy policy |
| r2-storage | Storage | Cloudflare R2 file uploads + profile picture upload component |
| push-notifications | Mobile | Firebase Cloud Messaging + device token management |
| analytics | Tracking | PostHog โ page views, user identification, custom events |
| admin-dashboard | Admin | User management, metrics overview |
| i18n | Localization | i18next + react-i18next + language detection |
| rate-limiting | Security | API rate limiting middleware (planned) |
| file-uploads | Storage | Generic file upload system (planned) |
Every sail includes a setup wizard that walks you through configuration, prompts for required env vars, and handles file modifications automatically.
Sails use marker comments in your codebase to know where to insert code:
// [SAIL_IMPORTS] โ import statements
// [SAIL_ROUTES] โ route registrations
// [SAIL_SCHEMA] โ database schema exports
// [SAIL_SOCIAL_PROVIDERS] โ OAuth provider config
// [SAIL_ENV_VARS] โ environment variable declarations
{/* [SAIL_SOCIAL_BUTTONS] */} โ social login buttons in formsIf you've modified files and a marker is missing, the installer won't break your code โ it prints clear manual instructions instead.
Every project generated by Keel includes instruction files for major AI coding tools:
| File | Tool |
|---|---|
CLAUDE.md |
Claude Code, Claude Agent SDK |
AGENTS.md |
Generic AI agents |
.cursor/rules |
Cursor |
.github/copilot-instructions.md |
GitHub Copilot |
.windsurfrules |
Windsurf |
These files give AI agents full context about your project's architecture, conventions, database schema, auth flow, and available commands โ resulting in more accurate code generation and fewer hallucinations.
| Variable | Required | Description |
|---|---|---|
DATABASE_URL |
Yes | PostgreSQL connection string |
BETTER_AUTH_SECRET |
Yes | Session signing secret |
BACKEND_URL |
Yes | Public backend URL |
FRONTEND_URL |
Yes | Public frontend URL |
PORT |
No | Server port (default: 3005) |
NODE_ENV |
No | development / production |
RESEND_API_KEY |
No | Resend API key (logs to console if missing) |
EMAIL_FROM |
No | Sender email address |
| Variable | Description |
|---|---|
VITE_API_URL |
Backend URL (empty = use Vite proxy in dev) |
VITE_APP_NAME |
App display name |
Detailed guides in the docs/ folder:
- Architecture Overview โ system design, data flow, deployment
- Auth Flow โ registration, login, sessions, token handling
- Capacitor Guide โ mobile setup, deep links, native features
- GDPR Compliance โ consent, export, deletion (used by gdpr sail)
- Sail Development โ how to build your own sails
- Node.js โฅ 22
- PostgreSQL 16+ (or use the included
docker-compose.yml) - npm 10+
MIT
