This guide will help you deploy the full Campus Bridge LMS application to Render, which supports both the frontend and backend components.
- A Render account (free)
- A GitHub account
- This repository forked or cloned
The application has already been configured to work with Render's environment variables. The key changes made:
- Database configuration in db.js now uses environment variables
- Server configuration in server.js listens on Render's PORT
- Email verification links use APP_URL environment variable
- Go to https://render.com
- Sign up for a free account
- Connect your GitHub account
-
Click "New +" and select "Web Service"
-
Connect to your GitHub repository
-
Configure the settings:
- Name: campus-bridge-lms
- Environment: Node
- Build Command:
npm install - Start Command:
npm start - Instance Type: Free
-
Add environment variables in the "Advanced" section:
MYSQL_HOST: Your database hostMYSQL_USER: Your database usernameMYSQL_PASSWORD: Your database passwordMYSQL_DATABASE: lmsEMAIL_SERVICE: gmail (or your email service)EMAIL_USER: your-email@gmail.comEMAIL_PASS: your-app-passwordEMAIL_FROM: your-email@gmail.comAPP_URL: https://your-app-name.onrender.com (your Render app URL)
Render offers free PostgreSQL databases. To use it:
- Click "New +" and select "PostgreSQL"
- Choose the free tier
- Once created, you'll get connection details
Since Campus Bridge uses MySQL, you have two options:
- Modify the application to use PostgreSQL instead (see migration guide below)
- Use an external MySQL provider like PlanetScale (has a free tier)
PlanetScale offers a free MySQL-compatible database:
- Go to https://planetscale.com
- Sign up for a free account
- Create a new database
- Get the connection details and use them as environment variables
In Render, set these environment variables:
PORT=3000
MYSQL_HOST=your-db-host
MYSQL_PORT=3306
MYSQL_USER=your-db-username
MYSQL_PASSWORD=your-db-password
MYSQL_DATABASE=lms
EMAIL_SERVICE=gmail
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-password
EMAIL_FROM=your-email@gmail.com
APP_URL=https://your-app-name.onrender.com
- Sleep Mode: Web services fall asleep after 15 minutes of inactivity
- 500 Build Minutes: Per month
- CPU Time: 500 hours per month
- Bandwidth: 100GB per month
If you want to use Render's free PostgreSQL database, you'll need to modify the database queries slightly:
- Update db.js:
const { Client } = require('pg');
const client = new Client({
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false
}
});
client.connect();
module.exports = client;- Update query syntax in server.js and other files to be PostgreSQL compatible.
For questions about deployment or to report issues, contact: connect@campusbridge.io
For the complete GitHub repository: https://github.com/Codeunia/Campus-Bridge