# digitalservicebund/a2j-rechtsantragstelle architecture

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

- Interactive diagram: https://gitdiagram.com/digitalservicebund/a2j-rechtsantragstelle
- Repository: https://github.com/digitalservicebund/a2j-rechtsantragstelle

## Overview

##### Main System Components

a. Frontend Layer:
- Remix application components (/app/components)
- Domain-specific form flows
- Storybook UI component library
- Client-side validation and state management

b. Backend Layer:
- Express.js server
- Redis session storage
- PDF generation service
- CMS integration (Strapi)
- Security services

c. External Services:
- Strapi CMS (with staging/production environments)
- PostHog analytics
- Docker containerization
- Court finder service

**┌─ Client Layer ─────────────────────────────────────┐**
- React Components | Form Flows | Client Validation   │
- ┘
- ↕ HTTP/REST
**┌─ Application Layer ────────────────────────────────┐**
- Remix Server | Route Handlers | Session Management │
- ┘
- ↕ Internal Services
**┌─ Service Layer ──────────────────────────────────────┐**
- PDF Generator | CMS Service | Security | Validation  │
- ┘
- ↕ External APIs
**┌─ External Services ────────────────────────────────┐**
- Strapi CMS | Redis | PostHog | Docker Registry    │
- ┘

##### Key Interactions to Highlight

a. Form Flow Processing:
- Path from client input through validation to session storage
- PDF generation flow
- Data persistence and state management

b. CMS Integration:
- Dual-environment setup (staging/production)
- Content delivery pipeline
- Locale handling (sg/de)

c. Security Layer:
- CSRF protection
- Rate limiting
- Cookie management
- Sanitization services

##### Additional Details

Specific annotations for:
- Domain-specific flows (Beratungshilfe, Fluggastrechte, etc.)
- Test coverage points (E2E, unit tests)
- Deployment pipelines
- Feature flag management
- Error handling paths

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef security fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#e74c3c,stroke:#c0392b,color:white
    classDef service fill:#9b59b6,stroke:#8e44ad,color:white

    %% Client Layer
    subgraph ClientLayer
        FE[Frontend Components]:::frontend
        FC[Form Components]:::frontend
        IC[Input Components]:::frontend
        SC[Story Components]:::frontend
    end

    %% Domain Layer
    subgraph DomainLayer
        BH[Beratungshilfe Flow]:::frontend
        FG[Fluggastrechte Flow]:::frontend
        PK[Prozesskostenhilfe Flow]:::frontend
    end

    %% Application Layer
    subgraph AppLayer
        EX[Express Server]:::backend
        SM[Session Management]:::backend
        FV[Form Validation]:::backend
        FC_[Flow Controller]:::backend
    end

    %% Security Layer
    subgraph SecurityLayer
        CSRF[CSRF Protection]:::security
        RL[Rate Limiting]:::security
        SH[Security Headers]:::security
    end

    %% Service Layer
    subgraph ServiceLayer
        PDF[PDF Generator]:::service
        CMS[CMS Service]:::service
        CF[Court Finder]:::service
        AN[Analytics]:::service
    end

    %% External Layer
    subgraph ExternalLayer
        RD[Redis]:::external
        ST[Strapi CMS]:::external
        PH[PostHog]:::external
    end

    %% Relationships
    ClientLayer --> AppLayer
    DomainLayer --> AppLayer
    AppLayer --> SecurityLayer
    SecurityLayer --> ServiceLayer
    ServiceLayer --> ExternalLayer

    %% Click events
    click FE "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/components/"
    click FC "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/components/form/"
    click IC "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/components/inputs/"
    click SC "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/stories/"
    click BH "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/domains/beratungshilfe/"
    click FG "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/domains/fluggastrechte/"
    click PK "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/domains/prozesskostenhilfe/"
    click EX "https://github.com/digitalservicebund/a2j-rechtsantragstelle/blob/main/app/expressApp.ts"
    click SM "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/services/session.server/"
    click FV "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/services/validation/"
    click CSRF "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/services/security/csrf/"
    click RL "https://github.com/digitalservicebund/a2j-rechtsantragstelle/blob/main/app/services/rateLimit.ts"
    click SH "https://github.com/digitalservicebund/a2j-rechtsantragstelle/blob/main/app/services/security/cspHeader.server.tsx"
    click PDF "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/services/pdf/"
    click CMS "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/services/cms/"
    click CF "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/services/gerichtsfinder/"
    click AN "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/services/analytics/"
    click FC_ "https://github.com/digitalservicebund/a2j-rechtsantragstelle/tree/main/app/services/flow/"
```
