Next.js fullstack starter with PostgreSQL, authentication, and Docker.
- Next.js 16
- PostgreSQL 18
- Tailwind CSS v4 + shadcn/ui
- better-auth (authentication)
- Drizzle ORM (database)
- pnpm
docker compose up --buildApp: http://localhost:33333 Database: localhost:33334
Database migrations run automatically via db:push in the container.
- Copy environment variables:
cp .env.example .env-
Set up your PostgreSQL database and update
DATABASE_URLin.env -
Apply database schema:
pnpm db:push- Start the development server:
pnpm devThis starter includes authentication via better-auth with the following features:
- Email/password sign-up and sign-in
- Session management with secure cookies
- Protected routes (
/user/dashboard,/user/settings) - Google OAuth (optional, requires configuration)
Routes under /user/dashboard and /user/settings require authentication. Unauthenticated users are redirected to the sign-in page.
| Variable | Required | Description |
|---|---|---|
DATABASE_URL |
Yes | PostgreSQL connection string |
BETTER_AUTH_SECRET |
Yes | Secret key for auth token signing |
BETTER_AUTH_URL |
Yes | Base URL for auth callbacks (e.g., http://localhost:33333) |
NEXT_PUBLIC_APP_URL |
Yes | Public app URL for client-side |
GOOGLE_CLIENT_ID |
No | Google OAuth client ID |
GOOGLE_CLIENT_SECRET |
No | Google OAuth client secret |
See .env.example for a template.