Skip to content

mugnavo/next-starter

Repository files navigation

mugnavo/next-starter

Minimal Next.js starter based on dotnize/react-tanstarter.

Getting Started

  1. Use this template or clone this repository with gitpick:

    npx gitpick mugnavo/next-tanstarter myapp
    cd myapp
  2. Install dependencies:

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

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

    pnpm db push

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

  5. Run the development server:

    pnpm dev

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

Goodies

Scripts

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 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.
  • 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.

About

Minimal Next.js starter kit with React 19, TanStack Query, Drizzle ORM, shadcn/ui

Resources

Stars

Watchers

Forks

Languages