# digitalservicebund/ris-norms architecture

> Architecture diagram of the GitHub repository digitalservicebund/ris-norms, 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/ris-norms
- Repository: https://github.com/digitalservicebund/ris-norms

## Overview

##### Main Components and Architecture
The system follows a hexagonal architecture (as mentioned in ADR 0005) with these key components:

a. Frontend Layer:
- Vue.js-based web application
- Components for law editing, metadata management, and document viewing
- Client-side services for API communication
- End-to-end testing with Playwright

b. Backend Layer:
- Java 21 Spring Boot application
- Hexagonal architecture with:
- Input ports (REST API controllers)
- Application core (services and domain logic)
- Output ports (database and S3 storage)
- XML processing capabilities for LegalDocML.de format

c. Data Storage:
- PostgreSQL database
- S3 storage for document management
- Schema validation system for LegalDocML.de

##### Integration Points
- REST API communication between frontend and backend
- Database interactions for norm storage
- S3 bucket integration for document storage
- Monitoring with Prometheus and Grafana

##### User Interface Layer (Top)
- Main views (amending-law, affected-documents, etc.)
- Client-side services

##### API Gateway Layer
- REST API endpoints
- Security and session management
- Validation components

##### Application Core (Middle)
- Hexagonal architecture
- Domain services and use cases
- XML processing components

##### Persistence Layer (Bottom)
- Database connections
- S3 storage integration
- Document management system

Use these visual elements:
- Red lines for security boundaries

- Security boundaries
- Integration points

Key Architectural Patterns to Highlight:
##### Monitoring and observability

- Clear separation of concerns
- Security boundaries
- Data flow patterns
- Integration points
- Scalability considerations

Remember to include:
##### External system interfaces

This will provide a comprehensive view of the RIS Norms system while maintaining clarity and usefulness for the principal software engineer.

## Diagram (Mermaid)

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

    %% Frontend Layer
    subgraph Frontend
        UI[Vue.js Frontend]:::frontend
        Views[Views]:::frontend
        Components[Components]:::frontend
        ClientServices[Client Services]:::frontend
        E2ETests[E2E Tests]:::frontend
    end

    %% API Gateway Layer
    subgraph APIGateway
        REST[REST Controllers]:::api
        Security[Security Layer]:::api
        Validation[Validation]:::api
    end

    %% Backend Core
    subgraph ApplicationCore
        CoreServices[Core Services]:::backend
        DomainEntities[Domain Entities]:::backend
        XMLProcessor[XML Processor]:::backend
        Scheduler[Scheduler]:::backend
    end

    %% Storage Layer
    subgraph Storage
        PostgreSQL[(PostgreSQL)]:::storage
        S3[(S3 Storage)]:::storage
        XMLSchema[XML Schema]:::storage
    end

    %% Monitoring
    subgraph Monitoring
        Prometheus[Prometheus]:::monitoring
        Grafana[Grafana]:::monitoring
    end

    %% Relationships
    UI --> Views
    UI --> Components
    UI --> ClientServices
    E2ETests --> UI
    ClientServices --> REST
    REST --> Security
    REST --> Validation
    Security --> CoreServices
    Validation --> CoreServices
    CoreServices --> DomainEntities
    CoreServices --> XMLProcessor
    Scheduler --> CoreServices
    CoreServices --> PostgreSQL
    CoreServices --> S3
    XMLProcessor --> XMLSchema
    PostgreSQL --> Prometheus
    S3 --> Prometheus
    Prometheus --> Grafana

    %% Click events
    click Views "https://github.com/digitalservicebund/ris-norms/tree/main/frontend/src/views"
    click Components "https://github.com/digitalservicebund/ris-norms/tree/main/frontend/src/components"
    click ClientServices "https://github.com/digitalservicebund/ris-norms/tree/main/frontend/src/services"
    click E2ETests "https://github.com/digitalservicebund/ris-norms/tree/main/frontend/e2e"
    click REST "https://github.com/digitalservicebund/ris-norms/tree/main/backend/src/main/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/controller"
    click Scheduler "https://github.com/digitalservicebund/ris-norms/tree/main/backend/src/main/java/de/bund/digitalservice/ris/norms/adapter/input/scheduler"
    click CoreServices "https://github.com/digitalservicebund/ris-norms/tree/main/backend/src/main/java/de/bund/digitalservice/ris/norms/application/service"
    click DomainEntities "https://github.com/digitalservicebund/ris-norms/tree/main/backend/src/main/java/de/bund/digitalservice/ris/norms/domain/entity"
    click PostgreSQL "https://github.com/digitalservicebund/ris-norms/tree/main/backend/src/main/java/de/bund/digitalservice/ris/norms/adapter/output/database"
    click S3 "https://github.com/digitalservicebund/ris-norms/tree/main/backend/src/main/java/de/bund/digitalservice/ris/norms/adapter/output/s3"
    click XMLSchema "https://github.com/digitalservicebund/ris-norms/tree/main/LegalDocML.de/1.7.1/schema"
    click Prometheus "https://github.com/digitalservicebund/ris-norms/tree/main/monitoring/prometheus"
    click Grafana "https://github.com/digitalservicebund/ris-norms/tree/main/monitoring/grafana"

    %% Legend
    subgraph Legend
        Frontend_L[Frontend Components]:::frontend
        Backend_L[Backend Services]:::backend
        Storage_L[Storage Systems]:::storage
        API_L[API Components]:::api
        Monitoring_L[Monitoring Tools]:::monitoring
    end
```
