# intellisoft-consulting/ssemr architecture

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

- Interactive diagram: https://gitdiagram.com/intellisoft-consulting/ssemr
- Repository: https://github.com/intellisoft-consulting/ssemr

## Overview

- Client / Browser: This represents the end-user accessing the OpenMRS application.
- Frontend Container: This is a simple nginx container embedding the SPA UI, configured with files in the frontend directory (e.g., nginx.conf, config.json, and build configuration files).
- Backend Container: The OpenMRS backend built from the main Dockerfile and augmented by the “distro” directory configurations. Label it clearly as the “backend” and note that it incorporates the Initializer metadata/configuration.
- Database (DB): Represent the MariaDB container (marked as “db” in the README, using the standard MariaDB image).

##### Relationships and Interactions
- A connection from the Backend container going to the DB container, indicating that the backend leverages the database for persistent storage.
- Optionally, if needed, illustrate the Docker Compose mechanism as an orchestration layer—this gives context on how these containers are managed and spun up together.

##### Architectural Patterns and Design Principles
- Containerization: The use of Docker images (Dockerfile, docker-compose files) indicates that each major component is isolated, making it easier to deploy, scale, and manage.
- Separation of Concerns: The architecture clearly distinguishes between the frontend UI, backend OpenMRS services, and database functionalities.
- Metadata Initialization: The backend incorporates an extensive configuration (from the distro folder using the Initializer module) that automatically sets up metadata and demo data. You might want to symbolically denote a “configuration module” or “metadata initializer” within the backend or as a sub-component.
- Reverse Proxy: Use of an nginx-based reverse proxy (gateway) helps in abstracting and securing the communication between the client and internal services.

##### Relevant Technologies and Frameworks
- Docker and Docker Compose as the foundation for container orchestration.
- That the frontend is built as a single-page application served with nginx.
- The backend is based on the core OpenMRS system and is enhanced with configuration from the distro folder.
- The project uses MariaDB as its database.
- Recognize the Initializer module as a crucial integration point for configuring metadata.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Client/Browser"]:::client
    B["Gateway (Reverse Proxy)"]:::container
    C["Frontend (nginx, SPA)"]:::container
    D["Backend (OpenMRS, Initializer)"]:::container
    E["MariaDB"]:::container
    I["Modules (OpenMRS Modules)"]:::modules

    A -->|"hits"| B
    B -->|"routes-to"| C
    B -->|"routes-to"| D
    D -->|"accesses"| E
    D -->|"includes"| I

    subgraph "Docker Compose Orchestration"
        F["docker-compose.yml"]:::orchestration
        G["docker-compose.override.yml"]:::orchestration
        H["docker-compose-no-volumes.yml"]:::orchestration
    end

    F --- B
    F --- C
    F --- D
    F --- E
    G --- B
    G --- C
    G --- D
    G --- E
    H --- B
    H --- C
    H --- D
    H --- E

    click B "https://github.com/intellisoft-consulting/ssemr/tree/main/gateway/"
    click C "https://github.com/intellisoft-consulting/ssemr/tree/main/frontend/"
    click D "https://github.com/intellisoft-consulting/ssemr/tree/main/distro/"
    click F "https://github.com/intellisoft-consulting/ssemr/blob/main/docker-compose.yml"
    click G "https://github.com/intellisoft-consulting/ssemr/blob/main/docker-compose.override.yml"
    click H "https://github.com/intellisoft-consulting/ssemr/blob/main/docker-compose-no-volumes.yml"
    click I "https://github.com/intellisoft-consulting/ssemr/tree/main/modules/"

    classDef client fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
    classDef container fill:#C8E6C9,stroke:#1B5E20,stroke-width:2px;
    classDef orchestration fill:#FFF9C4,stroke:#F57F17,stroke-width:2px;
    classDef modules fill:#FFE0B2,stroke:#E65100,stroke-width:2px;
```
