# arrowpc/palettum architecture

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

- Interactive diagram: https://gitdiagram.com/arrowpc/palettum
- Repository: https://github.com/arrowpc/palettum

## Overview

1. API (apps/api): A Flask-based Python API that serves as a backend server. It includes endpoints in routes.py, authentication logic in auth.py, and tests to ensure API behavior. This component handles incoming HTTP requests, validates them, and communicates with the core library for processing.

3. Frontend (apps/frontend): A React-TS application that provides the user interface, allowing users to interact with the API. Its structure includes components for uploading images, viewing palettes, editing images, and utility components for various UI elements. It is configured using typical React and Vite configuration files along with TypeScript setups.

a. Main Components:
- “Tests” as a supportive component for both API and Core modules if needed.

b. Relationships and Interactions:
- That the Core Library provides functionality that can be utilized via both the standalone CLI (as seen in some bindings and test directories) and through the API.

c. Architectural Patterns and Design Principles:
- Isolation of concerns: Frontend is solely responsible for presentation and interaction; API manages request dispatch, authentication, and validation; and the Core Library handles computation-heavy tasks.
- The project is modular, and the separation indicates adherence to layered architecture patterns.
- Use of containerization (Dockerfiles in API and Frontend) and CI/CD integration (as visible in the .github workflows), which can be included in a separate “Deployment Pipeline” or “Infrastructure” section if desired.

d. Relevant Technologies and Frameworks:
- In the Frontend block, note technology choices like React, TypeScript, Vite, and Tailwind CSS.
- In the API block, mark Flask and its testing frameworks.
- Optionally, indicate other supporting submodules or external libraries referenced (e.g., vcpkg, external dependency directories).

- Additional utilities such as Docker (for container builds), CI workflows (GitHub Actions), and testing frameworks (both Python and C++) to give a complete picture of both development and deployment processes.

- For instance, a rounded rectangle for user interface components (Frontend),

g. Additional Notes:
- Essential architectural elements without overcomplicating the design. Focus on splitting the project into as many clear, isolated components as possible, which reflects the separation of concerns evident in the project’s directory structure.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Frontend Layer"
        FE_Frontend["Frontend (React-TS UI)"]:::frontend
        FE_App["React Components (App.tsx, etc.)"]:::frontend
        FE_Docker["Dockerfile & Config (Dockerfile)"]:::frontend
        FE_Vite["Vite Config (vite.config.ts)"]:::frontend
        FE_Frontend --> FE_App
        FE_Frontend --> FE_Docker
        FE_Docker --> FE_Vite
    end

    subgraph "API Layer"
        API_Server["API (Flask-based Python Server)"]:::api
        API_Routes["API Routes (routes.py)"]:::api
        API_Auth["API Authentication (auth.py)"]:::api
        API_Tests["API Tests"]:::test
        API_Server --> API_Routes
        API_Server --> API_Auth
        API_Tests --> API_Server
    end

    subgraph "Core Library Layer"
        Core_Lib["Core Library (C++ with Python bindings)"]:::core
        Core_Headers["C++ Headers"]:::core
        Core_Source["C++ Source"]:::core
        Core_CMakeLists["CMakeLists.txt"]:::core
        Core_CMakePresets["CMakePresets.json"]:::core
        Core_Bindings["Python Bindings (bindings.cpp)"]:::core
        Core_CLI["CLI (cli.py)"]:::core
        Core_Tests["Core Tests"]:::test
        Core_Lib --> Core_Headers
        Core_Lib --> Core_Source
        Core_Lib --> Core_CMakeLists
        Core_Lib --> Core_CMakePresets
        Core_Lib --> Core_Bindings
        Core_Lib --> Core_CLI
        Core_Tests --> Core_Lib
    end

    FE_App ---|"HTTP_Request"| API_Server
    API_Server ---|"LibraryCall"| Core_Lib

    %% Click Events for Frontend Layer
    click FE_Frontend "https://github.com/arrowpc/palettum/tree/master/apps/frontend"
    click FE_App "https://github.com/arrowpc/palettum/tree/master/apps/frontend/src"
    click FE_Docker "https://github.com/arrowpc/palettum/tree/master/apps/frontend/Dockerfile"
    click FE_Vite "https://github.com/arrowpc/palettum/blob/master/vite.config.ts"

    %% Click Events for API Layer
    click API_Server "https://github.com/arrowpc/palettum/tree/master/apps/api"
    click API_Routes "https://github.com/arrowpc/palettum/blob/master/apps/api/app/routes.py"
    click API_Auth "https://github.com/arrowpc/palettum/blob/master/apps/api/app/auth.py"
    click API_Tests "https://github.com/arrowpc/palettum/tree/master/apps/api/tests"

    %% Click Events for Core Library Layer
    click Core_Lib "https://github.com/arrowpc/palettum/tree/master/apps/core"
    click Core_Headers "https://github.com/arrowpc/palettum/tree/master/apps/core/include"
    click Core_Source "https://github.com/arrowpc/palettum/tree/master/apps/core/src"
    click Core_CMakeLists "https://github.com/arrowpc/palettum/blob/master/apps/core/CMakeLists.txt"
    click Core_CMakePresets "https://github.com/arrowpc/palettum/blob/master/apps/core/CMakePresets.json"
    click Core_Bindings "https://github.com/arrowpc/palettum/blob/master/apps/core/src/bindings.cpp"
    click Core_CLI "https://github.com/arrowpc/palettum/blob/master/apps/core/src/palettum/cli.py"
    click Core_Tests "https://github.com/arrowpc/palettum/tree/master/apps/core/tests"

    %% Styles
    classDef frontend fill:#b3e5fc,stroke:#0288d1,stroke-width:2px;
    classDef api fill:#ffecb3,stroke:#ff9800,stroke-width:2px;
    classDef core fill:#ffcdd2,stroke:#e57373,stroke-width:2px;
    classDef test fill:#dcedc8,stroke:#8bc34a,stroke-width:2px;
```
