# ifpbesp/apae architecture

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

- Interactive diagram: https://gitdiagram.com/ifpbesp/apae
- Repository: https://github.com/ifpbesp/apae

## Overview

##### Project type and purpose
- From the README we see “APAE” consists of two systems:
- A Patient Management System (for internal use by APAE staff)
- An Information Display System (for public or stakeholder consumption)
- The project appears to be a full-stack solution, likely including:
- A web frontend (React/Vue/Angular or similar)
- A mobile app (Android/iOS, possibly React Native/Flutter)
- A backend REST/GraphQL API
- A database (relational or document)
- CI/CD pipelines and DevOps infrastructure

##### File structure
- At this moment the repository only contains README.md, but the conventions and labels imply the following top-level directories in time:
/backend
/frontend-web
/frontend-mobile
/docs
/infrastructure (Docker, k8s, Terraform)
/tests (unit, integration, e2e)
- Configuration and orchestration files (Dockerfile, docker-compose.yml, k8s manifests, Terraform .tf files) will live under /infrastructure

##### README for additional insights
- Commit and branch conventions show separate scopes for auth, database, api, service, repository, cache (backend) and ui, components, layout, state (frontend).
- GitFlow labels and Kanban lanes reveal a well-structured CI/CD process and the presence of multiple deployment environments: development, homologation (staging), production.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        WebSPA["Web SPA"]:::client
        MobileApp["Mobile App"]:::client
    end

    %% Backend Services
    subgraph "Backend Services"
        direction TB
        APIGateway["API Gateway"]:::backend
        AuthService["Auth Service"]:::backend
        PatientService["Patient Service"]:::backend
        InfoService["Info Service"]:::backend
        RepoLayer["Repository Layer"]:::backend
        CacheLayer["Cache Layer"]:::backend
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Database["Database (PostgreSQL/MySQL)"]:::data
        CacheStore["Cache Store (Redis)"]:::data
    end

    %% External Services
    subgraph "External Services"
        direction TB
        EmailSMS["E-mail/SMS Provider"]:::external
        PushNotif["Push Notifications"]:::external
        Analytics["Analytics Service"]:::external
    end

    %% DevOps & Infrastructure
    subgraph "DevOps & Infrastructure"
        direction TB
        CICDPipeline["CI/CD Pipeline"]:::infra
        ContainerInfra["Docker, Kubernetes, Terraform"]:::infra
    end

    %% Connections
    WebSPA -->|"HTTPS/443"| APIGateway
    MobileApp -->|"HTTPS/443"| APIGateway

    APIGateway -->|"routes to"| AuthService
    APIGateway -->|"routes to"| PatientService
    APIGateway -->|"routes to"| InfoService

    AuthService -->|"reads/writes"| RepoLayer
    PatientService -->|"business logic"| RepoLayer
    InfoService -->|"read-only"| RepoLayer

    RepoLayer -->|"SQL queries"| Database
    PatientService -->|"cache queries"| CacheLayer
    CacheLayer -->|"cache storage"| CacheStore

    PatientService -.->|"async events"| EmailSMS
    PatientService -.->|"push events"| PushNotif
    APIGateway -.->|"metrics"| Analytics

    CICDPipeline -->|"build & test"| ContainerInfra
    ContainerInfra -->|"deploys to"| WebSPA
    ContainerInfra -->|"deploys to"| MobileApp
    ContainerInfra -->|"deploys to"| APIGateway
    ContainerInfra -->|"deploys to"| AuthService
    ContainerInfra -->|"deploys to"| PatientService
    ContainerInfra -->|"deploys to"| InfoService

    %% Styles
    classDef client fill:#E0F7FA,stroke:#0288D1
    classDef backend fill:#E8F5E9,stroke:#2E7D32
    classDef data fill:#FFF3E0,stroke:#EF6C00
    classDef external fill:#F3E5F5,stroke:#6A1B9A
    classDef infra fill:#ECEFF1,stroke:#546E7A
```
