Skip to content

viny4/Backend-Masterclass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Comprehensive Backend Masterclass

A high-performance, production-ready backend system combining Django REST Framework (for robust business logic) and FastAPI (for real-time and high-performance features).

🚀 Features

Core Backend (Django)

  • 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.

Real-time Service (FastAPI)

  • Chat System: WebSocket-based multi-user chat.
  • Video Streaming: Efficient video streaming with HTTP Range support.
  • High Performance: Redis-cached endpoints for heavy computations.

🛠️ Tech Stack

  • Languages: Python 3.10+
  • Frameworks: Django 4.2, Django REST Framework, FastAPI
  • Databases: PostgreSQL, Redis
  • Infrastructure: Docker, Docker Compose
  • Async: Celery, WebSockets

📦 Installation & Run

  1. Clone the repository:

    git clone <repository-url>
    cd backend_masterclass
  2. Start with Docker Compose:

    docker-compose up --build
  3. 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

🔌 API Documentation

1. Authentication (Django)

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

2. Blog & Content (Django)

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

3. Utilities (Django)

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

4. Real-time & Performance (FastAPI)

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)

📚 Interactive Documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors