# trifork/fut-web-client architecture

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

- Interactive diagram: https://gitdiagram.com/trifork/fut-web-client
- Repository: https://github.com/trifork/fut-web-client

## Overview

##### Main Components
- Web Browser / User: Representing the client devices from where users access the Angular application.
- Angular Web Client: A large component encompassing the “client” folder where all the Angular code is encapsulated. This includes modules for FHIR (e.g., patient, appointment, organization, etc.), user management, notification, context-bar, and other UI elements.
- Web Server - NGINX: As identified in the file tree (the “nginx” folder with config templates), NGINX serves the static files built by Angular and also functions as a reverse proxy to route API requests from the client to the backend FUT services.
- Docker Infrastructure: Encapsulate the Docker components (Dockerfile, docker-compose.yaml, and .dockerignore) which package the Angular app and NGINX configuration into deployable containers.
- External FUT Back-End / HL7 FHIR API: Although not part of this repository, the client is designed to interact with external FUT services (secured HL7 FHIR endpoints) for retrieving and storing patient-related data (appointments, care teams, organizations, etc.).

##### Relationships & Interactions to Display
- The Angular app communicates with the NGINX server for fetching its static assets.
- API calls originating from the Angular client are forwarded to the external FUT HL7 FHIR API by the NGINX reverse proxy.

##### Architectural Patterns & Design Principles
- Separation between client-side architecture (Angular, Keycloak JS) and deployment/infrastructure (NGINX, Docker).
- That the design is based on a Single Page Application (SPA) architecture, with modular Angular components for various FHIR data interactions.
- The use of a reverse proxy pattern in NGINX is crucial to address CORS issues – show how all API calls pass through NGINX before reaching the external FUT services.

##### Technologies & Frameworks to Label
- Angular (client-side framework)
- NGINX (web server and reverse proxy)
- Docker & Docker Compose (containerization and orchestration)
- Keycloak (for authentication/SSO)
- HL7 FHIR API – external telemedicine service backend

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    Browser["Web Browser / User"]:::frontend
    Angular["Angular SPA"]:::angular
    Fhir["FHIR Modules & Services"]:::angular
    Keycloak["Keycloak Authentication"]:::auth
    Nginx["NGINX Reverse Proxy"]:::nginx
    FhirAPI["FUT HL7 FHIR API"]:::external
    Docker["Docker Infrastructure"]:::docker

    %% Subgraphs to illustrate deployment (optional grouping)
    subgraph "Client Deployment"
        Angular
        Nginx
    end

    %% Connections
    Browser -->|"HTTPRequests"| Angular
    Angular -->|"uses"| Fhir
    Angular <-->|"SSO"| Keycloak
    Angular -->|"APICalls"| Nginx
    Nginx -->|"ReverseProxy"| FhirAPI
    Docker -->|"Deploys"| Angular
    Docker -->|"Deploys"| Nginx

    %% Click Events
    click Angular "https://github.com/trifork/fut-web-client/tree/main/client/"
    click Fhir "https://github.com/trifork/fut-web-client/tree/main/client/src/app/fhir/"
    click Keycloak "https://github.com/trifork/fut-web-client/tree/main/client/keycloak-js/"
    click Nginx "https://github.com/trifork/fut-web-client/blob/main/nginx/default.conf.template"
    click Docker "https://github.com/trifork/fut-web-client/tree/main/Dockerfile"
    click Docker "https://github.com/trifork/fut-web-client/blob/main/docker-compose.yaml"
    click Docker "https://github.com/trifork/fut-web-client/blob/main/ .dockerignore"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#003366,stroke-width:2px;
    classDef angular fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef auth fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef nginx fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef external fill:#f5c6cb,stroke:#721c24,stroke-width:2px;
    classDef docker fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
