A modern habit tracking application built with Next.js, TypeScript, and a powerful tech stack.
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Database: SQLite with Drizzle ORM
- Authentication: BetterAuth (Email/Password)
- Data Fetching: Tanstack Query v5
- Styling: Tailwind CSS v3
- UI Components: shadcn/ui
├── app/ # Next.js App Router
│ ├── (auth)/ # Auth routes (login, register)
│ ├── (dashboard)/ # Protected dashboard routes
│ ├── api/auth/ # Auth API endpoints
│ ├── layout.tsx # Root layout with providers
│ ├── page.tsx # Landing page
│ └── globals.css # Global styles
├── components/ # React components
│ └── ui/ # shadcn components
├── lib/ # Core utilities
│ ├── auth/ # BetterAuth configuration
│ ├── db/ # Drizzle database setup
│ ├── query/ # Tanstack Query setup
│ └── utils.ts # Helper functions
├── hooks/ # Custom React hooks
├── types/ # TypeScript definitions
└── drizzle/ # Database migrations
- Node.js 20+
- pnpm or yarn
-
Install dependencies:
pnpm install
-
Approve all required builds:
pnpm approve-builds
-
Copy the example environment file and configure your environment variables:
cp .env.example .env # Then edit .env to set the required values -
Run database migrations:
pnpm run db:push
-
Run the development server:
pnpm run dev
pnpm run dev- Start development serverpnpm run build- Build for productionpnpm run start- Start production serverpnpm run lint- Run ESLintpnpm run db:generate- Generate database migrationspnpm run db:migrate- Run database migrationspnpm run db:push- Push schema changes to databasepnpm run db:studio- Open Drizzle Studio
The database schemas can be defined in lib/db/schema.
After updating schema:
pnpm run db:generate # Generate migrations
pnpm run db:migrate # Apply migrationsBetterAuth is configured with email/password authentication.
- Login:
/login - Register:
/register - Dashboard:
/dashboard(protected route)
- Email/password authentication
- Protected routes with middleware
- Tanstack Query for server state management
- Responsive UI with Tailwind CSS
- Type-safe database queries with Drizzle
- shadcn/ui components