A standalone Express REST API with raw SQL (no ORM), running against the same PostgreSQL database (Supabase) as my workout-tracker app.
I built this to go one layer deeper than Next.js server actions and Prisma — writing the HTTP routing and SQL queries by hand instead of letting the framework and ORM handle them.
npm install
node server.js
# → http://localhost:4000/workoutsGET /workouts— list all workoutsGET /workouts/:id— single workoutPOST /workouts— create a workoutPUT /workouts/:id— rename a workoutDELETE /workouts/:id— delete a workoutGET /workouts/:id/exercises— exercises for a workout (JOIN) (planned)GET /stats— per-workout aggregates (GROUP BY) (planned)
- Prisma created case-sensitive table names, so raw SQL has to quote them:
"Workout","createdAt". - All queries use
$1, $2parameters, never string concatenation, to avoid SQL injection. - Supabase requires
ssl: { rejectUnauthorized: false }with node-postgres.