A high-performance, production-ready backend system combining Django REST Framework (for robust business logic) and FastAPI (for real-time and high-performance features).
- Authentication: JWT-based auth with custom multi-role user system (Admin, Creator, Viewer).
- Blog Engine: Full CRUD for posts, comments, and categories with search and pagination.
- File Handling: Secure file upload API.
- Utilities: Built-in URL Shortener and Recommendation System.
- Task Queue: Asynchronous background processing with Celery.
- Chat System: WebSocket-based multi-user chat.
- Video Streaming: Efficient video streaming with HTTP Range support.
- High Performance: Redis-cached endpoints for heavy computations.
- Languages: Python 3.10+
- Frameworks: Django 4.2, Django REST Framework, FastAPI
- Databases: PostgreSQL, Redis
- Infrastructure: Docker, Docker Compose
- Async: Celery, WebSockets
-
Clone the repository:
git clone <repository-url> cd backend_masterclass
-
Start with Docker Compose:
docker-compose up --build
-
Initialize Database: (run in a new terminal window)
# Generate and apply migrations docker-compose exec django python manage.py makemigrations users content files docker-compose exec django python manage.py migrate
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/register/ |
Register new user |
| POST | /api/login/ |
Obtain Access & Refresh Tokens (JWT) |
| POST | /api/token/refresh/ |
Refresh Access Token |
| GET | /api/users/ |
List all users (Auth required) |
| GET | /api/users/{username}/ |
Get user profile |
| Method | Endpoint | Description |
|---|---|---|
| GET/POST | /api/posts/ |
List or Create API Posts |
| GET | /api/posts/?search=keyword |
Search posts |
| GET | /api/posts/{id}/ |
Get single post details |
| GET | /api/posts/{id}/recommendations/ |
Get similar posts |
| GET/POST | /api/categories/ |
Manage Categories |
| GET/POST | /api/comments/ |
Manage Comments |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/shortner/ |
Create short URL {"original_url": "..."} |
| GET | /api/s/{short_code}/ |
Redirect to original URL |
| POST | /api/files/upload/ |
Upload file (Multipart Form) |
| GET | /api/files/list/ |
List uploaded files |
Base URL: http://localhost:8001
| Method | Endpoint | Description |
|---|---|---|
| WS | /ws/chat/{client_id} |
WebSocket connection for chat |
| GET | /video |
Stream video (supports Range header) |
| GET | /heavy-data |
Redis cached response (Fast after 1st hit) |
- Django Swagger UI: http://localhost:8000/swagger/
- FastAPI ReDoc: http://localhost:8001/docs