Minimal Next.js starter based on dotnize/react-tanstarter.
- Next.js 16 + React 19 + React Compiler
- TanStack Query
- Tailwind CSS + shadcn/ui
- Drizzle ORM + PostgreSQL
- Better Auth
-
Use this template or clone this repository with gitpick:
npx gitpick mugnavo/next-tanstarter myapp cd myapp -
Install dependencies:
pnpm install
-
Create a
.envfile based on.env.example. -
Push the schema to your database with drizzle-kit:
pnpm db push
-
Run the development server:
pnpm dev
The development server should be now running at http://localhost:3000.
We use pnpm by default, but you can modify these scripts in package.json 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 generateto generate a migration)ui- The shadcn/ui CLI. (e.g.pnpm ui add buttonto add the button component)formatandlint- 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.theme-toggle.tsx- A simple component to toggle between light and dark mode.
For more information, you may refer to the Next.js documentation and react-tanstarter readme, which this starter is based on.