Auto Mate is a college auto transport system with:
- Student booking + live queue
- Driver trip management (start with 1–4 students)
- Admin dashboard (users, complaints, queue, schedules)
- Real-time updates and chat using Socket.IO
- Node.js
- Express.js
- MongoDB + Mongoose
- JWT auth
- bcryptjs
- Socket.IO
- React + Vite (frontend)
- Axios
AUTOMATE/ backend/ app.js server.js config/ controllers/ middleware/ models/ routes/ services/ sockets/ utils/ frontend/ src/ pages/ services/ lib/ components/
- Node.js 18+
- npm
- MongoDB local OR MongoDB Atlas
———
If installed with Homebrew:
brew services start mongodb-community
If running manually:
mkdir -p "$HOME/data/db" mongod --dbpath "$HOME/data/db"
Verify MongoDB:
mongosh "mongodb://127.0.0.1:27017/automate" --eval "db.runCommand({ ping: 1 })"
cd /Users/surajkiranshewale/Documents/AUTOMATE/backend npm install cp .env.example .env
Open backend/.env and set values, or overwrite quickly:
cat > .env <<'EOF' NODE_ENV=development PORT=5000 MONGO_URI=mongodb://127.0.0.1:27017/automate JWT_SECRET=replace_with_long_random_secret JWT_EXPIRES_IN=7d CORS_ORIGIN=http://localhost:8080 SOCKET_CORS_ORIGIN=http://localhost:8080 RATE_LIMIT_WINDOW_MS=900000 RATE_LIMIT_MAX=300 AUTH_RATE_LIMIT_MAX=20 WEBAUTHN_RP_NAME=AutoMate
APP_LOGIN_URL=http://localhost:8080/login FRONTEND_URL=http://localhost:8080
SMTP_HOST=smtp.gmail.com SMTP_PORT=587 SMTP_USER=your_email@gmail.com SMTP_PASS=your_app_password MAIL_FROM=Auto Mate your_email@gmail.com
SEED_ADMIN_NAME=Auto Mate Admin SEED_ADMIN_EMAIL=admin@automate.edu SEED_ADMIN_PASSWORD=Admin@12345 SEED_DRIVER_NAME=Default Driver SEED_DRIVER_EMAIL=driver@automate.edu SEED_DRIVER_PASSWORD=Driver@12345 SEED_STUDENT_NAME=Default Student SEED_STUDENT_EMAIL=student@automate.edu SEED_STUDENT_PASSWORD=Student@12345 EOF
Run backend (dev):
npm run dev
Run backend (production mode):
NODE_ENV=production npm start
Health check:
curl http://localhost:5000/health
cd /Users/surajkiranshewale/Documents/AUTOMATE/frontend npm install
Create frontend env:
cat > .env <<'EOF' VITE_API_BASE_URL=http://localhost:5000/api VITE_SOCKET_URL=http://localhost:5000 EOF
Run frontend:
npm run dev
Open:
———
These are created on backend startup (if not already present):
- Admin: admin@automate.edu / Admin@12345
- Driver: driver@automate.edu / Driver@12345
- Student: student@automate.edu / Student@12345
———
- Student joins live queue on booking.
- Duplicate active queue booking is blocked.
- Driver can start trip with 1 to 4 students.
- Max capacity is 4.
- Start trip picks first up to 4 waiting students (FIFO).
- Student can leave queue while status is waiting.
- If already locked in trip (assigned/pickup/in-transit), leave is blocked.
- First cancel for a queue entry: move student to queue end.
- Second cancel: remove student from queue.
- cancelCount is stored server-side and enforced server-side only.
- Queue chat is available while student is waiting.
- Driver can chat with queue students.
- Trip chat works for assigned trip participants.
- Student cannot chat with other students.
- Server validates role + membership from DB.
- Status values: submitted, in_review, resolved, rejected
- Student can submit and view status/history.
- Admin can update status + response.
- Status updates are emitted via sockets.
———
Base URL: /api
- POST /auth/signup
- POST /auth/login
- POST /auth/biometric/register/options
- POST /auth/biometric/register/verify
- POST /auth/biometric/login/options
- POST /auth/biometric/login/verify
- GET /auth/me
- POST /rides/book
- DELETE /rides/student/leave
- DELETE /rides/student/queue
- GET /rides/student/current
- GET /rides/student/history
- GET /rides/driver/current
- PATCH /rides/driver/students/:queueEntryId/arrive
- PATCH /rides/driver/students/:queueEntryId/cancel
- PATCH /rides/driver/start
- PATCH /rides/driver/complete
- GET /rides/admin/queue
- GET /rides/admin/stats
- GET /chat/context
- GET /chat/messages?roomType=queue|trip&roomId=
- POST /chat/messages
- GET /chat/ride/:rideId/messages
- POST /chat/ride/:rideId/messages
- POST /complaints
- GET /complaints/mine
- GET /complaints
- PATCH /complaints/:complaintId/status
- GET /admin/users
- POST /admin/users
- DELETE /admin/users/:id (deactivate or permanent with query)
- DELETE /admin/users/:id/permanent-delete
- POST /admin/users/remove-by-email
- PATCH /admin/users/:id/reactivate
- POST /admin/users/:id/reset-password
———
- joinQueueChat
- leaveQueueChat
- queueChatMessage
- joinTripChat
- leaveTripChat
- tripChatMessage
- socket:ready
- queue:updated
- queue:count
- ride:updated
- queueChatMessage
- tripChatMessage
- complaint:new
- complaint:statusUpdated
———
cd /Users/surajkiranshewale/Documents/AUTOMATE git add . git commit -m "deploy" git push origin main
- Create cluster
- Create DB user
- Add IP/network access
- Copy connection string
- Use as MONGO_URI
- New Web Service from repo
- Root Directory: backend
- Build Command: npm install
- Start Command: npm start
- Add backend environment variables from .env
- Import same repo
- Root Directory: frontend
- Build Command: npm run build
- Output Directory: dist
- Add env:
- VITE_API_BASE_URL=https:///api
- VITE_SOCKET_URL=https://
Set:
- CORS_ORIGIN=https://
- SOCKET_CORS_ORIGIN=https://
Redeploy backend.
———
Check process:
lsof -nP -iTCP:5000 -sTCP:LISTEN
Kill process:
kill -9
brew services start mongodb-community mongosh "mongodb://127.0.0.1:27017/automate" --eval "db.runCommand({ ping: 1 })"
Backend .env must match frontend URL:
CORS_ORIGIN=http://localhost:8080 SOCKET_CORS_ORIGIN=http://localhost:8080
- Use Gmail App Password (not Gmail account password)
- Check SMTP values:
- SMTP_HOST
- SMTP_PORT
- SMTP_USER
- SMTP_PASS
- MAIL_FROM
If user is inactive, use reactivation endpoint instead of creating duplicate email.
———
- Do not commit .env files.
- Use strong JWT_SECRET.
- Rotate SMTP app password if leaked.
- Use HTTPS URLs in production for API and Socket.