# cthadeusantos/makemake architecture

> Architecture diagram of the GitHub repository cthadeusantos/makemake, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cthadeusantos/makemake
- Repository: https://github.com/cthadeusantos/makemake

## Overview

##### Main System Components

a) Frontend Layer:
- HTML templates (located in each app's templates directory)
- Static assets (CSS, JavaScript, images)
- Client-side interactions (especially the JS files in various apps)

b) Backend Layer:
- Django Apps (multiple modular components):
- Core (base functionality)
- Projects
- Agreements
- Budgets
- Buildings
- Categories
- Companies
- Compositions
- Documents
- Prices
- Units
- Imports

c) Database Layer:
- Models from each app (as evidenced by models.py files)
- Relationships between different entities (reference the ER Model in documentation)

##### Architectural Patterns to Highlight

a) Django's MVT (Model-View-Template) architecture:
- Models: Data structure (models.py in each app)
- Views: Business logic (views.py in each app)
- Templates: Presentation layer (templates directories)

b) Modular Design:
- How each Django app is self-contained with its own MVC components
- Inter-app communications and dependencies

##### Specific Implementation Details

Key elements:

a) Authentication & Authorization:
- User management through Django's auth system
- Profile management (profiles app)

b) Data Flow:
- How projects flow through different components:
- Project creation → Agreements → Budgets → Payments
- Price and composition management flow
- Document management system

##### Technical Specifications

a) Technology Stack:
- Python 3.10+
- Django 5.1
- JavaScript (ECMAScript 2018+)
- HTML5
- Database (as configured in settings.py)

##### Key Relationships to Highlight

Relationships between:
- Projects and Agreements
- Agreements and Budgets
- Compositions and Prices
- Documents and their versions
- Companies and their associated entities

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI["User Interface"]:::frontend
        Templates["HTML Templates"]:::frontend
        StaticAssets["Static Assets"]:::frontend
        ClientJS["Client-side JS"]:::frontend
    end

    subgraph Backend
        Auth["Authentication System"]:::backend
        click Auth "https://github.com/cthadeusantos/makemake/blob/main/makemake/core/templates/core/login.html"

        subgraph CoreModule["Core Module"]
            CoreFunctions["Core Functions"]:::backend
            CustomFilters["Custom Filters"]:::backend
            click CoreFunctions "https://github.com/cthadeusantos/makemake/blob/main/makemake/core/custom_functions.py"
            click CustomFilters "https://github.com/cthadeusantos/makemake/blob/main/makemake/myfilters/templatetags/formats.py"
        end

        subgraph ProjectManagement["Project Management"]
            Projects["Projects"]:::backend
            Agreements["Agreements"]:::backend
            Budgets["Budgets"]:::backend
            click Projects "https://github.com/cthadeusantos/makemake/tree/main/makemake/projects/"
            click Agreements "https://github.com/cthadeusantos/makemake/tree/main/makemake/agreements/"
            click Budgets "https://github.com/cthadeusantos/makemake/tree/main/makemake/budgets/"
        end

        subgraph ResourceManagement["Resource Management"]
            Documents["Documents"]:::backend
            Prices["Prices"]:::backend
            Compositions["Compositions"]:::backend
            click Documents "https://github.com/cthadeusantos/makemake/tree/main/makemake/documents/"
            click Prices "https://github.com/cthadeusantos/makemake/tree/main/makemake/prices/"
            click Compositions "https://github.com/cthadeusantos/makemake/tree/main/makemake/compositions/"
        end

        subgraph OrganizationManagement["Organization Management"]
            Companies["Companies"]:::backend
            Profiles["Profiles"]:::backend
            click Companies "https://github.com/cthadeusantos/makemake/tree/main/makemake/companies/"
            click Profiles "https://github.com/cthadeusantos/makemake/tree/main/makemake/profiles/"
        end

        ImportSystem["Import System"]:::backend
        click ImportSystem "https://github.com/cthadeusantos/makemake/tree/main/makemake/imports/"
    end

    subgraph Database
        ProjectsDB[(Projects DB)]:::database
        AgreementsDB[(Agreements DB)]:::database
        BudgetsDB[(Budgets DB)]:::database
        DocumentsDB[(Documents DB)]:::database
        PricesDB[(Prices DB)]:::database
        CompositionsDB[(Compositions DB)]:::database
        CompaniesDB[(Companies DB)]:::database
        UsersDB[(Users DB)]:::database
    end

    %% Frontend Connections
    UI --> Templates
    UI --> StaticAssets
    UI --> ClientJS

    %% Backend to Frontend Connections
    Templates --> Auth
    Templates --> Projects
    Templates --> Documents
    Templates --> Prices

    %% Core Module Connections
    Auth --> CoreFunctions
    CoreFunctions --> CustomFilters

    %% Project Management Connections
    Projects --> Agreements
    Agreements --> Budgets
    Projects --> Documents

    %% Resource Management Connections
    Prices --> Compositions
    Documents --> Compositions

    %% Database Connections
    Projects -.-> ProjectsDB
    Agreements -.-> AgreementsDB
    Budgets -.-> BudgetsDB
    Documents -.-> DocumentsDB
    Prices -.-> PricesDB
    Compositions -.-> CompositionsDB
    Companies -.-> CompaniesDB
    Profiles -.-> UsersDB

    %% Import System Connections
    ImportSystem --> Projects
    ImportSystem --> Prices
    ImportSystem --> Compositions

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#e67e22,stroke:#d35400,color:white

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Component"]:::frontend
        Backend_L["Backend Component"]:::backend
        Database_L[(Database)]:::database
        API_L["--- API Call"]
        DB_L["-.- Database Operation"]
    end
```
