Simple setup instructions for the root of the GymGenerator monorepo. Follow these steps to get the backend up and running locally.
- Node.js 20.x (LTS) and npm (or yarn) installed.
- Git for cloning the repository.
- (Optional) VS Code or your preferred editor.
We’re using SQLite for development via Prisma. No external database setup is required for now; a
dev.dbfile will be created automatically.
git clone https://github.com/declanecr/gymGenerator.git
cd gymGeneratorInstall root dependencies
npm installThis monorepo uses npm workspaces, so runnign npm install once from the repo root installs dependencies for both the
backend and frontend packages
-
cdinto the backend folder:cd backend -
Create a simple
.envfile atbackend/.envwith at least:DATABASE_URL="file:./dev.db" JWT_SECRET="yourStrongSecretHere"You can choose any string for
JWT_SECRET. Make sure it’s at least 32 characters in production. -
Apply the existing Prisma migrations (creates
dev.dbinbackned/prisma):npx prisma migrate dev
Migrations are already included in the repository. This command aplies them to your local SQLite database. Generate a new migration only after modifying the Prisma schema.
-
Generate Prisma Client:
npx prisma generate
-
Start the NestJS backend in watch mode:
npm run start:dev # or yarn start:dev- The server will run on
http://localhost:3000by default. - You should see console output like
Nest application successfully startedif everything is configured correctly.
- The server will run on
A sample VS Code REST Client script is provided at backend/test-user-auth.http. To test basic auth endpoints:
-
Open
test-user-auth.httpin VS Code. -
Follow the comments to:
- Register a new user (
POST /auth/register) - Log in (
POST /auth/login) - Copy the returned token into the
@tokenvariable - Fetch/update/delete your profile (
GET|PATCH|DELETE /users/me)
- Register a new user (
This confirms that the SQLite database, Prisma schema, and JWT auth flow are working .
If you want to peek at your local data:
npx prisma studioThen open the URL shown in your browser to view and edit records.
The React app lives in
frontend/and talks to the backend athttp://localhost:3000/api/v1.
- Same Node 20.x install you used for the backend.
- Yarn or npm (examples use npm here).
Dependencies were installed via the npm workspaces. When you need to run frontend commands, move into its folder:
cd frontendCreate src/api/axios.ts:
import axios from "axios";
export default axios.create({
baseURL: import.meta.env.VITE_API_URL ?? "http://localhost:3000/api/v1",
headers: { "Content-Type": "application/json" },
});Add .env in frontend/:
VITE_API_URL=http://localhost:3000/api/v1
Change this for staging/production builds.
npm run devOpen the printed URL (usually http://localhost:5173) — hot-reload is active.
- Navigate to
/registerand create a user. - After registering you should land on
/dashboardwhere your workouts and templates are listed - Refresh the page and navigate around the app to confirm you remain logged in and can still access the dashboard
- Click Logout — you're redirected to
/loginand the token disappears from dev-tools → Application → Local Storage.
You now have a working full-stack auth MVP.
.
├─ backend/ ← NestJS + Prisma API
└─ frontend/ ← Vite + React + MUI client
npm testRun this from the repository root—Jest's root configuration orchestrates tests across the backend and frontend workspaces, so one command exercises the entire monorepo.
Tip: keep backend and frontend dev servers running in two terminal tabs for a smooth workflow.
backend/
├─ prisma/
│ ├─ dev.db ← SQLite file (auto-generated)
│ ├─ migrations/ ← Prisma migration SQL files
│ └─ schema.prisma ← Prisma schema (User, Exercise, etc.)
├─ src/
│ ├─ modules/v1/
│ │ ├─ auth/ ← JWT + bcrypt auth flow
│ │ ├─ users/ ← profile endpoints
│ │ ├─ exercises-catalog/ ← exercise catalog & custom entries
│ │ ├─ template-workouts/ ← CRUD for workout templates
│ │ └─ workouts/ ← workouts API for logging sessions
│ ├─ shared/
│ │ ├─ decorators/ ← @GetUser() decorator
│ │ └─ guards/ ← JWT strategy (`jwt.strategy.ts`)
│ └─ main.ts ← NestJS bootstrap
├─ test-user-auth.http ← VS Code REST Client for manual testing
├─ package.json
└─ .env ← JWT_SECRET, etc.
That’s it! After these steps, your backend should be running locally, ready for manual testing or integration with a future React frontend.