Next.js Lucia Auth Starter is an open-source Next.js boilerplate that wires session-based email/password and OAuth authentication through Lucia, with Drizzle ORM over PostgreSQL, tRPC procedures, Stripe subscriptions, React Email templates and Playwright E2E tests pre-configured.
What is the Next.js Lucia Auth Starter?
It is a starter template for a Next.js App Router project where authentication is already built, rather than added later. You clone the repository, fill in environment variables from .env.example, run the install command, push the Drizzle schema to PostgreSQL and start the dev server. The output is a running app with credential login, OAuth login, email verification, password reset links, protected routes and user subscriptions, plus the surrounding tooling (tRPC, Tailwind, shadcn UI, Playwright) already wired together. It exists because NextAuth intentionally limits email/password support to discourage password use, while some client projects still require it; Lucia is used as the less opinionated alternative.
Key Features
- Credential and OAuth authentication — email/password sign-in plus OAuth providers, with Lucia managing sessions.
- Route authorization — public and protected routes defined inside the Next.js
appdirectory. - Email verification — confirms user identity by email before the account is treated as verified.
- Password reset — sends a reset link by email to recover an account.
- Lucia plus tRPC — sessions and user information are exposed through tRPC procedures, mirroring the NextAuth-with-tRPC pattern.
- Stripe subscriptions — user subscription setup is marked as integrated in the roadmap.
- PostgreSQL with Drizzle ORM — typed schema and queries, with a bundled migration script to extend the schema.
- React Email templates — transactional email composition in React components.
- Playwright E2E tests — a test suite run against production build output.
- Styling stack — Tailwind CSS with shadcn UI components and React Hook Form for forms.
Who should use this template?
- Next.js developers on client projects that explicitly require user password authentication, which NextAuth discourages.
- T3-stack teams already using tRPC, Drizzle and Tailwind who want auth and billing in place before writing product code.
- Developers who want customization over a convention-heavy auth library; Lucia is described as less opinionated, requiring more setup in exchange for flexibility.
- Teams adding paid plans who need Stripe subscription scaffolding alongside login.
Use cases
- SaaS founders: start from working login, email verification and password reset instead of building them, then add subscription billing through the included Stripe integration.
- Full-stack developers: extend the Drizzle schema with the included migration script and expose new data through tRPC procedures that already have access to the session.
- QA-conscious teams: run the Playwright E2E suite against a production build with the test command to catch auth regressions before release.
- CI users: add
DATABASE_URL,DISCORD_CLIENT_IDandDISCORD_CLIENT_SECRETto GitHub Actions repository secrets to run the flow in CI.
How does it work?
Setup is a short ordered flow: clone the repository, copy .env.example to .env and fill in values, run pnpm install, uncomment the webCrypto polyfills in the auth module if you are on Node 18 or lower, then update the app title and database prefix in the constants file. After that you push the schema with pnpm db:push and start the server with pnpm dev.
FAQ
Is Next.js Lucia Auth Starter free?
It is a public GitHub repository that you clone and adapt, so there is no product price; you install dependencies with pnpm install and pay only for the services you connect, such as PostgreSQL hosting and Stripe. The repository has accumulated roughly 536 stars on GitHub.
Why use Lucia instead of NextAuth.js?
NextAuth intentionally restricts email/password functionality because passwords add security risk and complexity. Lucia is less opinionated, so it needs more setup but allows authentication configurations that NextAuth does not support well, including the email/password flow this template targets.
Does it support OAuth sign-in?
Yes. The feature list includes both credential and OAuth authentication, and the GitHub Actions instructions reference Discord client credentials, so a Discord OAuth provider is part of the setup path covered by the repository.
Which database and ORM does it use?
PostgreSQL, accessed through Drizzle ORM. You push the schema to your database with pnpm db:push, and the template ships a migration script you can extend when your project needs additional tables or columns.
What is still missing from the template?
The roadmap lists update-password as unchecked, with an admin dashboard and role-based access policy both marked as under consideration. Stripe integration is the only roadmap item marked complete, and the E2E tests are run with Playwright against a production build.






