REST API backend for NUSProfs, a platform where NUS students can search for professors, view aggregated ratings, and share reviews of their teaching. The live API is hosted at nusprofs-api.onrender.com.
- Professor search & profiles — search professors by name, view their details, modules taught, and aggregated review ratings
- Top professors — ranked listing of the highest-rated professors
- Module comparison — compare professors teaching the same module, filterable by academic year
- Reviews & replies — post, edit, and delete reviews with threaded replies and likes
- JWT authentication — registration, login, token refresh/verification, and logout with refresh-token blacklisting
- Framework: Django 5.2 with Django REST Framework
- Authentication: SimpleJWT (access + refresh tokens with blacklist)
- Database: PostgreSQL
- Caching: Redis via django-redis
- Static files: WhiteNoise
- Deployment: Gunicorn on Render
- Python 3.11+
- PostgreSQL
- Redis (optional, for caching)
-
Clone the repository and create a virtual environment:
git clone https://github.com/happyweijie/NUSProfs.git cd NUSProfs python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables by copying the template:
cp .env.example .env
Generate a
SECRET_KEYwith:python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"Then fill in the
DEV_DB_*variables with your local PostgreSQL credentials (andREDIS_*if using caching). -
Apply migrations and (optionally) load seed data:
python manage.py migrate python manage.py loaddata data/seed_data.json
-
Start the development server:
python manage.py runserver
The server runs with development settings (
NUSProfs.settings.dev) by default.
Tests run against a separate PostgreSQL database configured via the TEST_DB_* variables in .env (CI defaults: testdb / testuser / testpassword on localhost:5432).
DJANGO_SETTINGS_MODULE=NUSProfs.settings.test python manage.py testTests also run automatically on GitHub Actions for every push and pull request to main.