Braylee's Times Tables — Next.js
This is a Next.js port of the existing Vite + Express app in ../braylees_times_table, preserving the same features:
- Login/Register with 4-digit PIN (HttpOnly cookie session)
- Memorize, Practice, and Testing modes with playful UI
- Per-user progress tracking and last-5 summaries
- Prisma/Postgres data model identical to the original
Getting Started
-
Install dependencies
npm install
-
Configure database
Create a
.envfile with a Postgres URL:DATABASE_URL=postgresql://user:pass@localhost:5432/braylee_times_table
-
Generate client and run migrations
npx prisma generate npx prisma migrate dev --name init
-
Seed data (optional but recommended)
node prisma/seed.js node prisma/seed-users.js
-
Run the app
npm run dev
API Overview
POST /api/auth/login— { name, pin }POST /api/auth/register— { name, pin }GET /api/auth/me— current userPOST /api/auth/logoutPOST /api/users/level— { level }GET /api/problems— auto-seeds 12x12 if emptyGET /api/problems/countPOST /api/problems/:id/attempt— { correct }GET /api/problems/:id/last5POST /api/problems/:id/masteredGET /api/attempts/last5GET /api/progress/summaryGET /api/progress/level/:level/statusPOST /api/test/score,GET /api/test/best
Notes
- Public assets (Braylee.jpg and GIFs) are copied under
public/. - Tailwind and the "Gochi Hand" Google font are configured to match the original styling.