Production-grade RESTful API with authentication, role-based access control, rate limiting, and caching — built with Python and FastAPI.
- User registration & JWT authentication
- CRUD operations for tasks and projects
- Role-based access control (admin, member, viewer)
- Rate limiting per user/IP
- Redis caching for frequent queries
- Pagination, filtering, sorting
- OpenAPI/Swagger documentation
- Database migrations with Alembic
| Layer | Technology |
|---|---|
| Framework | Python, FastAPI |
| Database | PostgreSQL |
| ORM | SQLAlchemy |
| Migrations | Alembic |
| Cache | Redis |
| Auth | JWT (python-jose) |
| Validation | Pydantic |
| Testing | pytest |
| Containerization | Docker, Docker Compose |
┌──────────┐ ┌──────────────────────┐ ┌────────────┐
│ Client │────▶│ FastAPI │────▶│ PostgreSQL │
└──────────┘ │ ├── Auth middleware │ └────────────┘
│ ├── Rate limiter │
│ └── Cache layer ─────┼────▶┌───────┐
└──────────────────────┘ │ Redis │
└───────┘
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /api/auth/register |
No | Register user |
| POST | /api/auth/login |
No | Login, get JWT |
| GET | /api/tasks |
Yes | List tasks (paginated) |
| POST | /api/tasks |
Yes | Create task |
| GET | /api/tasks/:id |
Yes | Get task details |
| PUT | /api/tasks/:id |
Yes | Update task |
| DELETE | /api/tasks/:id |
Admin | Delete task |
| GET | /api/projects |
Yes | List projects |
docker-compose up
# Swagger UI at http://localhost:8000/docs- Project setup
- Database models & migrations
- JWT authentication
- CRUD endpoints
- Role-based access control
- Rate limiting
- Redis caching
- Pagination & filtering
- Tests
- Docker deployment
MIT