# fristi/itinere architecture

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

- Interactive diagram: https://gitdiagram.com/fristi/itinere
- Repository: https://github.com/fristi/itinere

## Overview

##### Main Components

a. Core Module (Primary)
- Represents the fundamental abstractions (HttpEndpointAlgebra, JsonAlgebra, etc.)
- Contains the main DSL definitions

b. Integration Modules (Secondary)
- Http4s Server Implementation
- Circe JSON Integration
- OpenAPI Generation
- Refined Type Integration

##### Component Relationships

**┌─────────────────────────────────────────────────────┐**
- Client Applications                │
- ┬─────────────────────────┘
- ↓
**┌─────────────────────────────────────────────────────┐**
- Http4s Server Layer               │
- (http4s-server module - HTTP server implementation)│
- ┬─────────────────────────┘
- ↓
**┌─────────────────────────────────────────────────────┐**
- Core Module                      │
- HTTP Endpoint Algebra                          │
- JSON Algebra                                   │
- Type Definitions                               │
- ┬─────────────────┬──────────────┬─────────┘
- ↓                 ↓              ↓
**┌─────────────────┐ ┌─────────────┐ ┌──────────────┐**
- Circe Module   │ │ OpenAPI Gen │ │    Refined   │
- (JSON Codec)   │ │  (Docs Gen) │ │    Types     │
- ┘ └─────────────┘ └──────────────┘

##### Specific Elements

a. Core Components:
- HttpEndpointAlgebra (central component)
- JsonAlgebra (core JSON abstraction)
- Type System (Primitives, Types)
- Attempt (error handling)

b. Integration Points:
- Http4s Server Integration
- Circe JSON Integration
- OpenAPI Documentation Generation
- Refined Type System Integration

##### Implementation Details Level

Show:
- Major interfaces and type classes
- Primary data transformation flows
- Integration boundaries
- Extension points

##### The transformation pipeline from DSL to concrete implementations

Keep the focus on the architectural boundaries between modules while showing how the DSL flows through the system from definition to concrete implementation in HTTP services.

This approach will give a clear picture of how the EDSL is structured and how it can be extended or integrated with other systems.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Applications"]
        ClientApp[Client Application]
    end

    subgraph Http4s["Http4s Server Layer"]
        Http4sServer["Http4s Server Implementation"]:::http4s
    end

    subgraph Core["Core Module"]
        HttpEndpoint["HTTP Endpoint Algebra"]:::core
        JsonAlgebra["JSON Algebra"]:::core
        TypeSystem["Type System"]:::core
        ErrorHandling["Error Handling (Attempt)"]:::core
        HttpEntities["HTTP Entities"]:::core
        Primitives["Primitives"]:::core
    end

    subgraph Integrations["Integration Modules"]
        direction TB
        CirceJson["Circe JSON Integration"]:::integration
        OpenApiGen["OpenAPI Documentation Generator"]:::integration
        RefinedTypes["Refined Type Integration"]:::integration
    end

    %% Relationships
    ClientApp --> Http4sServer
    Http4sServer --> HttpEndpoint
    HttpEndpoint --> JsonAlgebra
    HttpEndpoint --> TypeSystem
    HttpEndpoint --> ErrorHandling
    HttpEndpoint --> HttpEntities
    TypeSystem --> Primitives
    JsonAlgebra --> CirceJson
    HttpEndpoint --> OpenApiGen
    TypeSystem --> RefinedTypes

    %% Click Events
    click HttpEndpoint "https://github.com/Fristi/itinere/blob/master//core/src/main/scala/itinere/HttpEndpointAlgebra.scala"
    click JsonAlgebra "https://github.com/Fristi/itinere/blob/master//core/src/main/scala/itinere/JsonAlgebra.scala"
    click TypeSystem "https://github.com/Fristi/itinere/blob/master//core/src/main/scala/itinere/Types.scala"
    click ErrorHandling "https://github.com/Fristi/itinere/blob/master//core/src/main/scala/itinere/Attempt.scala"
    click Http4sServer "https://github.com/Fristi/itinere/blob/master//http4s-server/src/main/scala/itinere/http4s_server/Http4sServer.scala"
    click CirceJson "https://github.com/Fristi/itinere/blob/master//circe/src/main/scala/itinere/circe/CirceJsonLike.scala"
    click OpenApiGen "https://github.com/Fristi/itinere/blob/master//open-api/src/main/scala/itinere/openapi/OpenApiGen.scala"
    click RefinedTypes "https://github.com/Fristi/itinere/blob/master//refined/src/main/scala/itinere/refined/package.scala"
    click HttpEntities "https://github.com/Fristi/itinere/blob/master//core/src/main/scala/itinere/HttpEntities.scala"
    click Primitives "https://github.com/Fristi/itinere/blob/master//core/src/main/scala/itinere/Primitives.scala"

    %% Styling
    classDef core fill:#2b5797,stroke:#fff,stroke-width:2px,color:#fff
    classDef http4s fill:#00a1f1,stroke:#fff,stroke-width:2px,color:#fff
    classDef integration fill:#7fba00,stroke:#fff,stroke-width:2px,color:#fff

    %% Legend
    subgraph Legend
        CoreLegend["Core Component"]:::core
        Http4sLegend["Http4s Component"]:::http4s
        IntegrationLegend["Integration Component"]:::integration
    end
```
