A workout tracking app built with TanStack Start, TanStack Query, Shadcn/ui, Drizzle ORM, and Better Auth.
| Layer | Technology |
|---|---|
| Framework | TanStack Start |
| Routing | TanStack Router (file-based) |
| Data fetching | TanStack Query |
| Database | PostgreSQL via Drizzle ORM |
| Auth | Better Auth (email + password) |
| UI | Shadcn/ui + Tailwind CSS |
- Node.js 20+
- PostgreSQL (or Docker — see below)
Copy .env.local and fill in your values:
DATABASE_URL="postgresql://user:password@localhost:5432/prgrm"
BETTER_AUTH_SECRET="your-secret-here"
BETTER_AUTH_URL="http://localhost:3000"docker run -d \
--name prgrm-postgres \
-e POSTGRES_USER=prgrm \
-e POSTGRES_PASSWORD=prgrm \
-e POSTGRES_DB=prgrm \
-p 5432:5432 \
postgres:16-alpinenpm install
npm run db:push # create tables
npm run dev # start dev server on port 3000Drizzle is used for all database access. The schema lives in src/db/schema.ts.
npm run db:push # push schema changes directly (dev)
npm run db:generate # generate a migration file
npm run db:migrate # run pending migrations
npm run db:studio # open Drizzle StudioTo seed the workout data:
DATABASE_URL="..." npx tsx src/db/seed.tsAuthentication is handled by Better Auth at /api/auth/*. Sign in and sign up are available at /sign-in. The signed-in user is shown in the sidebar with a sign-out button.
src/
├── db/
│ ├── index.ts # Drizzle client
│ ├── schema.ts # All table definitions (workouts + auth)
│ └── seed.ts # Seed script for workout data
├── lib/
│ ├── auth.ts # Better Auth server config
│ ├── auth-client.ts # Better Auth client (useSession, signIn, signOut)
│ └── utils.ts # cn() utility
├── integrations/
│ ├── better-auth/ # Auth header component
│ └── tanstack-query/ # Query provider + devtools
├── components/
│ └── Header.tsx # Sidebar nav with auth state
└── routes/
├── __root.tsx # Root layout
├── index.tsx # Home — recent workouts
├── sign-in.tsx # Sign in / sign up
└── api/auth/$.ts # Better Auth API handler
npm run dev # Start dev server
npm run build # Production build
npm run test # Run tests (Vitest)
npm run lint # ESLint
npm run check # Prettier + ESLint fix