- GymForge
GymForge is a full-stack MERN app for AI-generated physique plans and daily training tracking.
- Frontend: React 18 + Vite + Tailwind + Framer Motion + React Query + Firebase Auth
- Backend: Node + Express + MongoDB + Passport Google OAuth + JWT cookies
- AI: Anthropic Claude (
claude-sonnet-4-20250514)
- Landing, auth, onboarding wizard, plan generation, plan viewer, workout detail, tracker, profile
- Firebase Authentication (email/password + Google popup) on client
- Backend Firebase ID token exchange (
POST /api/auth/firebase) -> JWT access (15m) + refresh (7d) in HttpOnly cookies - Claude-based structured plan generation
- Auto-seeded exercise todos, weekly stats, streak endpoint
Backend environment values live in server/.env.
Frontend environment values live in client/.env.
For admin panel access, set ADMIN_EMAIL and ADMIN_PASSWORD in server/.env, and matching VITE_ADMIN_EMAIL in client/.env.
Use server/.env.example as the backend template. Never commit real .env files or API keys.
If Render logs say Could not connect to any servers in your MongoDB Atlas cluster, Atlas is blocking the server IP or the Mongo URI is wrong.
- In MongoDB Atlas, open Security > Network Access.
- For a portfolio/demo deployment on Render, add
0.0.0.0/0so Render's changing outbound IPs can connect. For a stricter production setup, use a paid/static outbound IP provider and whitelist only that IP. - In Render, set
MONGO_URIto a full Atlas URI that includes the database name, for example:
mongodb+srv://USER:PASSWORD@CLUSTER.mongodb.net/gymforge?retryWrites=true&w=majority&appName=Cluster0
- Keep
DISABLE_LOCAL_DB_FALLBACK=falseandRETRY_MONGO=trueon Render. The app will keep working with the local JSON fallback if Atlas is temporarily blocked, and it will retry MongoDB in the background. - Check
/api/health. It reportsdatabase: "mongodb"when Atlas is connected, ordatabase: "local-json-fallback"when the fallback is active.
For portfolio reviews, keep ENABLE_DEMO_LOGIN=true. The login page includes a Try Demo button that creates a seeded demo user, profile, workout plan, and todos in whichever database is active.
cd server && npm installcd ../client && npm installcd ../server && npm run devcd ../client && npm run dev
Server runs on http://localhost:5000 and client on http://localhost:5173.
POST /api/auth/registerPOST /api/auth/loginPOST /api/auth/admin-loginPOST /api/auth/firebasePOST /api/auth/logoutPOST /api/auth/refreshGET /api/auth/meGET /api/auth/googleGET /api/auth/google/callback
POST /api/onboardingGET /api/onboarding/me
POST /api/workout/generateGET /api/workout/meDELETE /api/workout/me
GET /api/todos?date=YYYY-MM-DDPOST /api/todosPATCH /api/todos/:idDELETE /api/todos/:idGET /api/todos/statsGET /api/todos/streak
GET /api/profile/mePATCH /api/profile/me
GET /api/admin/overviewGET /api/admin/users