Skip to content

Deployment Guide

Jashan Randhawa edited this page Sep 27, 2026 · 2 revisions

🌐 Deployment Guide

This guide covers deploying FitTrack AI to production cloud platforms.


🗄️ 1. Database Setup (MongoDB Atlas)

  1. Create a free M0 cluster on MongoDB Atlas.
  2. Create a Database User with read and write credentials.
  3. In Network Access, add IP address 0.0.0.0/0 to allow connections from cloud hosting platforms.
  4. Copy your Connection String URI:
    mongodb+srv://<username>:<password>@cluster0.mongodb.net/fittrack?retryWrites=true&w=majority
    

🖥️ 2. Backend Server Deployment (Render / Railway)

Deploying to Render

  1. Create a new Web Service on Render.
  2. Connect your GitHub repository.
  3. Configure the service:
    • Root Directory: server
    • Environment: Node
    • Node Version: >=20.0.0
    • Build Command: npm install
    • Start Command: node server.js
  4. Add Environment Variables:
    • NODE_ENV: production
    • PORT: 10000
    • MONGODB_URI: Your MongoDB Atlas Connection String
    • JWT_SECRET: A secure random secret (min 32 chars)
    • OPENROUTER_API_KEY: Your OpenRouter API Key
    • CLIENT_URL: https://ai-fitness-tracker1.vercel.app
  5. Deploy service. Note your public backend URL (e.g. https://fittrack-api.onrender.com).

🌐 3. Frontend Client Deployment (Vercel)

  1. Sign in to Vercel and click Add New > Project.
  2. Select AI-FitnessTracker1.
  3. Configure Project Settings:
    • Root Directory: client
    • Framework Preset: Vite
    • Build Command: npm run build
    • Output Directory: dist
  4. Add Environment Variable:
    • VITE_API_URL: https://fittrack-api.onrender.com (Legacy VITE_STRAPI_API_URL is also supported for backward compatibility).
  5. The repository includes client/vercel.json for client-side single page app routing:
    { "rewrites": [{ "source": "/(.*)", "destination": "/" }] }
  6. Click Deploy.

🔄 Post-Deployment Verification

  1. Verify that the GitHub Actions CI workflow (.github/workflows/ci.yml) completed cleanly.
  2. Navigate to your deployed Vercel domain.
  3. Sign up a new user account.
  4. Verify that the dynamic goal rings render and the water tracker increments properly.
  5. Inspect the 90-Day Calendar Heatmap on Food Log and Activity Log.
  6. Test the AI Food Snap by uploading an image.
  7. Open AI Assistant and chat with FitBot.

Clone this wiki locally