Break the SaaS shackles. Deploy Next.js on your own terms.
Unchained Next is an open-source playbook and boilerplate designed to replace the "Vercel + Clerk + Neon" tax with a robust, self-hosted alternative. We provide configuration, manifests, and guides to run a modern full-stack app using industry-standard open-source tools.
The "Modern Stack" has become a subscription trap. You shouldn't have to pay per-user fees just to authenticate users or store rows in a database.
| Feature | The "SaaS" Way (Vercel/Clerk/Neon) | The Unchained Way |
|---|---|---|
| Hosting | Serverless Pricing (Unpredictable) | Docker / K8s (Fixed Cost VPS) |
| Auth | $ per Monthly Active User | NextAuth + Prisma (Free & Owned) |
| Database | Pricing based on compute hours | Standard PostgreSQL Container |
| Architecture | Scattered Microservices | Unified Monorepo (Turborepo) |
| Cost | Scales with traffic ($$$) | Scales with hardware ($) |
We stripped away the complexity of external auth services in favor of a pure architecture that you own completely, organized via Turborepo.
- Monorepo Tooling: Turborepo
- Application: Next.js (
apps/web) - Authentication: NextAuth.js with Credentials Provider
- ORM: Prisma (
packages/db) - Database: PostgreSQL
- Infrastructure: Docker Compose (Local) & Helm / Kubernetes (Production)
- User submits email/password to the Next.js API.
- NextAuth verifies credentials against the database via Prisma.
- Session tokens are issued without external dependencies.
- All database schemas are managed centrally in
packages/db.
unchained-next/
├── apps/
│ └── web/ # The Main Next.js Application
├── packages/
│ ├── db/ # Prisma Schema, Migrations & Client
│ ├── design-system/ # Shared UI Components
│ ├── eslint-config/ # Shared Linting Rules
│ └── typescript-config/ # Shared TS Configs
├── docker/ # Docker related files
├── ops/
│ └── helm/ # Helm Charts for Production Deployment
├── templates/ # Environment variable templates (.tpl)
├── setup-env.sh # Script to generate .env files from templates
├── docker-compose.yml # Local development
├── docker-compose.preprod.yml# Pre-production setup
├── LICENSE
├── package.json
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── README.md
└── turbo.json
- Docker & Docker Compose
- Node.js 18+ & pnpm
git clone https://github.com/yourusername/unchained-next.git
cd unchained-nextchmod +x setup-env.sh
./setup-env.shThis will generate .env files based on the templates in templates/.
pnpm installdocker-compose up -dpnpm db:pushpnpm devVisit http://localhost:3000 to see your app.
For production, we use Helm charts stored in ops/helm.
cd ops/helm
helm install CHANGE_RELEASE_TAG ./unchained-web -f ./unchained-web/values.yamlReplace CHANGE_RELEASE_TAG with your release name.
Note:
values.yamlare generated automatically with the help of the/setup-env.shscript
- Integrate WebAuthn (Passkeys) in NextAuth.js
- Standardize
IMAGE_NAMEacross.envtemplates and Helm charts.
- Add documentation for creating
imagePullSecretsin Kubernetes for private registries. - Add documentation for creating ingress and cert-manager in Kubernetes.
- GitHub Actions workflow for building, caching, and deploying Docker images.
- GitHub Actions workflow for automatically running
prisma db pushon production DB.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes
- Open a Pull Request
Distributed under the MIT License.