A full-stack faculty appraisal management system for JIIT (Jaypee Institute of Information Technology). Faculty members fill out multi-section appraisal forms, and HODs can review all faculty data from a dashboard.
The system consists of 4 services that all need to be running:
| Service | Tech Stack | Default Port | Purpose |
|---|---|---|---|
| MongoDB | MongoDB (via Docker) | 27017 |
Shared database for all services |
| Django Backend | Django 5 + DRF + PyMongo | 8001 |
REST API โ appraisal form ingestion & retrieval (legacy) |
| FastAPI Backend | FastAPI + Motor (async) | 8000 |
REST API โ appraisal form ingestion & retrieval (current) |
| Next.js Frontend | Next.js 15.5.9 + NextAuth v5 + Tailwind + shadcn/ui | 3000 |
Web portal โ login, appraisal forms, HOD dashboard |
Note: The frontend's API calls point to
http://localhost:8000by default (the FastAPI backend). The Django backend is an older/alternate implementation on port8001. You need at least MongoDB + FastAPI + Next.js running.
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ Next.js โโโโโโโถโ FastAPI / Djangoโโโโโโโถโ MongoDB โ
โ (Port 3000) โ โ (Port 8000/8001)โ โ (Port 27017)โ
โ โโโโโโโถโ โ โ (Docker) โ
โ NextAuth + โ โ PyMongo / Motor โ โโโโโโโโโโโโโโโโ
โ Mongoose โโโโโโโโ โ โฒ
โ (direct DB) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโ (Auth uses Mongoose directly)
Make sure you have these installed on your machine:
- Node.js โฅ 18 (for the Next.js frontend) โ Install
- npm (comes with Node.js) or bun
- Python โฅ 3.11 (for the backends) โ Install
- pip (comes with Python)
- Docker + Docker Compose (for MongoDB) โ Install
- uv (recommended for FastAPI backend) โ
pip install uvor Install
git clone https://github.com/ShauryaRahlon/faculty-appraisal-system.git
cd faculty-appraisal-systemdocker compose up -dThis starts a MongoDB instance on localhost:27017. Data is persisted in ./data/db.
Without Docker? You can install MongoDB locally and ensure it's running on port 27017. Or use a cloud MongoDB URI (MongoDB Atlas) and update the env files accordingly.
You need to create 2 env files: one for the Django/FastAPI backends and one for the Next.js frontend.
Create the file at: django-backend/.env
MONGO_URI=mongodb://localhost:27017/
APPRAISAL_SYSTEM_MONGO_DB_NAME=faculty_appraisal_db
DATA_INJECTION_COLLECTION_NAME=form_data_collection
FACULTY_DATA_COLLECTION_NAME=faculty_data_collectionThe FastAPI backend has its own
.envfile atfastapi-backend/.env. It usespydantic-settingsto load these values and falls back to defaults if the file is missing. Both backends share the same env file.
| Variable | Description | Default |
|---|---|---|
MONGO_URI |
MongoDB connection string | mongodb://localhost:27017/ |
APPRAISAL_SYSTEM_MONGO_DB_NAME |
Database name in MongoDB | faculty_appraisal_db |
DATA_INJECTION_COLLECTION_NAME |
Collection for appraisal form data | form_data_collection |
FACULTY_DATA_COLLECTION_NAME |
Collection for faculty metadata | faculty_data_collection |
Create the file at: jiit-portal/.env.local
# MongoDB connection (used by NextAuth & Mongoose for user auth)
MONGODB_URI=mongodb://localhost:27017/faculty_appraisal_db
# NextAuth Configuration
AUTH_SECRET=your-random-secret-key-here-generate-one-below
AUTH_URL=http://localhost:3000
# Backend API URL (FastAPI)
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
# SMTP Configuration (for OTP emails on first login)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
SMTP_FROM=your-email@gmail.com| Variable | Description | How to Get It |
|---|---|---|
MONGODB_URI |
Full MongoDB URI including the database name | Use mongodb://localhost:27017/faculty_appraisal_db for local Docker |
AUTH_SECRET |
Random secret for NextAuth session encryption | Run: openssl rand -base64 32 |
AUTH_URL |
Base URL of the Next.js app | http://localhost:3000 for local dev |
NEXT_PUBLIC_API_BASE_URL |
URL of the FastAPI (or Django) backend | http://localhost:8000 for FastAPI |
SMTP_HOST |
SMTP server hostname | smtp.gmail.com for Gmail |
SMTP_PORT |
SMTP server port | 587 for Gmail TLS |
SMTP_USER |
Email address for sending OTPs | Your Gmail address |
SMTP_PASS |
Email password / app-specific password | Generate a Gmail App Password |
SMTP_FROM |
"From" address on OTP emails | Same as SMTP_USER |
๐ก Generating
AUTH_SECRET:openssl rand -base64 32Copy the output and paste it as the value.
๐ก Gmail App Password: If using Gmail, you must enable 2FA on your Google account, then go to App Passwords to generate a 16-character app password. Use that instead of your regular Gmail password.
cd fastapi-backend
# Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies (Option A: using pip)
pip install fastapi motor pydantic-settings pymongo python-dotenv uvicorn
# Install dependencies (Option B: using uv โ recommended)
uv sync
# Run the server
python main.pyThe FastAPI backend will start at http://localhost:8000.
You should see: {"message":"Faculty Appraisal System API is running"} when you visit it.
Only needed if you want to use the Django API instead of / alongside FastAPI.
cd django-backend
# Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the server
python manage.py runserver 8001The Django backend will start at http://localhost:8001.
If you want the frontend to use Django instead of FastAPI, change
NEXT_PUBLIC_API_BASE_URLin your.env.localtohttp://localhost:8001.
cd jiit-portal
# Install dependencies
npm install
# Run the dev server
npm run devThe frontend will start at http://localhost:3000.
Once all services are running, you need to populate the database with faculty user accounts.
Open your browser and visit:
http://localhost:3000/api/seed
This hits a built-in API route that creates 136 faculty users + 1 Admin user from a hardcoded dataset. Each faculty user gets:
- Employee Code (e.g.,
JIIT1068) - Default password:
jiit123(bcrypt-hashed) - Default email:
{lowercase_name}@jiit.ac.in - Role:
faculty - isVerified:
false(requires OTP on first login)
The Admin user is also created automatically:
- Employee Code:
ADMIN - Password:
Admin128 - Role:
admin - isVerified:
true(no OTP needed)
โ ๏ธ Only run this once. If you run it again, it will skip existing users (upsert behavior).
To force re-seed (delete all users and recreate): visithttp://localhost:3000/api/seed?force=true
Faculty Login:
- Go to http://localhost:3000 โ redirects to
/login - Enter an employee code (e.g.,
JIIT1068) and the passwordjiit123 - Since it's a first login (
isVerified: false), an OTP will be sent to the faculty's email - Enter the OTP on the verification page
- Set a new password on the change-password page
- Login again with your new password โ redirected to the faculty dashboard
Admin Login (HOD Dashboard):
- Go to http://localhost:3000/login
- Enter
ADMINas Employee Code andAdmin128as password - Redirected directly to the HOD dashboard (no OTP required)
๐ If SMTP is not configured: The OTP will be logged to the terminal running Next.js. Look for
Sending OTP 123456 to ...in the console output. You can use that OTP manually.
faculty-appraisal-system/
โโโ docker-compose.yml # MongoDB container
โโโ CSEIT_faculty major project.csv # Source faculty data
โ
โโโ django-backend/ # Django REST API (port 8001)
โ โโโ .env.example # Environment template
โ โโโ manage.py
โ โโโ requirements.txt
โ โโโ faculty_apprasial_system/ # Django project settings
โ โ โโโ settings.py
โ โ โโโ urls.py
โ โโโ appraisal_form_injestion/ # Form data CRUD app
โ โ โโโ views.py # API views (13 endpoints)
โ โ โโโ urls.py
โ โ โโโ services/ # Business logic
โ โ โโโ clients/ # MongoDB client
โ โโโ faculty_admin/ # Faculty management app
โ โโโ common/ # Shared MongoDB client
โ
โโโ fastapi-backend/ # FastAPI async API (port 8000)
โ โโโ main.py # Entry point
โ โโโ app/
โ โ โโโ main.py # FastAPI app + CORS + routers
โ โ โโโ core/config.py # Pydantic Settings (env loading)
โ โ โโโ db/mongo.py # Async MongoDB client (Motor)
โ โ โโโ api/endpoints/ # Route handlers
โ โ โโโ services/ # Business logic
โ โ โโโ utils/ # Utilities
โ
โโโ jiit-portal/ # Next.js 15.5.9 frontend (port 3000)
โ โโโ package.json
โ โโโ auth.ts # NextAuth v5 config (credentials provider)
โ โโโ middleware.ts # Route protection (auth + role-based access)
โ โโโ app/
โ โ โโโ page.tsx # Root โ redirects to /login
โ โ โโโ login/ # Login page
โ โ โโโ verify-otp/ # OTP verification page
โ โ โโโ change-password/ # Password change page
โ โ โโโ dashboard/ # Faculty dashboard
โ โ โโโ appraisal/ # Multi-section appraisal forms
โ โ โโโ hod/ # HOD review dashboard
โ โ โโโ api/ # Next.js API routes
โ โ โโโ auth/ # NextAuth handlers
โ โ โโโ login/route.ts # Custom login + OTP flow
โ โ โโโ verify-otp/ # OTP verification endpoint
โ โ โโโ change-password/# Password change endpoint
โ โ โโโ seed/route.ts # Database seeding endpoint
โ โโโ lib/
โ โ โโโ dbConnect.ts # Mongoose connection
โ โ โโโ api.ts # Backend API client helpers
โ โ โโโ constants.ts # API endpoints + section config
โ โ โโโ mail.ts # Nodemailer OTP emails
โ โ โโโ types.ts # TypeScript types
โ โโโ models/
โ โ โโโ User.ts # Mongoose User schema
โ โโโ components/ # UI components (shadcn/ui)
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/get-item-by-section/?user_id=...§ion=... |
Get appraisal data for a user + section |
POST |
/api/injest-item-1-to-10/ |
Submit general details (sections 1-10) |
POST |
/api/injest-item-11/ |
Submit conference/events data |
POST |
/api/injest-item-12-1/ |
Submit lectures/tutorials data |
POST |
/api/injest-item-12-2/ |
Submit reading material data |
POST |
/api/injest-item-12-3-to-12-4/ |
Submit project guidance data |
POST |
/api/injest-item-13/ |
Submit student activities data |
POST |
/api/injest-item-14/ |
Submit research papers data |
POST |
/api/injest-item-15/ |
Submit books & chapters data |
POST |
/api/injest-item-16/ |
Submit research projects data |
POST |
/api/injest-item-17/ |
Submit research guidance data |
POST |
/api/injest-item-18/ |
Submit memberships data |
POST |
/api/injest-item-19/ |
Submit other information |
GET |
/api/get-all-faculty-data/ |
Get all faculty data (HOD dashboard) |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/login |
Login + trigger OTP for unverified users |
POST |
/api/verify-otp |
Verify OTP and mark user as verified |
POST |
/api/change-password |
Change user password |
GET |
/api/seed |
Seed database with faculty user accounts |
* |
/api/auth/* |
NextAuth session handlers |
# 1. Start MongoDB
docker compose up -d
# 2. Create backend env
cp django-backend/.env.example django-backend/.env
# 3. Create frontend env
cat > jiit-portal/.env.local << 'EOF'
MONGODB_URI=mongodb://localhost:27017/faculty_appraisal_db
AUTH_SECRET=CHANGE_ME_run_openssl_rand_base64_32
AUTH_URL=http://localhost:3000
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
SMTP_FROM=your-email@gmail.com
EOF
# 4. Start FastAPI backend (Terminal 1)
cd fastapi-backend && python3 -m venv .venv && source .venv/bin/activate
pip install fastapi motor pydantic-settings pymongo python-dotenv uvicorn
python main.py
# 5. Start Next.js frontend (Terminal 2)
cd jiit-portal && npm install && npm run dev
# 6. Seed the database
# Open browser โ http://localhost:3000/api/seed
# 7. Login
# Open browser โ http://localhost:3000
# Use employee code: JIIT1068, password: jiit123This project currently runs on Next.js 15.5.9 with NextAuth v5 (beta).
Route protection is implemented using middleware.ts with JWT-based token checks via next-auth/jwt. This is the stable, recommended approach for Next.js 15.x.
๐ฎ Next.js 16+ Migration: If upgrading to Next.js 16 or later,
middleware.tsmay be deprecated in favor of the newproxy.tsAPI. When migrating:
- Review the Next.js 16 release notes for breaking changes
- Replace
middleware.tswith the equivalentproxy.tsconfiguration- Update route matching patterns to the new proxy API syntax
- Ensure
next-authis compatible with the target Next.js version- Test all protected routes (
/dashboard,/hod/*,/appraisal/*) after migration
| Package | Current Version | Notes |
|---|---|---|
next |
^15.5.9 |
Pinned to 15.x โ do NOT upgrade to 16 without proxy migration |
next-auth |
^5.0.0-beta.30 |
Auth.js v5 beta โ check for stable release before upgrading |
bcryptjs |
latest | Password hashing |
mongoose |
latest | MongoDB ODM for user auth |
| Issue | Solution |
|---|---|
MongoServerError: connect ECONNREFUSED |
Make sure MongoDB is running: docker compose up -d |
Error: Please define the MONGODB_URI environment variable |
Create jiit-portal/.env.local with the MONGODB_URI variable |
AUTH_SECRET missing error |
Add AUTH_SECRET to jiit-portal/.env.local |
| OTP email not sending | Check SMTP credentials. If not configured, look for OTP in the Next.js terminal console output |
ModuleNotFoundError: No module named 'fastapi' |
Activate your venv and install deps: pip install fastapi uvicorn motor pydantic-settings pymongo python-dotenv |
| Port 8000 already in use | Kill the existing process: lsof -ti:8000 | xargs kill |
| Port 3000 already in use | Kill the existing process: lsof -ti:3000 | xargs kill |
| Seed shows "0 users" | Users already exist. Use ?force=true to re-seed: /api/seed?force=true |
| Admin redirected to wrong dashboard | Restart dev server and re-seed with ?force=true to refresh the role field |
- Arsh Gupta โ arshgupta2004@gmail.com