GymBase is a full-stack developer platform for fitness data, designed as an API engine plus a modern web console.
It includes:
- account registration and email verification
- JWT login and API key access
- daily and monthly usage tracking
- built-in rate limiting per user
- interactive dashboard with charts and endpoint playground
The API service delivers exercise JSON and image assets, while the web console provides an animated experience for auth, API usage visibility, and request testing.
- JWT-based session auth for protected account usage endpoints
- API key auth for programmatic access to exercise endpoints
- SMTP-based verification and password reset email workflows
- Tokenized email verification and password reset links
- Per-user usage policy enforcement via middleware
- User authentication and account lifecycle
- Email verification flow (token-based)
- Forgot/reset password flow (token + expiry)
- JWT-protected user usage endpoint
- API key and Bearer token support for exercise endpoints
- Per-user limits:
- daily: 50 calls
- monthly: 500 calls
- Auto-generated API key for each verified user
- Exercise data endpoints:
- list all
- find by id
- find by exact name (case-insensitive)
- filter by muscle group
- Login, Register, Verify Email, Forgot Password, Reset Password pages
- Dashboard with:
- usage cards
- 7-day history chart
- endpoint list and playground modal
- API key copy/reveal interactions
- Responsive UI and animated dashboard interactions
- Configurable backend base URL via Vite env
- Favicon enabled in app shell
- Backend: Node.js, Express, MongoDB, Mongoose, bcryptjs, jsonwebtoken, nodemailer
- Web Console: React, Vite, Axios, Recharts, Lucide Icons, React Router
GymBase_API/
|- backend/
| |- config/
| |- controllers/
| |- data/
| |- images/
| |- middlewares/
| |- models/
| |- routes/
| |- .env.example
| |- index.js
| \- package.json
|- frontend/
| |- public/
| |- src/
| |- .env.example
| |- index.html
| \- package.json
\- README.md
flowchart LR
A[React Web Console] -->|"JWT"| B["/api/usage"]
A -->|"x-api-key or Bearer"| C["/api/exercises/*"]
C --> D[Rate Limiter]
B --> E[(MongoDB)]
C --> E
F["/api/auth/*"] --> E
F --> G[SMTP Provider]
git clone <your-repo-url>
cd GymBase_API
cd backend && npm install
cd ../frontend && npm installCreate backend/.env (or copy from backend/.env.example):
PORT=5000
NODE_ENV=development
JWT_SECRET=your_strong_jwt_secret_here
MONGO_URI=mongodb+srv://<user>:<password>@clusterx.xxxxx.mongodb.net/gymbaseapi
# URL used in verification/reset links sent by email
FRONTEND_URL=http://localhost:5173
# SMTP settings
SMTP_HOST=smtp-relay.brevo.com
SMTP_PORT=587
SMTP_USER=your_brevo_smtp_user@smtp-brevo.com
SMTP_PASS=your_brevo_smtp_password
email=your_verified_sender@example.com
# Optional (forces image URLs)
BASE_URL=http://localhost:5000Create frontend/.env (or copy from frontend/.env.example):
VITE_API_URL=http://localhost:5000Backend:
cd backend
npm run devWeb Console:
cd frontend
npm run devDefault URLs:
- Web Console: http://localhost:5173
- Backend: http://localhost:5000
POST /api/auth/registerPOST /api/auth/loginGET /api/auth/verify-email/:tokenPOST /api/auth/forgot-passwordPOST /api/auth/reset-password/:token
Headers:
x-api-key: <api_key>- or
Authorization: Bearer <jwt>
Endpoints:
GET /api/exercisesGET /api/exercises/id/:idGET /api/exercises/name/:nameGET /api/exercises/muscle/:muscle
Header:
Authorization: Bearer <jwt>
Endpoint:
GET /api/usage
Returns:
- daily usage and limit
- monthly usage and limit
- 7-day usage history
- current API key
- Register a user
- Verify email from token link
- Login and get JWT
- Open dashboard and copy API key
- Call exercise endpoints with
x-api-keyor JWT - Monitor consumption in
/api/usage
backend/index.jsserves frontend build assets whenNODE_ENV=productionGET /api/healthis available for platform health checks- build frontend using:
cd backend
npm run build:frontendGitHub Actions runs on pushes and pull requests. The workflow installs dependencies from lockfiles, checks the backend entry point, lints the frontend, and builds the frontend bundle.
401 Missing authentication: addx-api-keyor Bearer token for exercise APIs403 Please verify your email: verify account first429 limit exceeded: wait for limit window reset (daily/monthly)- No email received:
- verify SMTP env values
- check sender email is approved by provider
- Web console cannot call backend:
- confirm
frontend/.envhas correctVITE_API_URL - restart Vite after env changes
- confirm
Exercise images/data source:
ISC