# azimuttapp/azimutt architecture

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

- Interactive diagram: https://gitdiagram.com/azimuttapp/azimutt
- Repository: https://github.com/azimuttapp/azimutt

## Overview

##### Main Components
- Backend Server (Elixir/Phoenix):
– Located in the “backend” directory.
– Implements MVC architecture with controllers, views, models/schemas (accounts, organizations, projects, etc.), business logic, and service integrations (e.g., GitHub, Stripe, Heroku, etc.).
– Includes APIs (see the API controllers and fallback controllers) and an admin interface.
- Frontend Application (Elm + elm-spa):
– Found in the “frontend” directory.
– Organized into Pages, Components (Atoms, Molecules, Organisms), Services, Models, and DataSources.
– Built with Elm, it handles user interaction in the browser.
- Gateway (TypeScript):
– Located in the “gateway” directory.
– Acts as an API layer or aggregator that handles routing and indexing (written in TypeScript, using Node ecosystem).
- CLI Tools and Extensions:
– The “cli” directory holds command-line tools for analysis (including a report generator and other utilities).
– The “extensions” directory includes subprojects for browser, desktop, and VSCode integrations that extend Azimutt’s functionality.
- Libraries & Connectors (Reusable Modules):
- AML (a custom language for schema design)
- Connectors for various databases (BigQuery, Couchbase, MariaDB, MongoDB, MySQL, Oracle, PostgreSQL, Snowflake, SQL Server)
- Parsers (DBML, Prisma, SQL, etc.)
- Utility libraries for common functions, logging, error handling, and JSON processing.

##### Relationships and Interactions
- The End Users (or database administrators/designers) interact with the Frontend (the Elm SPA) via a web browser.
- The Frontend communicates (through RESTful APIs and ports) with the Backend, either directly or via the Gateway if an API Aggregator pattern is in use.
- The Backend handles requests, performs database operations (using PostgreSQL as seen in the Docker/Postgres config files, and the “structure.sql” seed file), and calls out to external services (e.g., for notifications, analytics, or integration with third-party platforms).
- The Gateway (written in TypeScript) might serve as a lightweight proxy or central point for routing API calls from the frontend to the backend.
- The Libraries provide helper functions and connector logic to support the parsing, analyzing, and converting of database schemas, which are used within the Backend and CLI processes.
- CLI, demos, and Extensions serve both as developer tools and alternative interfaces to interact with Azimutt functionality externally.

##### Architectural Patterns and Design Principles
- Use of MVC for the backend (Phoenix controllers, views, and models)
- Separation of concerns between user presentation (Elm SPA frontend) and business logic (Elixir backend and TypeScript gateway)
- Modular design: libraries and connectors are separated to allow reuse, testing, and independent deployment of components (for example, different parsers and connectors handle different database types)
- Containerization and cloud deployment: Dockerfiles, Kubernetes charts (in “charts/azimutt”), and Heroku-specific files indicate a modern containerized architecture
- Microservices elements: Although the backend is a Phoenix application, the presence of a dedicated “gateway” directory and several extensions (CLI and desktop) suggests that Azimutt follows a loosely coupled approach in offering alternate access and integrations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User (Admin/Designer)"]:::user
    FE["Frontend (Elm SPA)"]:::frontend
    GW["API Gateway (TypeScript)"]:::gateway
    BE["Backend (Phoenix MVC)"]:::backend
    DB["Database (PostgreSQL)"]:::database
    CLI["CLI Tools"]:::cli
    EXT["Extensions (Browser, Desktop, VSCode)"]:::extensions
    LIB["Libraries & Connectors"]:::libraries
    EXTSVC["External Services (Stripe,Heroku,Sentry)"]:::external

    User -->|"interacts"| FE
    FE -->|"API-calls"| GW
    GW -->|"routes"| BE
    BE -->|"CRUD_ops"| DB
    BE -->|"integrates"| EXTSVC
    BE -->|"utilizes"| LIB
    CLI -->|"commands"| BE
    CLI -->|"utilizes"| LIB
    EXT -->|"interfaces_with"| BE

    click FE "https://github.com/azimuttapp/azimutt/tree/main/frontend"
    click BE "https://github.com/azimuttapp/azimutt/tree/main/backend"
    click GW "https://github.com/azimuttapp/azimutt/tree/main/gateway"
    click CLI "https://github.com/azimuttapp/azimutt/tree/main/cli"
    click EXT "https://github.com/azimuttapp/azimutt/tree/main/extensions"
    click LIB "https://github.com/azimuttapp/azimutt/tree/main/libs"

    classDef user fill:#AED6F1,stroke:#1B4F72,stroke-width:2px
    classDef frontend fill:#E8F6F3,stroke:#117864,stroke-width:2px
    classDef gateway fill:#D2B4DE,stroke:#6C3483,stroke-width:2px
    classDef backend fill:#F9E79F,stroke:#B7950B,stroke-width:2px
    classDef database fill:#FAD7A0,stroke:#A04000,stroke-width:2px
    classDef cli fill:#F5CBA7,stroke:#D35400,stroke-width:2px
    classDef extensions fill:#D6EAF8,stroke:#2E86C1,stroke-width:2px
    classDef libraries fill:#D5F5E3,stroke:#28B463,stroke-width:2px
    classDef external fill:#F1948A,stroke:#922B21,stroke-width:2px
```
