--------------------------------------------------------------------------------------- ┌─────────────────────────────────┐ SUPER ADMIN ───▶ │ http://localhost:8002/admin/ │ → manage all data (developer/owner) │ (Django built-in panel) │ └─────────────────────────────────┘ ---------------------------------------------------------------------------------------- ┌─────────────────────────────────┐ Admin │ │ Recruiter ───▶ │ http://localhost:3000/login │ → use the ATS Hiring Manager │ (your Next.js frontend) │ Candidate │ │ └─────────────────────────────────┘ ---------------------------------------------------------------------------------------- Browser → Frontend (3000) → Gateway (8000) → Backend (8002) → PostgreSQL ↓ MCP (9000) ← MFA ################################################################################### cd E:\xampp\htdocs\TA-ATS\backend 1. python -m venv venv 2. pip install django djangorestframework djangorestframework-simplejwt django-cors-headers psycopg2-binary python-dotenv pyotp "qrcode[pil]" Pillow fastmcp Package | Purpose django, djangorestframework backend + REST API djangorestframework-simplejwt JWT login tokens django-cors-headers allow Next.js (port 3000) to call it psycopg2-binary PostgreSQL driver python-dotenv read .env file pyotp, qrcode[pil], Pillow MFA / QR codes fastmcp client to call the MCP service later +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ See It setup successfully RUN: 1.=====> pip list | findstr /I "Django djangorestframework psycopg2 fastmcp pyotp" 2.=====> python -m django --version Output Here Django 6.0.6 django-cors-headers 4.9.0 djangorestframework 3.17.1 [ for auth ] djangorestframework_simplejwt 5.5.1 [] fastmcp 3.4.2 fastmcp-slim 3.4.2 psycopg2-binary 2.9.12 PyOTP 2.10.0 #################################################################################### ATS/ ├── frontend/ # Next.js │ ├── src/ │ │ ├── app/ │ │ ├── components/ │ │ ├── services/ │ │ ├── hooks/ │ │ ├── store/ │ │ ├── types/ │ │ ├── lib/ │ │ └── proxy.ts # was middleware.ts │ ├── .env.example │ └── package.json │ ├── gateway/ # FastAPI │ ├── app/ │ │ ├── api/ # auth, dashboard, candidates, jobs, interviews │ │ ├── middleware/ # auth, logging, rate_limit │ │ ├── clients/ # httpx clients → Django │ │ ├── schemas/ │ │ ├── dependencies/ │ │ ├── config/ │ │ └── main.py │ ├── tests/ │ ├── .env.example │ └── requirements.txt │ ├── backend/ # Django │ ├── apps/ │ │ ├── authentication/ # renamed from auth/ │ │ ├── users/ # custom User model — FIRST migration │ │ ├── dashboard/ │ │ ├── candidates/ │ │ ├── jobs/ │ │ ├── interviews/ │ │ ├── reports/ │ │ └── audit_logs/ │ │ # each app: models, serializers, views, urls, services, managers, tests/ │ ├── core/ # exceptions, permissions, responses, pagination, middleware, utils │ ├── config/ │ │ ├── settings/ # base / dev / prod │ │ ├── celery.py # moved from workers/ │ │ ├── urls.py │ │ └── asgi.py / wsgi.py │ ├── requirements/ # base / dev / prod │ ├── .env.example │ └── manage.py │ ├── database/ │ ├── seeds/ │ └── backups/ │ ├── docs/ # HLD, LLD, ERD, API ├── infrastructure/ │ └── docker/ # Dockerfiles per service ├── .github/workflows/ # CI ├── .env.example ├── .gitignore ├── docker-compose.yml # postgres + redis + backend + gateway + frontend + worker └── README.md ================================================================================== For login in the Django backend, these packages do the work: ## Core login packages | Package | What it does for login | |---|---| | **djangorestframework** (DRF) | Builds the login API endpoint (`/api/v1/auth/login/`) | | **djangorestframework-simplejwt** | Issues & validates the **JWT tokens** (access + refresh) — this is the actual "login token" system | | **django.contrib.auth** (built into Django) | Password hashing + `check_password()` + the User base class — no install needed, comes with Django | ## For MFA (the 2-factor part) | Package | Role | |---|---| | **pyotp** | generates/verifies the 6-digit TOTP codes | | **qrcode** + **Pillow** | makes the QR code image | | **fastmcp** | Django uses it to call the MCP service (where the MFA logic actually runs) | ## How they fit together at login ``` DRF → receives the login request django.contrib.auth → checks the password (check_password) simplejwt → creates the access + refresh tokens fastmcp → MCP → verifies the MFA code (if MFA enabled) ``` ## The one-line install (what we ran) ```powershell pip install django djangorestframework djangorestframework-simplejwt django-cors-headers psycopg2-binary python-dotenv pyotp "qrcode[pil]" Pillow fastmcp ``` ## The "login enabler" specifically If you mean **what makes JWT login work** — it's: ``` djangorestframework-simplejwt ``` That's the package that turns email+password into a token the frontend uses to stay logged in. --- Want me to show you the exact lines in `settings.py` where these get wired up for login? ================================================================================== Here's the full package map so it's clear: [1]. backend/ — Django (this is Step 2, connects to PostgreSQL) django djangorestframework (DRF) : Builds the login API endpoint (/api/v1/auth/login/) djangorestframework-simplejwt django-cors-headers psycopg2-binary ← the PostgreSQL driver python-dotenv pyotp qrcode[pil] Pillow fastmcp ← client to call MCP service [2] Gateway/ — FastAPI (later, Step for gateway) fastapi uvicorn httpx ← forwards requests to Django pydantic-settings python-dotenv pyjwt ← validates JWT at the gateway [3] mcp/ — FastMCP service (later, MCP step) fastmcp pyotp pdfminer.six python-docx ############################################################################################# Feature TOTP SMS OTP Push Notification Hardware Key Passkeys Type Time-based code Text message App prompt Physical device FIDO2/WebAuthn Learning Curve Easy Easy Easy Medium Medium Performance Instant 2-10s delay Instant Instant Instant Security High Medium High Very High Very High Phishing Resist No No Medium Yes Yes Offline Support Yes No No Yes Yes Setup Cost Free Carrier cost Free \$20-\$50 Free Device Needed Phone app Any phone Smartphone USB/NFC key Phone/Laptop Enterprise Apps ⭐⭐⭐⭐ ⭐⭐ ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐ Banking Suitability ⭐⭐⭐⭐ ⭐⭐⭐ ⭐⭐⭐⭐ ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐ ############################################################################################# Service Port Who talks to it frontend 3000 the user's browser gateway 8000 browser → here (only public API) backend (Django) 8002 gateway only (internal) mcp 9000 Django only (internal)