Skip to content
/ next-starter Public template

Minimal Next.js starter kit with Better Auth, Drizzle ORM, shadcn/ui

Notifications You must be signed in to change notification settings

mugnavo/next-starter

Repository files navigation

mugnavo/next-starter

Minimal Next.js starter based on dotnize/tanstarter.

Getting Started

  1. Use this template or clone this repository.

  2. Install dependencies:

    pnpm install # npm install
  3. Create a .env file based on .env.example.

  4. Push the schema to your database with drizzle-kit:

    pnpm db push # npm run db push

    https://orm.drizzle.team/docs/migrations

  5. Run the development server:

    pnpm dev # npm run dev

    The development server should be now running at http://localhost:3000.

Issue watchlist

  • shadcn-ui/ui#6714 - We're using the canary version of shadcn/ui for Tailwind v4 support.

Auth

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.

Goodies

Scripts

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 and lint - Run Prettier and ESLint.

Utilities

  • getAuthSession() - Retrieves the session and user data. Can be used in server components, API route handlers, and server actions.
  • authGuard(redirectUrl?: string) - Same as getAuthSession, 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.

About

Minimal Next.js starter kit with Better Auth, Drizzle ORM, shadcn/ui

Resources

Stars

Watchers

Forks