# vandot/lodev architecture

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

- Interactive diagram: https://gitdiagram.com/vandot/lodev
- Repository: https://github.com/vandot/lodev

## Overview

##### Main Components

a) Client Layer:
- Web Browsers (Firefox, Chrome, etc.)
- Mobile Devices (iOS/Android)

b) lodev Core Components:
- HTTPS Server (SSL Termination)
- Reverse Proxy
- Certificate Management
- DNS Resolution

c) Dependencies:
- locert (Certificate Generation)
- lodns (DNS Resolution)

d) Target Services:
- Local Development Server (default: http://127.0.0.1:3000)

**[Client Layer] → [HTTPS (443)] → [lodev] → [Local Dev Server]**

##### Detailed Component Breakdown

a) Setup Flow:
- Certificate generation and installation process
- DNS configuration flow
- System integration points

b) Request Flow:
- HTTPS traffic handling
- SSL termination
- Proxy forwarding

c) Management Flow:
- Installation/uninstallation processes
- Configuration management

##### Key Relationships to Highlight

- SSL termination point
- DNS resolution path (*.dev.lo or {COMPUTER_NAME}.local)
- Proxy forwarding rules
- Certificate authority trust chain

##### Implementation Details

- httpserver.nim: HTTPS server implementation
- proxy.nim: Reverse proxy logic
- helpers.nim: Utility functions

##### Bottom Level: Show target services and system integration

Keep the following aspects in mind:
- Security boundaries
- Network paths
- Configuration points
- Platform-specific elements

- User-facing components
- Core proxy functionality
- System integration points

This will provide a comprehensive view of the system while maintaining clarity about the project's primary purpose as a development tool for SSL termination and reverse proxying.

Remember to include a note about Firefox compatibility on Linux (current limitation) and the special requirements for port 443 binding (CAP_NET_BIND_SERVICE on Linux).

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph Clients
        Browser["Web Browsers"]
        Mobile["Mobile Devices"]
    end

    %% Core Components
    subgraph "lodev Core"
        HTTPS["HTTPS Server (443)"]:::ssl
        click HTTPS "https://github.com/vandot/lodev/blob/main/src/lodev/httpserver.nim"
        
        Proxy["Reverse Proxy"]:::proxy
        click Proxy "https://github.com/vandot/lodev/blob/main/src/lodev/proxy.nim"
        
        CertMgmt["Certificate Management"]
        
        DNS["DNS Resolution"]
        
        Helpers["Utility Functions"]:::util
        click Helpers "https://github.com/vandot/lodev/blob/main/src/lodev/helpers.nim"
        
        Main["Main Application"]:::main
        click Main "https://github.com/vandot/lodev/blob/main/src/lodev.nim"
    end

    %% Dependencies
    subgraph "External Dependencies"
        Locert["locert"]:::dep
        Lodns["lodns"]:::dep
    end

    %% Target Services
    subgraph "Development Environment"
        DevServer["Local Dev Server\n(127.0.0.1:3000)"]:::target
    end

    %% Installation and Configuration
    subgraph "System Configuration"
        Install["Installation Process"]:::config
        click Install "https://github.com/vandot/lodev/blob/main/install.sh"
        
        Package["Package Config"]:::config
        click Package "https://github.com/vandot/lodev/blob/main/lodev.nimble"
        
        Build["Build Config"]:::config
        click Build "https://github.com/vandot/lodev/blob/main/config.nims"
        
        Release["Release Process"]:::config
        click Release "https://github.com/vandot/lodev/blob/main/.github/workflows/release.yaml"
    end

    %% Relationships
    Browser --> |HTTPS| HTTPS
    Mobile --> |HTTPS| HTTPS
    HTTPS --> Proxy
    Proxy --> DevServer
    
    CertMgmt --> Locert
    DNS --> Lodns
    
    Helpers --> HTTPS
    Helpers --> Proxy
    Main --> HTTPS
    Main --> Proxy
    
    Install --> CertMgmt
    Package --> Build
    Build --> Main
    Release --> Package

    %% Styles
    classDef ssl fill:#90EE90,stroke:#333,stroke-width:2px
    classDef proxy fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef util fill:#F0F8FF,stroke:#333,stroke-width:2px
    classDef main fill:#4169E1,stroke:#333,stroke-width:2px,color:#fff
    classDef dep fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef target fill:#98FB98,stroke:#333,stroke-width:2px
    classDef config fill:#FFA500,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["SSL Components"]:::ssl
        L2["Proxy Components"]:::proxy
        L3["Utility Functions"]:::util
        L4["Main Application"]:::main
        L5["External Dependencies"]:::dep
        L6["Target Services"]:::target
        L7["Configuration"]:::config
    end
```
