A secure, role-based API backend for reporting and tracking security incidents. Built with FastAPI, PostgreSQL, and JWT authentication. Designed to simulate scalable deployment on AWS Lambda using Zappa-compatible architecture.
- ✅ User Registration & Login (JWT-based auth)
- ✅ Role-Based Access Control (admin-only routes)
- ✅ Incident Reporting (create, filter, delete)
- ✅ Filtering by severity & status via query params
- ✅ Admin-only deletion of incidents
- ✅ JWT Token Auth (via Swagger Authorize)
- ✅ Dockerized (PostgreSQL + FastAPI stack)
- ✅ AWS Lambda compatible (via
Mangum) - ✅ Custom OpenAPI schema (for proper Swagger UI behavior)
| Layer | Technology |
|---|---|
| Language | Python 3.11 / 3.12 |
| Framework | FastAPI |
| Database | PostgreSQL |
| Auth | JWT via python-jose, bcrypt |
| ORM | SQLAlchemy |
| Containerization | Docker + Docker Compose |
| AWS Simulation | Mangum (for Lambda deploy) |
| CI/CD | GitHub Actions |
secure-incident-reporting/
├── app/
│ ├── api/ # Routers (auth, incidents)
│ ├── core/ # Configs, security
│ ├── db/ # Models, database session
│ ├── schemas/ # Schemas of Incident,Token,User
│ └── main.py # FastAPI app entrypoint
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
├── .env
└── README.md
# Build and start containers
docker compose up --build
# Visit the API docs at:
# 👉 http://localhost:8000/docs (Swagger)
# 👉 http://localhost:8000/redoc (ReDoc)This API uses JWT Bearer tokens for secure access.
- Register a user →
POST /auth/register - Login →
POST /auth/login
→ Receiveaccess_tokenin response. - Use the token in Swagger UI via "Authorize" →
Bearer <your_token_here>
| UI | URL | Description |
|---|---|---|
| Swagger | http://localhost:8000/docs |
Interactive docs with JWT testing |
| ReDoc | http://localhost:8000/redoc |
Read-only clean API documentation |
| Root | http://localhost:8000/ |
Welcome message |
This project integrates Mangum to simulate AWS Lambda deployment locally. This makes it compatible with:
- Zappa or AWS API Gateway + Lambda
- Serverless architecture best practices
- CI-ready with secrets managed via GitHub Actions
While no actual AWS services are used, the backend is architecturally ready for cloud-native deployment.
Install Python packages (if running without Docker):
pip install -r requirements.txtmade by arjun7579