How manterolaenrique/logistics-challenge works
Project Type and Purpose
• This is a backend-focused full-stack application (no separate “frontend” code) implementing a Logistics Management System via a REST API.
• It follows Clean Architecture with Domain-Driven Design (DDD) and hexagonal (ports & adapters) patterns to manage packages, distribution sheets, and workflows.
High-Level Architectural Layers
• Domain Layer (Core Business)
– entities.py, enums.py, value_objects.py, services.py, repositories.py
– Pure business rules, domain models, and repository interfaces (ports).
• Application Layer
– use_cases.py, dtos.py, exceptions.py
– Orchestrates domain operations via use-case services, defines DTOs, and raises domain exceptions.
• Infrastructure/Adapters Layer (Django)
– apps/logistics/…: models.py, serializers.py, views.py, repositories_impl.py, uow.py, urls.py
– Concrete adapters: Web controllers (DRF Views), HTTP serializers, ORM models, repository & Unit of Work implementations.
• Framework & Runtime
– Django settings/asgi/wsgi, Django REST Framework (DRF), DRF Spectacular for docs, SQLite for development.
Main Components
A. Ports & Adapters (Hexagon)
– Center: Domain Layer (Entities, Value Objects, Domain Services)
– Application Ports: UseCase Interfaces (defined in application)
– Adapters:
• Inbound Adapter: HTTP API (Django-DRF Views + Serializers)
• Outbound Adapter: RepositoryImpl + Unit of Work (Django ORM → SQLite)
B. External Services
– API Consumers (Web UI, CLI, other services) connecting via HTTP
– DRF Spectacular / Swagger UI for interactive docs
C. Data Store
Relationships & Data Flow
1. Client → HTTP Request → DRF View (Inbound Adapter)
2. View → deserialize JSON → DTO → Application UseCase
3. UseCase → orchestrates Domain Services & Entities
4. Domain → calls Repository interface (port)
5. RepositoryImpl (adapter) → uses Django ORM → persists in SQLite
6. Responses bubble back through UseCase → View → JSON Response
Architectural Patterns & Design Principles
• Hexagonal Architecture (Ports & Adapters)
• Clean Architecture (Separation of Concerns by layer)
• Dependency Inversion: High-level modules depend on abstractions (repositories)
• Repository Pattern & Unit of Work for transactional consistency
• DTO Pattern for data transfer across layers
• SOLID Principles enforced across modules
Detailed Elements to Capture
• Django settings/ASGI/Wsgi hosting environment
• DRF Spectacular documentation endpoints
• Migration & model definitions under apps/logistics/models.py
• Repository interface vs. implementation under domain/repositories.py vs. repositories_impl.py
• URL routing (config/urls.py and apps/logistics/urls.py)