Back to projects

Auth.js Template

Production-ready authentication starter with Next.js 15, Auth.js v5, Prisma ORM, and multi-provider OAuth support.

Next.js 15TypeScriptAuth.js v5PrismaTailwind v4
Auth.js Template

Problem

Every new Next.js project I started repeated the same three days of work: wire Auth.js, set up a Prisma schema, scaffold a login page that doesn't look like a default tutorial, and bolt on a theme toggle. I built this template so day one of any new project starts at 'add features' instead of 'configure auth and database'.

Approach

Next.js 15 App Router as the base, with Auth.js v5 pre-configured for three OAuth providers (Google, GitHub, Twitter). Prisma ORM with a Postgres schema, ready to migrate via `prisma db push`. shadcn/ui components on top of Tailwind CSS for the visual layer, with dark/light mode built in. Middleware-level route protection means a single `middleware.ts` file gates the whole protected area — no per-page auth checks. The template ships with example login, profile, docs, and about pages so new contributors can see all the patterns side-by-side.

Stack & rationale

  • Next.js 15
    Latest App Router with Turbopack dev server — sub-second HMR even on bigger projects. Server actions for form mutations.
  • Auth.js v5
    Multi-provider OAuth with JWT sessions. v5's edge-compatible session checks let middleware handle gating without a Node runtime.
  • Prisma + PostgreSQL
    Type-safe queries from the schema generator, with Postgres as the production-ready default. `DATABASE_URL` + `DIRECT_URL` pattern works with Vercel Postgres, Supabase, Neon, etc.
  • shadcn/ui + Tailwind v4
    Components live in your repo (not node_modules), so customisation is just code editing. Tailwind v4's CSS-first config removes the `tailwind.config.js` step entirely.
  • TypeScript
    Strict mode by default. Type-safe routes plus typed Prisma client mean refactors stay honest.

Highlights

  • OAuth with Google, GitHub, and Twitter pre-wired — drop in client IDs and go
  • Middleware-based route protection: one file gates the whole app
  • Prisma + Postgres schema ready for cloud DBs (Vercel Postgres, Supabase, Neon)
  • Dark / light mode via next-themes, with shadcn/ui components that respect both
  • Example login, profile, docs, and about pages as living patterns for new contributors