The official website for LA/CA (Lecture Added Courses/Co-Curricular Activities) registration at NIT Hamirpur. This portal enables students to register for elective activities and courses with a seamless, scalable experience.
- 850+ registrations completed in 2 days
- 60,000+ HTTP requests handled
- 99.9% uptime during peak registration period
- Efficient email delivery with Redis-based job queuing
Read the full technical blog post: Blog
- Node.js - JavaScript runtime
- Express.js - Web framework for routing and middleware
- MongoDB - NoSQL database for storing registrations and activity data
- Mongoose - ODM (Object Data Modeling) for MongoDB
- BullMQ - Task queue built on Redis for background job processing
- IORedis - Redis client for Node.js
- Nodemailer - Email sending with SMTP support (Gmail)
- Redis - In-memory data store for job queue and worker coordination
- EJS - Embedded JavaScript templating
- HTML5 & CSS3 - Modern, responsive UI
- Vanilla JavaScript - Form handling and dynamic subject loading
- JWT (jsonwebtoken) - Token-based email verification
- dotenv - Environment variable management
laca-site/
βββ models/
β βββ form.js # User registration schema
β βββ subject.js # Activity/course schema
βββ routes/
β βββ form.js # Form submission & validation
β βββ email.js # Email verification endpoint
β βββ subject.js # Subject management & API
β βββ details.js # Registration details (admin)
βββ services/
β βββ sendEmail.js # Email template & transport logic
β βββ redis/
β βββ emailQueue.js # BullMQ queue producer
β βββ emailWorker.js # BullMQ worker consumer
βββ views/
β βββ home.ejs # Main registration form
β βββ verify-email.ejs # Email verification page
β βββ subject.ejs # Admin subject management
β βββ details.ejs # Registration details page
βββ public/ # Static assets
βββ index.js # Server entry point
βββ connection.js # MongoDB connection handler
βββ package.json # Dependencies
βββ README.md
- Node.js (v14 or higher)
- npm (comes with Node.js)
- MongoDB (local or cloud instance via MongoDB Atlas)
- Redis (for background job processing)
- Git
git clone https://github.com/ayush00git/laca-site.git
cd laca-sitenpm installCreate a .env file in the project root:
# Server
PORT=8089
NODE_ENV=development
# Database
MONGO_URI=mongodb://localhost:27017/laca-site
# Or use MongoDB Atlas:
# MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/laca-site?retryWrites=true&w=majority
# Email Configuration (Gmail SMTP)
USER_MAIL=your-email@gmail.com
USER_PASS=your-app-specific-password
# Generate app password: https://myaccount.google.com/apppasswords
# JWT & Verification
JWT_SECRET=your-super-secret-key
PROD_URL=http://localhost:8089
# Redis Configuration (for email queue)
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
# Or use Redis URL:
# REDIS_URL=redis://:password@host:port
# Private Routes (admin/sensitive operations)
PRIVATE_URL=admin# If installed locally
mongod- Create a cluster at MongoDB Atlas
- Get connection string and add to
.envasMONGO_URI
# If installed locally
redis-server
# Or using Docker
docker run -d -p 6379:6379 redis:latestIn a separate terminal:
npm run start-workerThis will start the BullMQ worker that processes email jobs from the Redis queue.
In another terminal:
npm run devThe server will start at http://localhost:8089
- User Submits Form β Server validates & creates JWT token
- Enqueue Job β Job is added to Redis queue (
emailQueue.js) - Immediate Response β User sees success message instantly (non-blocking)
- Worker Processes β Background worker (
emailWorker.js) picks up job from queue - Email Sent β Nodemailer sends verification email via Gmail SMTP
- Job Complete β Job is marked complete and removed from queue (or retained on failure)
POST /form/submit- Submit registration formGET /email/verify-email?token=JWT_TOKEN- Verify email and confirm registration
GET /admin/subject/api/all- Fetch all activities (for frontend dropdown)POST /admin/subject- Create new activity (admin only)
GET /admin/details- View all registrations
GET /api/config- Get dynamic API configuration
npm run dev # Start development server with auto-reload (nodemon)
npm run start # Start production server
npm run start-worker # Start background email worker- JWT-based email verification - Tokens expire in 24 hours
- Input validation - Server-side validation for all form inputs
- Email domain restriction - Only
@nith.ac.inemails accepted - Rate limiting - BullMQ limiter (10 emails per second max)
- Environment variables - Sensitive data not in code
- HTTPS ready - Configure in production deployment
NODE_ENV=production
PORT=8089
MONGO_URI=mongodb+srv://... # Atlas connection
REDIS_URL=redis://:password@host:port # Cloud Redis
USER_MAIL=registration@nith.ac.in # Official email
JWT_SECRET=long-random-secret-key
PROD_URL=https://laca.nith.ac.in # Production domain
PRIVATE_URL=admin- Server: AWS EC2.
- Database: MongoDB Atlas
- Redis: AWS ElastiCache or Upstash
- Email: Gmail SMTP or SendGrid/AWS SES for higher limits
Use PM2 to keep the server and worker running:
npm install -g pm2
# Start both processes
pm2 start index.js --name "laca-server"
pm2 start services/redis/emailWorker.js --name "email-worker"
# Monitor
pm2 monit
# Logs
pm2 logs- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
Developers:
This project is part of NIT Hamirpur's official infrastructure. Contact the administration for licensing details.
Last Updated: January 11, 2026
Version: 2.0.0