dc6a3b1116
The three exported helpers in lib/prisma.ts (getCaloriesBurned, setCaloriesBurned, getCaloriesBurnedBulk) existed because an early Prisma client generation didn't include the column. Schema and client have been aligned for several releases — the workaround is dead weight. Removed: the helpers from lib/prisma.ts (~30 lines of $queryRawUnsafe / $executeRawUnsafe). Updated callers to use plain caloriesBurned field references: - app/api/workouts/route.ts (GET list + POST create) - app/api/workouts/[id]/route.ts (GET detail + PATCH update) - app/api/settings/export-csv/route.ts (CSV export) All call sites now go through normal type-safe Prisma queries. Net effect for users: zero. Net effect for the codebase: cleaner read paths, stronger TS coverage on caloriesBurned, fewer SQL strings to audit. No schema changes, no migration. Existing /data is untouched. v1.0.0:5 promoted to current; :1, :2, :3, :4 in other.
Workout Planner
A self-hosted workout planner and logger. Plan training cycles, log daily workouts, search your history, and get AI-powered suggestions over time.
Quick Start
# Install dependencies
npm install
# Set up the database
npx prisma db push
# Seed with exercises and default user
npm run db:seed
# Start development server
npm run dev
Open http://localhost:3000 in your browser.
Default login: admin@local / workout123
Access from Other Devices
To access from your phone or iPad on the same network:
npm run dev -- --hostname 0.0.0.0
Then open http://<your-computer-ip>:3000 on your device. You can install it as a PWA (Add to Home Screen) for an app-like experience.
Docker Deployment
docker compose up -d
Tech Stack
- Next.js 14 (App Router) — full-stack TypeScript
- SQLite + Prisma ORM — local database, no separate server
- Tailwind CSS — mobile-first responsive design
- PWA — installable on any device
Project Structure
app/
auth/login/ — Login page
main/
dashboard/ — Quick stats and recent workouts
workouts/ — Workout history, logger, detail views
exercises/ — Exercise library
settings/ — Preferences and AI config
api/ — REST API routes
components/ — Reusable UI components
lib/ — Database queries, auth, utilities
prisma/ — Schema and seed data