Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Django REST API - Clean Architecture Backend

This project is a REST API built with Django and Django REST Framework, structured using a layered architecture inspired by Clean Architecture principles. The goal is to create a scalable, maintainable, and well-organized backend system.

Architecture Overview

The system is divided into the following layers:

presentation → application → domain → infrastructure

1. Presentation Layer (API Layer)

Responsibility:

  • Handles HTTP requests
  • Parses input data
  • Calls application use cases
  • Returns JSON responses

Example: def create_product(request): use_case.execute(data)

2. Application Layer

Responsibility:

  • Contains application business logic
  • Implements Use Cases
  • Defines interfaces (contracts)

Examples:

  • CreateProductUseCase
  • GetProductsUseCase
  • UpdateProductUseCase

3. Domain Layer

Responsibility:

  • Contains core business entities
  • Defines business rules
  • Independent of frameworks or infrastructure

Examples:

  • Product
  • Category

4. Infrastructure Layer

Responsibility:

  • Database access using Django ORM
  • Repository implementations
  • Data persistence logic

Example: ProductModel.objects.create(...)

System Flow

HTTP Request ↓ View (Presentation Layer) ↓ Use Case (Application Layer) ↓ Repository (Infrastructure Layer) ↓ Database ↓ JSON Response

Technologies Used

  • Python 3
  • Django
  • Django REST Framework
  • SQLite / PostgreSQL
  • Layered Architecture (Clean Architecture style)

Project Structure

application -> domain -> infrastructure / presentation

API Endpoints

Products

  • GET /api/products/
  • POST /api/products/create/
  • PUT /api/products/{id}/
  • DELETE /api/products/{id}/
  • GET /api/products/{id}/

Categories

  • GET /api/categories/
  • POST /api/categories/create/
  • PUT /api/categories/{id}/
  • DELETE /api/categories/{id}/
  • GET /api/categories/{id}/

Design Principles

  • Separation of concerns
  • Layered architecture
  • Business logic isolated from framework
  • Maintainability and scalability
  • Dependency inversion via interfaces

Project Purpose

This project demonstrates backend engineering skills including:

  • REST API development with Django
  • Clean and scalable architecture design
  • Separation of business logic and infrastructure
  • Use of repository and use case patterns
  • Production-ready backend structure

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages