# robjtede/actix-web-lab architecture

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

- Interactive diagram: https://gitdiagram.com/robjtede/actix-web-lab
- Repository: https://github.com/robjtede/actix-web-lab

## Overview

##### Main Components

a) Core Components:
- actix-web-lab (Main Package)
- actix-client-ip-cloudflare
- actix-hash
- actix-web-lab-derive
- russe (Server-Sent Events implementation)

**┌─────────────────────────────────────────────┐**
- actix-web-lab                   │
- ┌─────────────┐ ┌─────────────┐           │
- Middleware │ │  Extractors │           │
- ┘ └─────────────┘           │
- ┌─────────────┐ ┌─────────────┐           │
- Bodies    │ │  Responses  │           │
- ┘ └─────────────┘           │
- ┘

**┌─────────────────┐ ┌─────────────────┐ ┌─────────┐**
- IP Cloudflare   │ │    actix-hash   │ │  russe  │
- Module       │ │     Module      │ │  (SSE)  │
- ┘ └─────────────────┘ └─────────┘

##### Component Relationships

- Double lines for derive macro relationships

##### Implementation Details

a) Main Features:
- Body transformations
- SSE support
- CBOR/JSON/MessagePack handlers
- Middleware components
- Security features

b) Integration Points:
- Cloudflare IP detection
- Hash verification
- Custom extractors

##### Technical Notes

A section showing:
- Supported Rust versions
- Actix-web compatibility
- External dependencies

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core Framework"]
        Main["actix-web-lab"]:::core
        Derive["Derive Macros"]:::core
    end

    subgraph Middleware["Middleware Layer"]
        MW_Base["Base Middleware"]:::middleware
        MW_RespMap["Response Mapping"]:::middleware
        MW_BodyMap["Body Mapping"]:::middleware
    end

    subgraph Bodies["Body Handlers"]
        Body_Main["Main Body"]:::body
        Body_AsyncWrite["Async Write"]:::body
        Body_Channel["Channel"]:::body
        Body_Limits["Limits"]:::body
    end

    subgraph Formats["Data Formats"]
        JSON["JSON"]:::format
        CBOR["CBOR"]:::format
        MsgPack["MessagePack"]:::format
        NDJSON["NDJSON"]:::format
        CSV["CSV"]:::format
    end

    subgraph Security["Security Components"]
        ReqSig["Request Signatures"]:::security
        Hash["actix-hash"]:::security
        CF_IP["Cloudflare IP Detection"]:::security
    end

    subgraph SSE["Server-Sent Events"]
        SSE_FW["Framework SSE"]:::sse
        SSE_Standalone["russe"]:::sse
    end

    subgraph Extractors["Data Extraction"]
        Ex_Main["Main Extractors"]:::extractor
        Ex_Query["Query Handling"]:::extractor
        Ex_Path["Path Handling"]:::extractor
    end

    subgraph Response["Response Handlers"]
        Resp_Core["Response Core"]:::response
        Resp_SPA["SPA Handler"]:::response
        subgraph Redirects["Redirect Handlers"]
            Red_HTTPS["HTTPS Redirect"]:::response
            Red_WWW["WWW Redirect"]:::response
            Red_NonWWW["Non-WWW Redirect"]:::response
        end
    end

    subgraph Testing["Testing Utilities"]
        Test_Main["Main Test Utils"]:::testing
        Test_Header["Header Macros"]:::testing
        Test_Req["Request Macros"]:::testing
        Test_Resp["Response Macros"]:::testing
    end

    Main --> MW_Base
    Main --> Body_Main
    Main --> Resp_Core
    Main --> Ex_Main
    
    SSE_FW --> SSE_Standalone
    
    classDef core fill:#3498db
    classDef middleware fill:#2ecc71
    classDef body fill:#e74c3c
    classDef format fill:#f1c40f
    classDef security fill:#9b59b6
    classDef sse fill:#e67e22
    classDef extractor fill:#1abc9c
    classDef response fill:#34495e
    classDef testing fill:#95a5a6

    click Main "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/lib.rs"
    click MW_Base "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/middleware.rs"
    click MW_RespMap "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/middleware_map_response.rs"
    click MW_BodyMap "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/middleware_map_response_body.rs"
    click Body_Main "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/body.rs"
    click Body_AsyncWrite "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/body_async_write.rs"
    click Body_Channel "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/body_channel.rs"
    click Body_Limits "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/body_limit.rs"
    click JSON "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/json.rs"
    click CBOR "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/cbor.rs"
    click MsgPack "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/msgpack.rs"
    click NDJSON "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/ndjson.rs"
    click CSV "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/csv.rs"
    click ReqSig "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/request_signature.rs"
    click Hash "https://github.com/robjtede/actix-web-lab/blob/main/actix-hash/src/lib.rs"
    click CF_IP "https://github.com/robjtede/actix-web-lab/blob/main/actix-client-ip-cloudflare/src/lib.rs"
    click SSE_FW "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/sse.rs"
    click SSE_Standalone "https://github.com/robjtede/actix-web-lab/blob/main/russe/src/lib.rs"
    click Derive "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab-derive/src/lib.rs"
    click Ex_Main "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/extract.rs"
    click Ex_Query "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/query.rs"
    click Ex_Path "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/path.rs"
    click Resp_Core "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/respond.rs"
    click Resp_SPA "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/spa.rs"
    click Red_HTTPS "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/redirect_to_https.rs"
    click Red_WWW "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/redirect_to_www.rs"
    click Red_NonWWW "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/redirect_to_non_www.rs"
    click Test_Main "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/test.rs"
    click Test_Header "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/test_header_macros.rs"
    click Test_Req "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/test_request_macros.rs"
    click Test_Resp "https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/src/test_response_macros.rs"
```
