npx create-craft-app@latest my-app
cd my-app
cp .env.example .env
pnpm devThis monorepo includes the following:
apps/www- Documentation site built with Nextra
packages/create-craft-app- CLI tool for scaffolding new projects
tooling/typescript- Shared TypeScript configurationstooling/eslint- Shared ESLint configurationstooling/prettier- Shared Prettier configuration
- 🤖 Multi-Provider AI - OpenAI, Anthropic, and Google AI models with Vercel AI SDK 6
- 🔐 Authentication - Email/password + OAuth (Google, GitHub) with Better Auth
- 💾 Database - PostgreSQL with Neon serverless + Drizzle ORM
- 💳 Payments - Subscription billing with Dodo Payments
- 📧 Transactional Emails - React Email templates with Resend
- 🔄 Background Jobs - Trigger.dev for async tasks
- 📊 Analytics - PostHog for product analytics
- 💬 Customer Support - Tawk.to live chat integration
- 🎨 UI Components - shadcn/ui + Tailwind CSS v4
- 🌙 Dark Mode - System-aware theme switching
- ⚡ Caching - Upstash Redis for rate limiting & caching
- 📁 File Storage - Cloudflare R2 (S3-compatible)
- 🛡️ Type Safety - End-to-end TypeScript with strict mode
- ✅ Code Quality - ESLint, Prettier, Husky pre-commit hooks
| Category | Technology |
|---|---|
| Framework | Next.js 16 with App Router & Turbopack |
| Language | TypeScript 5.9 |
| Styling | Tailwind CSS v4 + shadcn/ui |
| Database | Neon PostgreSQL + Drizzle ORM |
| Authentication | Better Auth |
| AI | Vercel AI SDK 6 (OpenAI, Anthropic, Google) |
| Payments | Dodo Payments |
| Resend + React Email | |
| Cache | Upstash Redis |
| Storage | Cloudflare R2 |
| Background Jobs | Trigger.dev |
| Analytics | PostHog |
| Support | Tawk.to |
| Deployment | Vercel |
src/
├── app/ # Next.js App Router
│ ├── (auth)/ # Auth pages (login, register)
│ ├── (dashboard)/ # Protected dashboard pages
│ ├── api/ # API routes
│ │ ├── auth/ # Better Auth handler
│ │ ├── chat/ # AI chat endpoint
│ │ └── webhooks/ # Payment webhooks
│ ├── layout.tsx # Root layout with providers
│ └── page.tsx # Landing page
├── components/
│ ├── layout/ # Dashboard layout components
│ ├── providers/ # Context providers
│ ├── settings/ # Settings components
│ └── ui/ # shadcn/ui components
├── lib/
│ ├── ai/ # AI models, prompts, tools
│ ├── auth/ # Better Auth configuration
│ ├── cache/ # Redis client & rate limiters
│ ├── db/ # Drizzle schema & client
│ ├── email/ # Resend client & templates
│ ├── payments/ # Dodo Payments integration
│ ├── storage/ # R2 storage utilities
│ └── analytics/ # PostHog client
├── trigger/ # Trigger.dev background tasks
├── env.ts # Environment validation (T3 Env)
└── proxy.ts # Next.js proxy (auth protection)
- Node.js 20+
- pnpm 9+
- PostgreSQL database (recommend Neon)
- Clone the repository
git clone https://github.com/yourusername/craftjs.git
cd craftjs- Install dependencies
pnpm install- Set up environment variables
cp .env.example .envFill in your environment variables (see Environment Variables section).
- Set up the database
pnpm db:push- Run the development server
pnpm devOpen http://localhost:3000 to see your app.
Create a .env file based on .env.example:
# Database (Neon PostgreSQL)
DATABASE_URL="postgresql://..."
# Authentication (Better Auth)
BETTER_AUTH_SECRET="your-secret-key"
BETTER_AUTH_URL="http://localhost:3000"
# OAuth Providers (optional)
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
# AI Providers (at least one required)
OPENAI_API_KEY=""
ANTHROPIC_API_KEY=""
GOOGLE_GENERATIVE_AI_API_KEY=""
# Payments (Dodo Payments)
DODO_API_KEY=""
DODO_WEBHOOK_SECRET=""
# Email (Resend)
RESEND_API_KEY=""
RESEND_FROM_EMAIL="noreply@yourdomain.com"
# Cache (Upstash Redis)
UPSTASH_REDIS_REST_URL=""
UPSTASH_REDIS_REST_TOKEN=""
# Storage (Cloudflare R2)
R2_ACCOUNT_ID=""
R2_ACCESS_KEY_ID=""
R2_SECRET_ACCESS_KEY=""
R2_BUCKET_NAME=""
R2_PUBLIC_URL=""
# Analytics (PostHog)
NEXT_PUBLIC_POSTHOG_KEY=""
NEXT_PUBLIC_POSTHOG_HOST="https://us.i.posthog.com"
# Customer Support (Tawk.to)
NEXT_PUBLIC_TAWK_PROPERTY_ID=""
NEXT_PUBLIC_TAWK_WIDGET_ID=""
# Background Jobs (Trigger.dev)
TRIGGER_SECRET_KEY=""| Script | Description |
|---|---|
pnpm dev |
Start development server with Turbopack |
pnpm build |
Build for production |
pnpm start |
Start production server |
pnpm lint |
Run ESLint |
pnpm format |
Format code with Prettier |
pnpm format:check |
Check formatting |
pnpm db:push |
Push schema changes to database |
pnpm db:studio |
Open Drizzle Studio |
pnpm db:generate |
Generate migrations |
pnpm db:migrate |
Run migrations |
Better Auth provides:
- Email/Password - Built-in with email verification
- OAuth - Google and GitHub providers configured
- Session Management - Secure cookie-based sessions
- Protected Routes - Proxy-based route protection
The boilerplate supports multiple AI providers:
// Available models
const models = {
"gpt-4o": openai("gpt-4o"),
"gpt-4o-mini": openai("gpt-4o-mini"),
"claude-sonnet-4": anthropic("claude-sonnet-4-20250514"),
"claude-3-5-haiku": anthropic("claude-3-5-haiku-latest"),
"gemini-2-flash": google("gemini-2.0-flash"),
};Features:
- Streaming responses
- Tool calling support
- Rate limiting per user
- Usage tracking
Pre-configured plans with Dodo Payments:
| Plan | Price | Features |
|---|---|---|
| Free | $0/mo | 100 AI requests, 10MB storage |
| Pro | $19/mo | 10,000 AI requests, 10GB storage |
| Enterprise | $99/mo | Unlimited requests, 100GB storage |
- Push your code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy!
The app can be deployed to any platform supporting Next.js:
- AWS (Amplify, Lambda)
- Google Cloud Run
- Railway
- Render
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
Built with these amazing open source projects:
Made with ❤️ for the AI developer community