Architecture Overview
FitAiid is a full-stack SaaS fitness platform that uses a modern, cloud-native architecture:Technology Stack
Backend
Node.js + Express
- Node.js v20 LTS
- Express.js v4.21.2
- JWT Authentication
- Rate Limiting (100 req/15min)
Frontend
HTML5 + CSS3 + Vanilla JS
- Progressive Web App (PWA)
- Service Workers
- Offline-first architecture
- Firebase OAuth
Database
MongoDB Atlas
- NoSQL cloud database
- Mongoose ODM v8.18.2
- Auto-scaling clusters
APIs & Services
External Integrations
- OpenAI API (workout generation)
- Stripe (payments)
- Firebase Admin (authentication)
- Web Push (notifications)
Deployment Platforms
Railway
Deploy your Node.js backend API with automatic builds and zero-config infrastructure.
Vercel
Deploy your frontend PWA with global CDN and instant rollbacks.
Deployment Process
The complete deployment takes approximately 30 minutes and follows these steps:Key Features
Security
- Helmet - Secure HTTP headers
- bcryptjs - Password hashing (10 rounds)
- JWT - Secure token-based authentication
- express-rate-limit - DDoS protection
- express-mongo-sanitize - NoSQL injection prevention
- xss-clean - XSS attack prevention
Monitoring & Logging
- Winston - Structured logging
- winston-daily-rotate-file - Daily log rotation
- Morgan - HTTP request logging
API Documentation
- Swagger - Interactive API documentation
- Auto-generated from JSDoc comments
Database Collections
MongoDB Collections Schema
MongoDB Collections Schema
The FitAiid database contains the following collections:
- users - User authentication and profiles
- workoutProgress - Training session data
- orders - Stripe payment records
- products - Subscription catalog
- pushSubscriptions - Web push notification subscriptions
- customSchemas - Dynamic user data
Prerequisites
Before starting the deployment process, ensure you have:
- Node.js v20+ installed
- Git installed and configured
- GitHub account
- Railway account
- Vercel account
- MongoDB Atlas cluster created
- All API keys obtained (OpenAI, Stripe, Firebase)
Environment Requirements
Quick Start
Ready to deploy? Follow these guides in order:- Backend Deployment - Deploy Express API to Railway
- Frontend Deployment - Deploy PWA to Vercel
- Environment Variables - Configure all secrets
Estimated Costs
Production URLs
After deployment, your application will be accessible at:Support
If you encounter issues during deployment:Railway Logs
Check deployment logs in Railway Dashboard → Deployments → View Logs
Vercel Logs
Review build logs in Vercel Dashboard → Deployments → View Details
Browser DevTools
Press F12 → Console for JavaScript errors and Network tab for API issues
Next Steps
Configure Backend
Start by deploying your Express backend to Railway with MongoDB Atlas connection.