{"id":51520631,"url":"https://github.com/essedev/templator","last_synced_at":"2026-07-08T15:03:28.768Z","repository":{"id":324703449,"uuid":"1073523646","full_name":"essedev/templator","owner":"essedev","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-18T15:23:25.000Z","size":936,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-18T23:24:29.353Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/essedev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-10T08:33:44.000Z","updated_at":"2026-01-18T15:23:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/essedev/templator","commit_stats":null,"previous_names":["essedotdev/templator","essedev/templator"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/essedev/templator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essedev%2Ftemplator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essedev%2Ftemplator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essedev%2Ftemplator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essedev%2Ftemplator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/essedev","download_url":"https://codeload.github.com/essedev/templator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essedev%2Ftemplator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35268561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-08T15:03:27.900Z","updated_at":"2026-07-08T15:03:28.762Z","avatar_url":"https://github.com/essedev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Templator\n\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue.svg)](https://www.typescriptlang.org/)\n[![Next.js](https://img.shields.io/badge/Next.js-15-black.svg)](https://nextjs.org/)\n\nAI-first Next.js template for rapid development with authentication, database, and Cloudflare Workers deployment.\n\n⭐ **Star this repo** if you find it useful!\n\n## 📋 Table of Contents\n\n- [Who Is This For?](#-who-is-this-for)\n- [Conscious Trade-offs \u0026 Known Limitations](#️-conscious-trade-offs--known-limitations)\n- [Tech Stack](#tech-stack)\n- [Features](#features)\n- [Quick Start](#quick-start)\n- [Project Structure](#project-structure)\n- [Available Scripts](#available-scripts)\n- [Email Configuration](#email-configuration)\n- [Deployment](#deployment)\n- [Documentation](#documentation)\n- [Comparison](#-comparison)\n\n## 🎯 Who Is This For?\n\n**Perfect for:**\n\n- 🚀 **Startup founders** building MVPs rapidly with AI assistance\n- 💼 **Indie hackers** needing auth + RBAC + email flows out-of-the-box\n- 🤖 **AI-first developers** using Cursor, Claude Code, GitHub Copilot\n- 🎓 **Learners** exploring modern Next.js App Router + Drizzle architecture\n\n**Not ideal for:**\n\n- Teams requiring extensive testing infrastructure from day 1\n- Projects with highly custom authentication requirements\n- Applications needing complex multi-tenancy from the start\n- Real-time applications (WebSocket, live collaboration)\n- Heavy computation workloads (video processing, ML inference)\n\n## ⚠️ Conscious Trade-offs \u0026 Known Limitations\n\nThis template prioritizes **speed and simplicity** for MVP development. Here's what you should know before choosing Templator:\n\n### What's NOT Included (By Design)\n\n**Testing Infrastructure**\n\n- No Vitest/Jest, Testing Library, or E2E tests\n- **Why**: 90% of MVPs don't need tests day 1. TypeScript + ESLint catch most bugs.\n- **When to add**: Before first paying customers or when team grows beyond 3 developers\n- See [docs/LIMITATIONS.md](docs/LIMITATIONS.md#testing-infrastructure) for migration guide\n\n**Error Monitoring \u0026 Analytics**\n\n- No Sentry, Axiom, or analytics integration\n- **Why**: Adds complexity and cost for early prototypes\n- **When to add**: Week 1 of production traffic\n- See [docs/LIMITATIONS.md](docs/LIMITATIONS.md#error-monitoring) for setup guide\n\n**Advanced Features**\n\n- ❌ WebSocket/real-time (Cloudflare Workers limitation)\n- ❌ File uploads (needs R2 bucket configuration)\n- ❌ Payment processing (Stripe integration needed)\n- ❌ Multi-tenancy (single-organization RBAC only)\n- ❌ Internationalization (English-only by default)\n- **Why**: Keep template focused, add these when business validated\n\n### Cloudflare Workers Constraints\n\n**Free Tier Limits** (100,000 requests/day):\n\n- 10ms CPU time per request\n- 128MB memory\n- 1MB response size\n- Good for: Content sites, forms, auth flows\n\n**Paid Tier** ($5/mo for 10M requests):\n\n- 30s CPU time (Workers Standard) or 15min (Workers Unbound)\n- Still 128MB memory\n- 25MB+ response size\n- Good for: API-heavy apps, complex queries\n\n**What Doesn't Work**: WebSocket, filesystem access, long-running background jobs\n\nSee [docs/LIMITATIONS.md](docs/LIMITATIONS.md#cloudflare-workers-constraints) for workarounds and alternatives.\n\n### When NOT to Use Templator\n\n❌ **Enterprise with strict compliance** (SOC2, HIPAA day 1) → Use custom build or commercial starter\n❌ **Complex B2B SaaS** (multi-tenancy, teams, 10+ permission levels) → Fork and extend RBAC\n❌ **Real-time apps** (chat, multiplayer, live collaboration) → Consider [Supabase integration](docs/SUPABASE_INTEGRATION.md) or traditional server\n❌ **Heavy computation** (video encoding, ML inference) → Use serverless functions or dedicated servers\n\n✅ **Perfect for**: Content sites, SaaS MVPs, internal tools, API-first apps, landing pages with auth\n\nFor detailed limitations and migration paths, see [docs/LIMITATIONS.md](docs/LIMITATIONS.md).\nFor adding real-time features, see [docs/SUPABASE_INTEGRATION.md](docs/SUPABASE_INTEGRATION.md).\n\n## Tech Stack\n\n### Core\n\n- **Next.js 15** - App Router, Server Components, Server Actions\n- **React 19** - Latest React with Suspense and Transitions\n- **TypeScript** - Strict mode with full type safety\n- **Tailwind CSS 4** - Utility-first styling\n- **shadcn/ui** - Beautiful, accessible components\n\n### Database \u0026 Auth\n\n- **Drizzle ORM** - TypeScript-first ORM with edge support\n- **Neon PostgreSQL** - Serverless Postgres with branching\n- **Better Auth** - Modern authentication with built-in security\n\n### Deployment\n\n- **Cloudflare Workers** - Edge deployment with zero cold starts\n- **OpenNext** - Next.js adapter for Cloudflare\n\n### Developer Experience\n\n- **Turbopack** - Ultra-fast bundler for development (built into Next.js 15)\n- **ESLint** - Code linting\n- **Prettier** - Code formatting\n- **React Hook Form + Zod** - Type-safe form validation\n\n## ✨ Features\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 🔐 Authentication \u0026 RBAC\n\n- ✅ Email/password with Better Auth\n- ✅ Email verification \u0026 password reset (built-in)\n- ✅ Role-Based Access Control (user/editor/admin)\n- ✅ Protected routes with middleware\n- ✅ Rate limiting for security\n- ✅ Custom PBKDF2 hashing (Cloudflare Workers compatible)\n\n\u003c/td\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 📧 Email System\n\n- ✅ React Email templates\n- ✅ Mock mode for development\n- ✅ Resend integration for production\n- ✅ Transactional email flows\n- ✅ Password reset \u0026 verification\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n### 🗄️ Database\n\n- ✅ Drizzle ORM with Neon PostgreSQL\n- ✅ Type-safe queries with TypeScript\n- ✅ Migrations with Drizzle Kit\n- ✅ Edge-compatible architecture\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n### 🎨 UI Components\n\n- ✅ shadcn/ui components library\n- ✅ Dark mode support (next-themes)\n- ✅ Responsive design\n- ✅ Toast notifications (Sonner)\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n### 📝 Feature Modules\n\n- ✅ Contact form with Server Actions\n- ✅ Newsletter with double opt-in\n- ✅ Blog system (draft/publish workflow)\n- ✅ Profile management\n- ✅ User management (admin only)\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n### 🚀 Developer Experience\n\n- ✅ AI-optimized architecture\n- ✅ Type-safe end-to-end\n- ✅ Hot reload with Turbopack\n- ✅ ESLint + Prettier configured\n- ✅ Comprehensive documentation\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd colspan=\"2\"\u003e\n\n### 🔒 Security \u0026 SEO\n\n- ✅ Security headers configured (HSTS, X-Frame-Options, CSP, etc.)\n- ✅ Dynamic sitemap.xml with blog posts\n- ✅ robots.txt with search engine directives\n- ✅ Open Graph \u0026 Twitter Cards metadata\n- ✅ Structured logging for debugging\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n✅ **Pages**\n\n- Landing page with Hero, Features, CTA\n- Pricing page\n- Contact page\n- Blog listing and individual post pages\n- Authentication pages (login/register)\n- Dashboard with role-based sections\n  - Dashboard overview (all users)\n  - Profile management (all users)\n  - Blog management (editor/admin)\n    - List all posts (draft + published)\n    - Create new post\n    - Edit existing post\n    - Delete post\n  - Newsletter subscribers (editor/admin)\n  - Contact messages (editor/admin)\n  - User management (admin only)\n\n## Quick Start\n\n### 1. Clone \u0026 Install\n\n```bash\n# Using this template on GitHub (recommended)\n# Click \"Use this template\" button at the top of this repo\n\n# Or clone directly\ngit clone https://github.com/yourusername/templator.git\ncd templator\npnpm install\n```\n\n### 2. Environment Setup\n\nCreate `.env` file:\n\n```bash\n# Database (Neon PostgreSQL)\nDATABASE_URL=\"postgresql://...\"\n\n# Better Auth\nBETTER_AUTH_URL=\"http://localhost:3000\"\nBETTER_AUTH_SECRET=\"run: openssl rand -base64 32\"\nNEXT_PUBLIC_APP_URL=\"http://localhost:3000\"\n\n# Email (optional - mock by default)\nADMIN_EMAIL=\"admin@yourdomain.com\"\n# RESEND_API_KEY=\"re_xxxxx\" # Uncomment to enable real emails\n```\n\nGenerate Better Auth secret:\n\n```bash\nopenssl rand -base64 32\n```\n\n### 3. Database Setup\n\n```bash\n# Generate migration\npnpm db:generate\n\n# Push to database\npnpm db:push\n\n# Open Drizzle Studio (optional)\npnpm db:studio\n```\n\n### 4. Run Development Server\n\n```bash\npnpm dev\n```\n\nOpen [http://localhost:3000](http://localhost:3000)\n\n## Project Structure\n\n```\nsrc/\n├── app/\n│ ├── (routes)/ # Page routes\n│ ├── dashboard/ # Protected dashboard with RBAC\n│ ├── api/auth/ # Better Auth handler\n│ ├── layout.tsx # Root layout with providers\n│ └── providers.tsx # Client providers (Theme)\n├── components/\n│ ├── ui/ # shadcn/ui components\n│ ├── layout/ # Navbar, Footer, ThemeToggle\n│ ├── auth/ # RBAC components (RoleGate, RoleGateClient)\n│ ├── dashboard/ # Dashboard components (DashboardNav)\n│ └── common/ # Shared components (PageHeader, Section)\n├── features/\n│ ├── auth/ # Authentication (schema, actions)\n│ ├── users/ # User management (admin actions)\n│ ├── profile/ # Profile editing (actions, form)\n│ ├── blog/ # Blog posts (schema, actions, PostForm)\n│ ├── contact/ # Contact form feature\n│ └── newsletter/ # Newsletter feature\n├── lib/\n│ ├── auth.ts # Better Auth config\n│ ├── auth-client.ts # Client-side hooks\n│ ├── permissions.ts # RBAC permission system\n│ ├── password.ts # PBKDF2 hashing (Cloudflare Workers compatible)\n│ └── utils.ts # Utility functions (cn, etc.)\n├── db/\n│ ├── schema.ts # Drizzle schema (users with roles)\n│ └── index.ts # Database client\n├── hooks/ # Custom React hooks\n└── types/ # TypeScript types (NextAuth extensions)\n```\n\n## Available Scripts\n\n```bash\n# Development\npnpm dev              # Start dev server with Turbopack\npnpm build            # Production build\npnpm start            # Start production server\n\n# Code Quality\npnpm lint             # Run ESLint\npnpm format           # Format code with Prettier\npnpm format:check     # Check code formatting\npnpm typecheck        # TypeScript type checking\n\n# Database\npnpm db:generate      # Generate migrations\npnpm db:push          # Push schema to database\npnpm db:studio        # Open Drizzle Studio\n\n# Cloudflare\npnpm deploy           # Deploy to Cloudflare\npnpm preview          # Preview Cloudflare build\npnpm cf-typegen       # Generate Cloudflare types\n```\n\n## 📧 Email Configuration\n\nBy default, emails are mocked (logged to console). To enable real emails with Resend:\n\n\u003e **Note:** Resend is already installed in this template.\n\n1. Get API key from [Resend](https://resend.com)\n2. Add to `.env`:\n   ```bash\n   RESEND_API_KEY=\"re_xxxxx\"\n   EMAIL_FROM=\"noreply@yourdomain.com\"\n   EMAIL_PROVIDER=\"resend\"\n   ```\n3. Verify your domain in Resend dashboard (required for production)\n\nSee [`docs/EMAIL_SYSTEM.md`](docs/EMAIL_SYSTEM.md) for detailed configuration and templates guide.\n\n## Deployment\n\n### Cloudflare Workers (Recommended)\n\n**Why Cloudflare Workers?**\n\n- Global edge network with zero cold starts\n- Free tier: 100k requests/day\n- Perfect match with Neon PostgreSQL\n- OpenNext adapter maintains Next.js compatibility\n\n**First-time setup:**\n\n```bash\n# Login to Cloudflare\npnpm wrangler login\n\n# Set secrets (don't use plain env vars for sensitive data)\npnpm wrangler secret put DATABASE_URL\npnpm wrangler secret put NEXTAUTH_SECRET\n```\n\n**Deploy:**\n\n```bash\n# Build and deploy to production\npnpm deploy\n\n# Or preview before deploying\npnpm preview\n```\n\n**Configuration:**\n\n- Edit `wrangler.jsonc` for worker settings\n- OpenNext config in `open-next.config.ts`\n\n### Environment Variables\n\n**Local development (`.env`):**\n\n```bash\nDATABASE_URL=\"postgresql://...\"\nNEXTAUTH_URL=\"http://localhost:3000\"\nNEXTAUTH_SECRET=\"...\"\nADMIN_EMAIL=\"admin@yourdomain.com\"\n```\n\n**Production (Cloudflare):**\n\nSet secrets via Wrangler CLI (recommended):\n\n```bash\npnpm wrangler secret put DATABASE_URL\npnpm wrangler secret put NEXTAUTH_SECRET\npnpm wrangler secret put ADMIN_EMAIL\n```\n\nOr set in Cloudflare dashboard → Workers → Settings → Variables and Secrets\n\n**Required:**\n\n- `DATABASE_URL` - Neon connection string\n- `BETTER_AUTH_URL` - Your production URL (e.g., https://yourapp.workers.dev)\n- `BETTER_AUTH_SECRET` - Same as local (use `openssl rand -base64 32`)\n- `NEXT_PUBLIC_APP_URL` - Same as BETTER_AUTH_URL\n\n**Optional:**\n\n- `ADMIN_EMAIL` - For contact form notifications\n- `RESEND_API_KEY` - If using real email (instead of mock)\n\n## Development Workflow\n\n1. **Add new feature**:\n\n   ```bash\n   mkdir -p src/features/my-feature\n   # Create: schema.ts, actions.ts, MyFeatureForm.tsx, README.md\n   ```\n\n2. **Add database table**:\n   - Edit `src/db/schema.ts`\n   - Run `pnpm db:generate`\n   - Run `pnpm db:push`\n\n3. **Add new page**:\n   - Create in `src/app/my-page/page.tsx`\n   - Add link to `Navbar.tsx`\n\n4. **Validation loop** (before commit):\n   ```bash\n   pnpm format      # Format code\n   pnpm lint        # Check linting\n   pnpm typecheck   # Check types\n   pnpm build       # Test build\n   ```\n\n## Documentation\n\nSee `docs/` folder for detailed guides:\n\n- **`LIMITATIONS.md`** - Known limitations, platform constraints, and migration paths\n- **`SUPABASE_INTEGRATION.md`** - Adding real-time, storage, and enhanced database features with Supabase\n- **`AUTHENTICATION.md`** - Complete Better Auth guide (email/password, verification, password reset)\n- **`AUTHENTICATION_ADVANCED.md`** - Advanced auth flows (security, edge compatibility)\n- **`RBAC.md`** - Role-Based Access Control system (user/editor/admin)\n- **`ARCHITECTURE.md`** - Project structure and conventions\n- **`AI_WORKFLOW.md`** - Working with AI assistants (includes `/changelog` and `/release` commands)\n- `STACK.md` - Technology choices and rationale (Drizzle, Better Auth, Cloudflare)\n- `DEPLOYMENT.md` - Cloudflare Workers deployment guide\n- `MIDDLEWARE.md` - Authentication middleware (edge-compatible)\n- `EMAIL_SYSTEM.md` - Email configuration and templates\n- `recipes/` - Step-by-step guides for common tasks\n\n## 📊 Comparison\n\nHow does Templator compare to other Next.js starters?\n\n| Feature                | Templator                     | create-t3-app     | Next.js SaaS Starter |\n| ---------------------- | ----------------------------- | ----------------- | -------------------- |\n| **Auth System**        | ✅ Better Auth + RBAC         | ✅ NextAuth       | ⚠️ Custom            |\n| **Email Verification** | ✅ Built-in                   | ❌ Manual setup   | ❌ Manual setup      |\n| **Password Reset**     | ✅ Built-in                   | ❌ Manual setup   | ❌ Manual setup      |\n| **Role-Based Access**  | ✅ 3-tier RBAC                | ❌ DIY            | ❌ DIY               |\n| **Email Templates**    | ✅ React Email                | ❌                | ❌                   |\n| **Edge Deployment**    | ✅ Cloudflare Workers         | ⚠️ Vercel-focused | ⚠️ Vercel-focused    |\n| **AI-Optimized**       | ✅ Feature-based architecture | ❌                | ❌                   |\n| **Documentation**      | ✅ Comprehensive docs/        | ⚠️ Basic          | ⚠️ Basic             |\n| **Database ORM**       | Drizzle                       | Drizzle/Prisma    | Prisma               |\n| **Blog System**        | ✅ Built-in                   | ❌                | ❌                   |\n\n## Tech Stack Details\n\n**Why Drizzle over Prisma?**\n\n- TypeScript-first with native type inference\n- Better performance for serverless/edge\n- Smaller bundle size\n- Perfect Cloudflare Workers compatibility\n\n**Why Better Auth?**\n\n- Modern, actively maintained (Auth.js/NextAuth is now maintained by Better Auth team)\n- Built-in rate limiting, email verification, password reset\n- TypeScript-first with excellent type inference\n- Cloudflare Workers compatible (custom PBKDF2 hashing)\n- No SessionProvider wrapper needed\n\n**Why Cloudflare Workers?**\n\n- Global edge deployment\n- Zero cold starts\n- Generous free tier (100k req/day)\n- Perfect with Neon PostgreSQL\n\n## Credits\n\nBuilt with:\n\n- [Next.js](https://nextjs.org)\n- [Drizzle ORM](https://orm.drizzle.team)\n- [Better Auth](https://better-auth.com)\n- [shadcn/ui](https://ui.shadcn.com)\n- [Tailwind CSS](https://tailwindcss.com)\n- [Cloudflare Workers](https://workers.cloudflare.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fessedev%2Ftemplator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fessedev%2Ftemplator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fessedev%2Ftemplator/lists"}