# code-and-brain/oclweb2 architecture

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

- Interactive diagram: https://gitdiagram.com/code-and-brain/oclweb2
- Repository: https://github.com/code-and-brain/oclweb2

## Overview

##### Project type and purpose
- From the README and file‐tree this is “oclweb2” – a ReactJS single‐page application (SPA) called OCL TermBrowser v2.
- Its purpose is to provide a web client for terminology management, consuming external APIs (Open Concept Lab back end) and optional SSO (KeyCloak).

##### File structure
- Top‐level files:
- Dockerfile, docker-compose.yml/override/sso – container definitions
- nginx/default.conf.template – static assets host & reverse‐proxy rules
- webpack.config.js – build pipeline for React assets
- src/ – all React source (components, services, hooks, assets)
- public/ – static index.html, environment config injection
- .github/workflows/main.yml – CI build/release pipeline
- No “backend” folder – this is strictly a front‐end. APIService.js calls out to external APIs (configured via public/env-config.js and config.json).
- CI/CD files (release_version.sh, GitHub Actions, start-prod.sh) indicate an automated release/deployment flow.

##### README for additional insights
- Docker Compose sets up:
- SPA container (built from Dockerfile, serves via Nginx)
- Optionally a KeyCloak container for SSO
- Emphasis on CORS/API_URL pointer to external OCL API endpoints
- CI triggers builds, versions, and deploys to staging/production

