# openas2/openas2app architecture

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

- Interactive diagram: https://gitdiagram.com/openas2/openas2app
- Repository: https://github.com/openas2/openas2app

## Overview

##### Main Components
- Server Core: The “Server” directory contains the backbone of the application. This encompasses the Java source files (under org/openas2) that implement message processing, command handling, certificate management, partner configuration, sender/receiver modules, scheduling, logging, and database tracking. It also includes build scripts, configuration files (e.g., config.xml, partnerships.xml), and scripts for interacting with the database.
- Bundle/OSGi Module: The “Bundle” directory provides additional modular OSGi-based components that integrate with the core server and provide extension points.
- WebUI: The “WebUI” directory demonstrates that there is a separate front-end component built in JavaScript (using Vue.js, Vuetify, and other modern web development tools). The WebUI offers a configuration interface and, through API calls, interacts with the server.
- Docker & Deployment: Dockerfiles (Dockerfile and Dockerfile_WebUI) and docker-compose.yml indicate containerized deployment. This implies that the system can be deployed as separate containers (one for the server and one for the WebUI) and orchestrated together.
- Build & Test Infrastructure: Maven is used for building, testing, and packaging the server components. There are pom.xml files in both the Server and Bundle directories along with shell scripts and test directories that define the unit tests and database setup.

##### Relationships and Data Flow
- The Server component is at the heart of the application. Show how it interacts with:
– External systems such as trading partner systems via the AS2 protocols.
– A database layer (with deployment scripts for H2 or PostgreSQL) for storing partner data, configurations, and message tracking.
- Build process (Maven) as a supporting component that packages the application into a deployable jar/binary distribution; you could annotate this on the side.

##### Architectural Patterns and Technologies
- The application is built using a modular design (as seen by the separation into distinct Java packages for commands, certs, message processing, etc.). Emphasize that the design follows separation of concerns.
- The system uses Maven as its dependency and build manager and OSGi principles for modularity (Bundle directory).
- The WebUI is built using modern JavaScript frameworks (Vue.js) and employs an API-based communication model.
- The Docker support and the provided docker-compose file point toward containerization and microservice-based deployment patterns—the backend server and the UI run in separate containers.
- The use of REST APIs, as well as scripting for dynamic configuration via environment variables, should be illustrated.

## Diagram (Mermaid)

```mermaid
graph TD
    External["Trading Partners"]:::external
    Database["Database"]:::database
    MavenGlobal["Maven Build & Test Infrastructure"]:::build
    DockerDeploy["Docker & Deployment"]:::deployment

    subgraph "Docker Container: OpenAS2 Server"
        AS2["AS2 Core Server"]:::backend
        Bundle["Bundle/OSGi Module"]:::backend
        APIGate["API Gateway/REST Endpoints"]:::api
    end

    subgraph "Docker Container: WebUI"
        WebUI["WebUI Frontend"]:::frontend
    end

    External -->|"sendsEDI"| AS2
    AS2 -->|"integrates"| Bundle
    AS2 -->|"exposesAPI"| APIGate
    APIGate <-->|"APIcalls"| WebUI
    WebUI -->|"callsConfigAPI"| APIGate
    AS2 -->|"logsMessage"| Database

    MavenGlobal -->|"builds"| DockerDeploy
    DockerDeploy -->|"deploys"| AS2
    DockerDeploy -->|"deploys"| Bundle
    DockerDeploy -->|"deploys"| WebUI

    click AS2 "https://github.com/openas2/openas2app/tree/master/Server/src/main/java/org/openas2" "Go to AS2 Core Server source"
    click Bundle "https://github.com/openas2/openas2app/tree/master/Bundle/src/main/java/org/openas2/osgi" "Go to Bundle/OSGi Module source"
    click WebUI "https://github.com/openas2/openas2app/tree/master/WebUI/src" "Go to WebUI Frontend source"
    click DockerDeploy "https://github.com/openas2/openas2app/tree/master/Dockerfile" "Go to Docker & Deployment files"
    click MavenGlobal "https://github.com/openas2/openas2app/blob/master/.mvn" "Go to Maven Build & Test Infrastructure directory"

    classDef backend fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
    classDef frontend fill:#AED6F1,stroke:#2874A6,stroke-width:2px;
    classDef build fill:#D7BDE2,stroke:#8E44AD,stroke-width:2px;
    classDef api fill:#ABEBC6,stroke:#27AE60,stroke-width:2px;
    classDef database fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#E74C3C,stroke-width:2px;
    classDef deployment fill:#D5F5E3,stroke:#52BE80,stroke-width:2px;
```
