2026-04-21 19:37:24 +00:00
# convex-next-saas
2026-03-25 22:28:16 +00:00
2026-04-21 19:37:24 +00:00
A personal, opinionated SaaS template built for speed. Next.js 16 + Convex self-hosted + Better Auth + Resend.
2026-03-25 22:28:16 +00:00
2026-04-21 19:37:24 +00:00
> This template is tailored for self-hosted Convex on Coolify with a private Forgejo workflow. It's not trying to be a generic marketplace template — it's the setup I actually use to ship projects fast.
2026-03-25 22:28:16 +00:00
2026-04-21 19:37:24 +00:00
## Stack
2026-03-25 22:28:16 +00:00
2026-04-21 19:37:24 +00:00
- **Frontend**: Next.js 16 (App Router), React 19, TypeScript 5, Tailwind CSS 4
- **Backend**: Convex self-hosted (Docker on Coolify)
- **Auth**: Better Auth (email/password, email verification, password reset)
- **Email**: Resend (free tier: 3,000 emails/month)
- **UI**: shadcn/ui (radix-nova), @hugeicons/react
- **i18n**: next-intl v4 with locale routing (`/en`, `/pl` )
- **State**: RSC + Client Components hybrid
- **Validation**: Zod v4
- **Linting**: ESLint + oxlint
2026-03-25 22:28:16 +00:00
2026-04-21 19:37:24 +00:00
## What's Included
2026-03-25 22:28:16 +00:00
2026-04-21 19:37:24 +00:00
- [x] Email/password auth with HIBP password checking
- [x] Email verification flow
- [x] Forgot / reset password flow
- [x] Change password (authenticated)
- [x] Locale-based routing (EN / PL)
- [x] Theme switching (dark/light/system)
- [x] Protected routes with redirect + callbackURL
- [x] Runtime env validation (Zod)
- [x] GitHub Actions CI (lint + build)
- [x] Project init script (`bin/init-template.mjs`)
2026-05-15 17:42:06 +00:00
- [x] PWA Lite installability (manifest + icons)
2026-03-25 22:28:16 +00:00
2026-04-21 19:37:24 +00:00
## Quick Start
2026-03-25 22:05:06 +00:00
```bash
2026-04-21 19:37:24 +00:00
git clone < your-forgejo-repo > my-project
cd my-project
pnpm install
2026-03-28 10:21:58 +00:00
2026-04-21 19:37:24 +00:00
# Copy and fill env vars
cp .env.example .env.local
2026-03-26 23:14:51 +00:00
2026-04-21 19:37:24 +00:00
# Set up Convex backend (see DEVELOPMENT.md)
# Then:
pnpm dev --webpack
2026-03-26 23:14:51 +00:00
```
2026-04-21 19:37:24 +00:00
> ⚠️ **Always use `--webpack`** — Turbopack is broken in Next.js 16.2.1 (900% CPU spike).
2026-03-26 23:14:51 +00:00
2026-04-21 19:37:24 +00:00
## Project Bootstrap
2026-03-26 23:14:51 +00:00
2026-04-21 19:37:24 +00:00
```bash
node bin/init-template.mjs my-project
cd my-project
# Fill .env.local, deploy Convex, done.
2026-03-26 23:14:51 +00:00
```
2026-03-30 22:07:33 +00:00
2026-04-21 19:37:24 +00:00
## Docs
2026-03-28 11:58:16 +00:00
2026-04-21 19:37:24 +00:00
- [`AGENTS.md` ](./AGENTS.md ) — Architecture, conventions, and anti-patterns for AI agents
- [`DEVELOPMENT.md` ](./DEVELOPMENT.md ) — Local setup, Coolify deployment, troubleshooting
2026-03-28 11:58:16 +00:00
2026-04-21 19:37:24 +00:00
## Environments
2026-03-28 11:58:16 +00:00
2026-04-21 19:37:24 +00:00
- **Dev**: `develop` branch
- **Prod**: `main` branch
2026-03-26 23:14:51 +00:00
2026-04-21 19:37:24 +00:00
## License
2026-03-26 23:14:51 +00:00
2026-04-21 19:37:24 +00:00
MIT — do whatever you want.