##### Detail without over-splitting
- React components/services under a single “React SPA” block.
- Do not list every component file – instead show the high‐level layers (UI, services, utils).
- Essential elements: static asset hosting, API integration, SSO, and CI/CD.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Runtime components
    Browser["Browser (User Agent)"]:::runtime

    subgraph "Static Hosting Layer"
        DockerReact["React SPA Container\n(Docker)"]:::runtime
        Compose["Docker Compose\n(docker-compose*.yml)"]:::runtime
        Nginx["Nginx Reverse Proxy\n+ Static Assets"]:::runtime
        Webpack["webpack.config.js"]:::tool
    end

    subgraph "React SPA Application"
        ReactApp["React SPA\n(src/)"]:::app
        APIService["APIService.js"]:::app
        ServerConfigs["serverConfigs.js"]:::app
        IndexJS["index.jsx"]:::app
        Styles["index.scss"]:::app
    end

    subgraph "Static Assets & Config"
        IndexHTML["public/index.html"]:::assets
        EnvConfig["public/env-config.js"]:::assets
        ConfigJSON["config.json"]:::assets
    end

    subgraph "Optional SSO Components"
        SigninRedirect["SigninRedirect.jsx"]:::app
        SignupRedirect["SignupRedirect.jsx"]:::app
        OIDCallback["OIDLoginCallback.jsx"]:::app
        LoginComp["Login.jsx"]:::app
    end

    subgraph "External Services"
        OCLAPI["External OCL API"]:::external
        KeyCloak["KeyCloak Identity Provider\n(SSO)"]:::external
    end

    subgraph "CI/CD Pipeline"
        GHAction["GitHub Actions\n(.github/workflows/main.yml)"]:::pipeline
        ReleaseScript["release_version.sh"]:::pipeline
        SetVersion["set_build_version.sh"]:::pipeline
        ReleaseNotes["release_notes.py"]:::pipeline
        Build["Docker Build & Push"]:::pipeline
        Deploy["Deploy to Staging/Production"]:::pipeline
    end

    subgraph "Container Scripts"
        StartDev["start.sh"]:::script
        StartProd["start-prod.sh"]:::script
    end

    %% Connections
    Browser --> Nginx
    Nginx --> DockerReact
    Nginx -->|"inject env config"| EnvConfig
    DockerReact --> ReactApp
    DockerReact --> IndexHTML
    DockerReact --> EnvConfig
    DockerReact --> ConfigJSON
    ReactApp --> APIService
    APIService --> OCLAPI
    ReactApp --> KeyCloak
    KeyCloak --> Browser
    ReactApp --> ServerConfigs
    ReactApp --> IndexJS
    ReactApp --> Styles
    ReactApp --> IndexHTML
    ReactApp --> EnvConfig
    ReactApp --> ConfigJSON
    ReactApp --> SigninRedirect
    ReactApp --> SignupRedirect
    ReactApp --> OIDCallback
    ReactApp --> LoginComp
    Compose --> DockerReact
    Compose --> Nginx
    Compose --> KeyCloak
    StartDev --> DockerReact
    StartProd --> DockerReact

    %% CI/CD dashed flows
    GHAction -.-> Build
    ReleaseScript -.-> Build
    SetVersion -.-> Build
    ReleaseNotes -.-> Build
    Build -.-> Deploy

    %% Click Events
    click DockerReact "https://github.com/code-and-brain/oclweb2/tree/master/Dockerfile"
    click Compose "https://github.com/code-and-brain/oclweb2/blob/master/docker-compose.yml"
    click Compose "https://github.com/code-and-brain/oclweb2/blob/master/docker-compose.override.yml"
    click Compose "https://github.com/code-and-brain/oclweb2/blob/master/docker-compose.sso.yml"
    click Nginx "https://github.com/code-and-brain/oclweb2/blob/master/nginx/default.conf.template"
    click Webpack "https://github.com/code-and-brain/oclweb2/blob/master/webpack.config.js"
    click ReactApp "https://github.com/code-and-brain/oclweb2/tree/master/src/"
    click IndexJS "https://github.com/code-and-brain/oclweb2/blob/master/src/index.jsx"
    click Styles "https://github.com/code-and-brain/oclweb2/blob/master/src/index.scss"
    click APIService "https://github.com/code-and-brain/oclweb2/blob/master/src/services/APIService.js"
    click ServerConfigs "https://github.com/code-and-brain/oclweb2/blob/master/src/common/serverConfigs.js"
    click IndexHTML "https://github.com/code-and-brain/oclweb2/blob/master/public/index.html"
    click EnvConfig "https://github.com/code-and-brain/oclweb2/blob/master/public/env-config.js"
    click ConfigJSON "https://github.com/code-and-brain/oclweb2/blob/master/config.json"
    click SigninRedirect "https://github.com/code-and-brain/oclweb2/blob/master/src/components/app/SigninRedirect.jsx"
    click SignupRedirect "https://github.com/code-and-brain/oclweb2/blob/master/src/components/app/SignupRedirect.jsx"
    click OIDCallback "https://github.com/code-and-brain/oclweb2/blob/master/src/components/users/OIDLoginCallback.jsx"
    click LoginComp "https://github.com/code-and-brain/oclweb2/blob/master/src/components/users/Login.jsx"
    click GHAction "https://github.com/code-and-brain/oclweb2/blob/master/.github/workflows/main.yml"
    click ReleaseScript "https://github.com/code-and-brain/oclweb2/blob/master/release_version.sh"
    click SetVersion "https://github.com/code-and-brain/oclweb2/blob/master/set_build_version.sh"
    click ReleaseNotes "https://github.com/code-and-brain/oclweb2/blob/master/release_notes.py"
    click StartDev "https://github.com/code-and-brain/oclweb2/blob/master/start.sh"
    click StartProd "https://github.com/code-and-brain/oclweb2/blob/master/start-prod.sh"

    %% Styles
    classDef runtime fill:#CEF,stroke:#036,stroke-width:1px
    classDef app fill:#CFF,stroke:#039,stroke-width:1px
    classDef assets fill:#FFC,stroke:#993,stroke-width:1px
    classDef external fill:#CFC,stroke:#393,stroke-width:1px
    classDef pipeline fill:#FCF,stroke:#939,stroke-width:1px
    classDef script fill:#ECC,stroke:#933,stroke-width:1px
    classDef tool fill:#CCC,stroke:#666,stroke-width:1px
```
