Cloud Deployment
G-RANK is designed for deployment with:
| Component | Recommended Platform | Free Tier |
|---|---|---|
| Frontend | Vercel | Yes |
| Backend | Railway or Render | Yes (with limits) |
| Database | MongoDB Atlas | Yes (512 MB) |
MongoDB Atlas Setup
Set up the database first since both backend and frontend need the connection string.
- Go to cloud.mongodb.com and create a free account.
- Create a new Shared (M0 free) cluster.
- Create a database user (username + password — store these securely).
- Under Network Access, add
0.0.0.0/0to allow connections from any IP (or restrict to your backend host's IP range). - Click Connect → Connect your application → copy the connection string.
The connection string format:
mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<dbname>?retryWrites=true&w=majority
Replace <username>, <password>, and <dbname> (grank recommended) with your values.
Backend — Railway
Railway offers simple Node.js hosting with automatic deploys from GitHub.
Setup
- Sign up at railway.app and connect your GitHub account.
- Click New Project → Deploy from GitHub repo → select the G-RANK repository.
- Railway detects Node.js automatically.
Configuration
In Railway's project settings, set the Root Directory to backend/ (since it is a monorepo).
Set the Start Command to:
npm start
Or ensure package.json in backend/ has a start script:
"scripts": {
"start": "node src/server.js"
}
Environment Variables
In Railway → Settings → Variables, add all backend environment variables:
PORT=5000
NODE_ENV=production
MONGO_URI=mongodb+srv://...
JWT_SECRET=<production-secret>
JWT_EXPIRE=7d
EMAIL_USER=grank.noreply@gmail.com
EMAIL_PASS=<gmail-app-password>
EMAIL_FROM=G-Rank <grank.noreply@gmail.com>
FRONTEND_URL=https://your-frontend.vercel.app
CLIENT_URL=https://your-frontend.vercel.app
RIOT_API_KEY=RGAPI-...
RIOT_CLIENT_ID=...
RIOT_CLIENT_SECRET=...
RIOT_REDIRECT_URI=https://your-backend.railway.app/api/riot/oauth/callback
Railway provides a public URL like https://grank-api-production.up.railway.app. Use this as your backend URL.
Backend — Render (Alternative)
Render is another popular Node.js hosting platform.
Setup
- Sign up at render.com and connect GitHub.
- Click New → Web Service → select the G-RANK repo.
- Set Root Directory to
backend/. - Set Build Command:
npm install - Set Start Command:
npm start - Choose the Free instance type.
Environment Variables
Same as Railway — add all backend variables in the Render dashboard under Environment.
Render provides a URL like https://grank-api.onrender.com.
Render free tier services spin down after 15 minutes of inactivity and take ~30 seconds to wake up on the next request. Consider Railway or a paid Render plan for production use.
Frontend — Vercel
Vercel is the recommended platform for the React/Vite frontend.
Setup
- Sign up at vercel.com and connect your GitHub account.
- Click Add New Project → select the G-RANK repository.
- In Configure Project, set:
- Root Directory:
frontend/ - Framework Preset: Vite (auto-detected)
- Build Command:
npm run build - Output Directory:
dist
- Root Directory:
- Add Environment Variables:
VITE_API_URL=https://your-backend.railway.app
- Click Deploy.
Vercel provides a URL like https://grank.vercel.app.
Custom Domain
In Vercel → Settings → Domains, add your custom domain and follow the DNS configuration instructions.
Post-Deployment Checklist
After deploying both services, verify the following:
- Backend responds at
https://<backend-url>/api/leaderboard - Frontend loads at
https://<frontend-url> -
FRONTEND_URLin backend env matches the Vercel URL exactly -
VITE_API_URLin frontend env matches the Railway/Render URL exactly -
RIOT_REDIRECT_URIpoints to the production backend callback URL - MongoDB Atlas IP whitelist includes the backend host (or
0.0.0.0/0) - SSL/HTTPS is enabled on both services (Vercel and Railway/Render provide this automatically)
- Register a test account and confirm email verification works
- Login and access the Dashboard
Deployment Workflow
G-RANK does not have automated CI/CD. The current workflow is manual deploy:
- Develop on the
devbranch - Create a PR from
dev→main - Tests pass on the
testingbranch - Merge PR to
main - In Vercel and Railway: click Redeploy (or set up automatic deploys from
main)
Future improvement: add GitHub Actions workflows to auto-deploy on push to main.