Minimal Next.js starter based on dotnize/tanstarter.
- Next.js 15 + React 19
- Tailwind CSS + shadcn/ui
- Drizzle ORM + PostgreSQL
- Better Auth
- Prettier + ESLint + Husky
-
Use this template or clone this repository.
-
Install dependencies:
pnpm install # npm install
-
Create a
.env
file based on.env.example
. -
Push the schema to your database with drizzle-kit:
pnpm db push # npm run db push
-
Run the development server:
pnpm dev # npm run dev
The development server should be now running at http://localhost:3000.
- shadcn-ui/ui#6714 - We're using the
canary
version of shadcn/ui for Tailwind v4 support.
Better Auth is currently configured for OAuth with GitHub, Google, and Discord, but can be easily modified to use other providers.
If you want to use email/password authentication or change providers, update the auth config and signin page with your own UI. You can use shadcn/ui login blocks or @daveyplate/better-auth-ui as a starting point.
These scripts in package.json use pnpm by default, but you can modify them to use your preferred package manager.
auth:generate
- Regenerate the auth db schema if you've made changes to your Better Auth config.db
- Run drizzle-kit commands. (e.g.pnpm db generate
to generate a migration)ui
- The shadcn/ui CLI. (e.g.pnpm ui add button
to add the button component)format
andlint
- Run Prettier and ESLint.
getAuthSession()
- Retrieves the session and user data. Can be used in server components, API route handlers, and server actions.authGuard(redirectUrl?: string)
- Same asgetAuthSession
, but redirects to the specified URL or unauthorized.tsx if the user is not authenticated.ThemeToggle.tsx
- A simple component to toggle between light and dark mode. (#7)
For more information, refer to the Next.js documentation and dotnize/tanstarter readme, which this starter is based on.