A MERN app to manage interns, tasks, attendance, and evaluations. Backend: Node.js, Express, Mongoose, JWT, PM2 Frontend: React (create-react-app), React Router, Axios DB: MongoDB (Atlas or self-hosted) Prod Example: Nginx serves React and proxies /api → Node (port 5001) CI/CD
-
Clone & install :
git clone https://github.com/Pragati-006/Remote-Intern-Management-.git
cd Remote-Intern-Management-/backend
cd backend npm install
cd ../frontend npm install
-
Environment variables
Create backend/.env:
MONGO_URI=mongodb+srv://:@/?retryWrites=true&w=majority
JWT_SECRET=replace_with_a_long_random_string
PORT=5001
Frontend uses:
Local dev (optional): create frontend/.env.development
REACT_APP_API_URL=http://localhost:5001/api
Production build: REACT_APP_API_URL=/api (set via CI or .env.production)
-
Run locally (two terminals)
Terminal A – backend
cd backend
npm start # runs server.js on http://localhost:5001
curl -i http://localhost:5001/api/health
Terminal B – frontend
cd frontend
npm start # http://localhost:3000
In local dev, the frontend talks to http://localhost:5001/api.
npm start – start dev/prod (reads .env)
npm run prod – node server.js
npm test – run Mocha tests
npm start – CRA dev server (http://localhost:3000)
npm run build – production build to frontend/build
cd backend
npm test
EC2_HOST – your EC2 public IP
EC2_USER – usually ubuntu
EC2_SSH_KEY – private key contents for that EC2 user
Your EC2 instance must already have the repo cloned at ~/Remote-Intern-Management- and backend .env configured with real secrets.
- On EC2, install prerequisites
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs git
sudo apt-get install -y nginx
sudo npm i -g pm2
- Clone repo & configure backend
pm2 start server.js --name server
pm2 save
curl -i http://127.0.0.1:5001/api/health
- Build & place frontend
cd ~/Remote-Intern-Management-/frontend
npm ci
npm run build
sudo mkdir -p /var/www/rim-frontend
sudo cp -r build/* /var/www/rim-frontend/
- Nginx config
Create /etc/nginx/sites-available/rim:
sudo nano /etc/nginx/sites-available/rim
server { listen 80; server_name _; root /var/www/rim-frontend; index index.html; # Proxy API to Node on port 5001 location ^~ /api/ { proxy_pass http://127.0.0.1:5001/; # trailing slash IMPORTANT proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Connection ""; proxy_redirect off; } # SPA fallback for React location / { try_files $uri /index.html; } }
sudo ln -sf /etc/nginx/sites-available/rim /etc/nginx/sites-enabled/rim
sudo nginx -t && sudo systemctl reload nginx
- Verify from your laptop
http://<EC2_PUBLIC_IP>/
curl -i http://<EC2_PUBLIC_IP>/api/health
curl -i http://127.0.0.1:5001/api/health # on EC2
curl -i http://<EC2_PUBLIC_IP>/api/health # from your machine
pm2 status
pm2 logs server --lines 100
pm2 restart server
sudo tail -n 100 /var/log/nginx/access.log
sudo tail -n 100 /var/log/nginx/error.log
License
MIT (or your preferred license)
Author
Pragati — PRs and issues welcome.