A comprehensive backend solution designed for educational institutions to digitize and automate the student leave request and gate pass issuance process. Built with modern Django practices, this system handles multi-level approval workflows, real-time notifications, and secure role-based access control.
- JWT Authentication: Secure stateless authentication using
djangorestframework-simplejwt. - Role-Based Access Control (RBAC): Distinct permissions for Students, Department HODs, Hostel Wardens, and Admins.
- Custom User Models: Extended user profiles handling specific attributes for students (parents' contact, room numbers) and staff.
- Digital Leave Requests: Students can apply for leave with dates and reasons.
- Multi-Stage Approval:
- HOD Approval: Academic clearance from the department.
- Warden/Admin Approval: Residential clearance.
- Status Tracking: Real-time tracking of application status (Pending, Approved, Rejected).
- Automated Issuance: System automatically generates a
GatePassentry upon final approval. - Unique Security Codes: Each pass includes a unique tracking code for security verification at the gate.
- Background Services: Dedicated
notificationsapp to handle alerts. - Status Updates: Users are notified immediately when their leave status changes.
| Component | Technology |
|---|---|
| Framework | Django 5.2 |
| API | Django REST Framework (DRF) 3.16 |
| Database | PostgreSQL (via psycopg3) |
| Server | Uvicorn (ASGI) / Gunicorn (WSGI) |
| Package Manager | uv |
| Documentation | OpenAPI 3.0 via drf-spectacular |
├── api/ # Global API configurations
├── apps/ # Modular Django Apps
│ ├── core/ # Shared logic (Hostel/Department models)
│ ├── leave/ # Leave Request & Gate Pass business logic
│ ├── notifications/ # Background notification services
│ └── users/ # Custom User, Student, and Staff models
├── config/ # Project settings (ASGI/WSGI)
└── staticfiles/ # Static assets for Admin panel
This project uses uv for fast and reliable dependency management.
- Python 3.14+
- PostgreSQL
uvinstalled
git clone [https://github.com/yourusername/gate-pass-backend.git](https://github.com/yourusername/gate-pass-backend.git)
cd gate-pass-backend
# Django core
SECRET_KEY=some-secret-key
DEBUG=True
# Hosts
ALLOWED_HOSTS=
CSRF_TRUSTED_ORIGINS=
CORS_ALLOWED_ORIGINS=
# JWT timing (minutes)
ACCESS_TOKEN_LIFETIME=60
REFRESH_TOKEN_LIFETIME=7
DB_NAME=your database name
DB_USER=postgres
DB_PASSWORD=password
DB_HOST=localhost
DB_PORT=5432
EMAIL_APP_PASSWORD=uv syncMarkdown
This project uses uv for fast and reliable dependency management.
- Python 3.14+
- PostgreSQL
uvinstalled
git clone [https://github.com/yourusername/gate-pass-backend.git](https://github.com/yourusername/gate-pass-backend.git)
cd gate-pass-backend
uv syncApply migrations to set up the schema:
uv run manage.py migrateuv run manage.py createsuperuserFor development
uv run python manage.py runserver The project includes auto-generated, interactive API documentation.
Swagger UI: http://127.0.0.1:8000/api/docs/
Redoc: http://127.0.0.1:8000/api/schema/redoc/
OpenAPI Schema: http://127.0.0.1:8000/api/schema/
Fork the repository.
Create a feature branch (git checkout -b feature/AmazingFeature).
Commit your changes (git commit -m 'Add some AmazingFeature').
Push to the branch (git push origin feature/AmazingFeature).
Open a Pull Request.