Getting Started - Jashan-randhawa/AI-FitnessTracker1 GitHub Wiki
This guide walks you through setting up and running FitTrack AI locally on your development machine.
Ensure you have the following installed:
-
Node.js:
>= 20.0.0(Recommended:v20.xorv22.x) -
npm:
>= 8.0.0 -
MongoDB: Local MongoDB instance running at
mongodb://localhost:27017or a free MongoDB Atlas cluster - OpenRouter API Key: Free or paid key from openrouter.ai for AI coaching & vision nutrition analysis
git clone https://github.com/Jashan-randhawa/AI-FitnessTracker1.git
cd AI-FitnessTracker1cd server
npm installCreate a .env file in server/:
HOST=0.0.0.0
PORT=1337
NODE_ENV=development
CLIENT_URL=http://localhost:5173
# Database Connection
MONGODB_URI=mongodb://127.0.0.1:27017/fittrack
# Or MongoDB Atlas:
# MONGODB_URI=mongodb+srv://<user>:<password>@cluster0.mongodb.net/fittrack?retryWrites=true&w=majority
# Security & JWT Auth
JWT_SECRET=super_secret_jwt_random_key_fittrack_2026
JWT_EXPIRES_IN=30d
# Artificial Intelligence (OpenRouter)
OPENROUTER_API_KEY=sk-or-v1-your_openrouter_api_key_here
OPENROUTER_MODEL=openai/gpt-4o-mini
OPENROUTER_FALLBACK_MODEL=google/gemini-2.0-flash-001
LOG_LEVEL=info
# External Media & News APIs (Optional)
NEWS_API_KEY=your_newsapi_key
RAPIDAPI_KEY=your_rapidapi_key
# OAuth & Password Reset (Optional for basic local dev)
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_CALLBACK_URL=http://localhost:1337/api/connect/google/callback
BREVO_API_KEY=your_brevo_api_key
EMAIL_FROM="FitTrack AI <[email protected]>"npm testExecutes the 139-test suite across 37 suites covering authentication & JWT, dual sign-in matrix & password policies, signup email verification, Brevo transactional email resilience (F1โF5), calorie/food estimation, AI prompt guardrails & fallback, structured logging with secret scrubbing, health checks, and production error masking using Node's native test runner (
node --test).
npm run devThe server boots at http://localhost:1337 and automatically seeds initial fitness blog articles if the database collection is empty.
Open a second terminal window:
cd client
npm installCreate a .env file in client/:
VITE_API_URL=http://localhost:1337(Note: Legacy VITE_STRAPI_API_URL is also supported for backward compatibility).
npm run devOpen your browser and navigate to:
๐ http://localhost:5173
- Click Sign Up to create an account or use the quick login.
- Complete the onboarding questionnaire (Age, Height, Weight, Activity Level, Target Goal).
- Check your Dashboard to see your dynamic goal rings, hydration meter, and streak milestones!
- Navigate to Food Log or Activity Log to view the interactive 90-Day Calendar Heatmap, and test AI Food Snap or natural language meal estimation.
- Open AI Assistant to chat with FitBot about your training goals.