# kingsdigitallab/kdl architecture

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

- Interactive diagram: https://gitdiagram.com/kingsdigitallab/kdl
- Repository: https://github.com/kingsdigitallab/kdl

## Overview

##### Main System Components

a) Frontend
- Static site generator (11ty/Eleventy)
- Public-facing website with blog, projects, and other content
- Asset management (stylesheets, images, fonts)

b) CMS (Content Management System)
- Directus (implied by the structure)
- Data model based on schema.org
- Content management interface

c) ETL (Extract, Transform, Load)
- Data processing pipeline
- Integration with ActiveCollab
- Scraping functionality

##### Infrastructure Layer
A Docker-based deployment infrastructure:
- Local development environment
- Production environment
- Volume management for persistent data
- Proxy configuration

##### Data Flow and Relationships

a) Content Flow:
**CMS → ETL → Frontend**

- Agent (Organization, Person)
- Project
- WebPage
- DefinedTerm
- KDLRole
- LinkRole

**[Frontend Layer (11ty, Static Assets)]**
- ↑
**[ETL Processing Layer]**
- ↑
**[CMS Layer (Directus)]**
- ↑
**[Data Storage Layer]**
- ↑
**[Infrastructure Layer (Docker)]**

##### Critical Paths

a) Content Management Flow:
**CMS UI → Data Model → ETL Processing → Static Site Generation → Public Website**

b) Development Flow:
**Local Development → Git → CI/CD (GitHub Actions) → Production Deployment**

##### Technical Details

- Node.js 18 runtime environment
- Docker containerization
- GitHub Actions for CI/CD
- 11ty static site generator
- Schema.org-based data model
- Cypress for E2E testing

##### Integration Points

- API connections between components
- Data synchronization paths
- Testing integration points
- Deployment paths

##### Environment Separation

Create clear boundaries between:
- Development environment
- Production environment
- Testing environment

Remember to include annotations for:
- Security boundaries
- Data persistence points
- User interaction points
- Content workflow paths

This will provide a complete picture of both the technical architecture and the content management workflow that is central to this system's operation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Frontend
        FE[11ty Static Site]:::frontend
        Layouts[Layouts]:::frontend
        Assets[Assets]:::frontend
        FEConfig[11ty Config]:::frontend
        FEData[Frontend Data]:::frontend
        
        FE --> Layouts
        FE --> Assets
        FE --> FEConfig
        FE --> FEData
    end

    subgraph ETL
        ETLManager[ETL Manager]:::etl
        ACIntegration[ActiveCollab Integration]:::etl
        Scraper[Web Scraper]:::etl
        
        ETLManager --> ACIntegration
        ETLManager --> Scraper
    end

    subgraph CMS
        DirectusCMS[Directus CMS]:::cms
        Schema[Schema Evolution]:::cms
        CMSConfig[CMS Configuration]:::cms
        
        DirectusCMS --> Schema
        DirectusCMS --> CMSConfig
    end

    subgraph Testing
        E2E[E2E Tests]:::testing
        TestSupport[Test Support]:::testing
        
        E2E --> TestSupport
    end

    subgraph Infrastructure
        DockerLocal[Local Docker]:::infra
        DockerProd[Production Docker]:::infra
        Compose[Docker Compose]:::infra
        DevContainer[Dev Container]:::infra
        VSCode[VS Code Settings]:::infra
        EnvConfig[Environment Config]:::infra
        
        DockerLocal --> Compose
        DockerProd --> Compose
        DevContainer --> EnvConfig
        DevContainer --> VSCode
    end

    DirectusCMS --> ETLManager
    ETLManager --> FE
    E2E --> FE

    %% Click Events
    click FE "https://github.com/kingsdigitallab/kdl/tree/main/frontend"
    click FEConfig "https://github.com/kingsdigitallab/kdl/blob/main/frontend/.eleventy.js"
    click Layouts "https://github.com/kingsdigitallab/kdl/tree/main/frontend/src/_includes/layouts"
    click Assets "https://github.com/kingsdigitallab/kdl/tree/main/frontend/public/assets"
    click DirectusCMS "https://github.com/kingsdigitallab/kdl/tree/main/cms"
    click Schema "https://github.com/kingsdigitallab/kdl/tree/main/cms/snapshots"
    click CMSConfig "https://github.com/kingsdigitallab/kdl/blob/main/cms/package.json"
    click ETLManager "https://github.com/kingsdigitallab/kdl/blob/main/etl/src/manager.js"
    click ACIntegration "https://github.com/kingsdigitallab/kdl/blob/main/etl/src/activecollab.js"
    click Scraper "https://github.com/kingsdigitallab/kdl/blob/main/etl/src/scraper.js"
    click E2E "https://github.com/kingsdigitallab/kdl/tree/main/cypress/e2e"
    click TestSupport "https://github.com/kingsdigitallab/kdl/tree/main/cypress/support"
    click DockerLocal "https://github.com/kingsdigitallab/kdl/tree/main/docker/local"
    click DockerProd "https://github.com/kingsdigitallab/kdl/tree/main/docker/production"
    click Compose "https://github.com/kingsdigitallab/kdl/blob/main/compose/docker-compose.yaml"
    click DevContainer "https://github.com/kingsdigitallab/kdl/blob/main/.devcontainer/devcontainer.json"
    click VSCode "https://github.com/kingsdigitallab/kdl/blob/main/.vscode"
    click EnvConfig "https://github.com/kingsdigitallab/kdl/blob/main/.nvmrc"
    click FEData "https://github.com/kingsdigitallab/kdl/tree/main/frontend/src/_data"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef etl fill:#e67e22,stroke:#d35400,color:white
    classDef cms fill:#2ecc71,stroke:#27ae60,color:white
    classDef testing fill:#9b59b6,stroke:#8e44ad,color:white
    classDef infra fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        Frontend_L[Frontend]:::frontend
        ETL_L[ETL]:::etl
        CMS_L[CMS]:::cms
        Testing_L[Testing]:::testing
        Infra_L[Infrastructure]:::infra
    end
```
