# miguelsmuller/lumi-invoice-challenge architecture

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

- Interactive diagram: https://gitdiagram.com/miguelsmuller/lumi-invoice-challenge
- Repository: https://github.com/miguelsmuller/lumi-invoice-challenge

## Overview

##### Main Components
- Frontend: Represent this with the “Invoice Front” service (submodule: lumi-front), which handles the user interface for listing and managing transactions.
- Backend: Represent the “Invoice Back” service (submodule: lumi-back) that interfaces with the Invoice API and implements business logic.
- Database: Include the PostgreSQL service (named lumi-db) defined in docker-compose.yml, which serves as the system’s data store.
- Extraction Module: Add a component (from the lumi-extraction submodule) likely responsible for parsing, extracting, and managing invoice-related data.
- Supporting Infrastructure: Mark the Docker environment that orchestrates these containers and any helper scripts (Makefile for starting services).

##### Relationships and Interactions
- That the Invoice Back service interacts with the PostgreSQL database (with connection details such as host, port, and credentials as set in docker-compose).
- If applicable, show the extraction service interacting with the Invoice Back service or handling the data before it gets stored or displayed.
- Optionally, highlight that the Makefile serves as the entry point for developers, triggering docker-compose commands that start all these containers.

##### Architectural Patterns
- This project follows a microservices or containerized architecture, where multiple standalone services (frontend, backend, database) are deployed via Docker.
- The separation of concerns is clear—each service is encapsulated in its own submodule and container.
- The use of a monorepo with Git submodules emphasizes centralized version control and coordinated development across project parts.

##### Technologies and Tools
- Docker & Docker Compose: Emphasize container orchestration and service isolation.
- PostgreSQL: Clearly label it for the database service.
- Git Submodules: Note the project uses submodules for lumi-back, lumi-front, and lumi-extraction, which helps maintain clean boundaries between the codebases.
- Makefile: Show its role in streamlining service startups and common development tasks.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global utility nodes
    MF("Makefile"):::utility
    DC("Docker Compose"):::container
    DOC("Documentation (Sample PDF Invoices)"):::documentation

    %% Connections from Makefile to Docker Compose
    MF -->|"triggers"| DC

    %% Docker Environment Subgraph
    subgraph "Docker Environment"
        F("Invoice Front (UI)"):::frontend
        B("Invoice Back (API)"):::backend
        DB("PostgreSQL (lumi-db)"):::database
        E("Lumi Extraction"):::extraction
    end

    %% Docker Compose starts services
    DC -->|"starts"| F
    DC -->|"starts"| B
    DC -->|"starts"| DB
    DC -->|"starts"| E

    %% Inter-service relationships
    F -->|"calls"| B
    B -->|"queries"| DB
    E -->|"processes"| B

    %% Click Events
    click F "https://github.com/miguelsmuller/lumi-invoice-challenge/tree/main/lumi-front"
    click B "https://github.com/miguelsmuller/lumi-invoice-challenge/tree/main/lumi-back"
    click DB "https://github.com/miguelsmuller/lumi-invoice-challenge/blob/main/docker-compose.yml"
    click E "https://github.com/miguelsmuller/lumi-invoice-challenge/tree/main/lumi-extraction"
    click DOC "https://github.com/miguelsmuller/lumi-invoice-challenge/tree/main/docs/FATURAS"
    click MF "https://github.com/miguelsmuller/lumi-invoice-challenge/tree/main/Makefile"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef backend fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef database fill:#fff9c4,stroke:#f57f17,stroke-width:2px;
    classDef extraction fill:#f8bbd0,stroke:#ad1457,stroke-width:2px;
    classDef container fill:#e0e0e0,stroke:#424242,stroke-width:2px;
    classDef utility fill:#d7ccc8,stroke:#3e2723,stroke-width:2px;
    classDef documentation fill:#ffe0b2,stroke:#ef6c00,stroke-width:2px;
```
