# mydevhero/caosdba architecture

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

- Interactive diagram: https://gitdiagram.com/mydevhero/caosdba
- Repository: https://github.com/mydevhero/caosdba

## Overview

CAOSDBA is a C++ data-access framework with cache-first queries, pooled relational database access, and CrowCpp HTTP or native-language interfaces. The documented request path checks Redis, runs a database query on a miss, and caches a returned value. The excerpts show that behavior for the Redis query and connection acquisition in database query implementations. README-level relationships describe the HTTP and language-binding capabilities; their internal dispatch is not established by the sampled source.

Main entry points: [`libcaos/Middleware/Repository/Database/Database.cpp`](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/Database.cpp) (Database pool), [`template/bindings/nodejs/src/include/Database/MySQL/Query.hpp`](https://github.com/mydevhero/caosdba/blob/main/template/bindings/nodejs/src/include/Database/MySQL/Query.hpp) (Binding query templates), [`libcaos/Middleware/Repository/Cache/Redis/Query.hpp`](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Cache/Redis/Query.hpp) (Redis query), [`libcaos/Middleware/Repository/Database/Query.hpp`](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/Query.hpp) (Database queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Application Interfaces"]
  node_http["CrowCpp HTTP<br/>[CrowCpp.hpp]"]
  node_node["Node binding<br/>[bindings.cpp]"]
  node_php["PHP binding<br/>[bindings.cpp]"]
  node_python["Python binding<br/>[bindings.cpp]"]
end

subgraph group_query["Query Layer"]
  node_repo["Repository interface<br/>[IRepository.hpp]"]
  node_redis_query["Redis query<br/>[Query.hpp]"]
  node_db_query["Database queries<br/>[Query.hpp]"]
  node_query_templates["Binding query templates<br/>[Query.hpp]"]
end

subgraph group_storage["Persistence"]
  node_cache["Cache manager<br/>[Cache.hpp]"]
  node_redis["Redis adapter<br/>[Redis.hpp]"]
  node_pool["Database pool<br/>[Database.cpp]"]
  node_maria["MariaDB driver<br/>[Query.hpp]"]
  node_mysql["MySQL driver<br/>[MySQL.hpp]"]
  node_postgres["PostgreSQL driver<br/>[Query.hpp]"]
end

subgraph group_infrastructure["Core Infrastructure"]
  node_facade["CAOSDBA facade<br/>[libcaos.hpp]"]
end

node_app(("Application caller"))
node_redis_store[("Redis store")]
node_db_store[("Relational database")]

node_app -->|"calls REST"| node_http
node_app -->|"calls native"| node_node
node_app -->|"calls native"| node_php
node_app -->|"calls native"| node_python
node_http -.->|"uses framework"| node_facade
node_node -.->|"exposes queries"| node_query_templates
node_php -.->|"exposes queries"| node_query_templates
node_python -.->|"exposes queries"| node_query_templates
node_facade -->|"exposes repository"| node_repo
node_redis_query -->|"reads cache"| node_redis_store
node_redis_query -->|"queries on miss"| node_db_query
node_redis_query -->|"writes result"| node_redis_store
node_db_query -->|"acquires connection"| node_pool
node_db_query -->|"executes query"| node_db_store
node_query_templates -->|"acquires connection"| node_pool
node_pool -.->|"dispatches driver"| node_maria
node_pool -.->|"dispatches driver"| node_mysql
node_pool -.->|"dispatches driver"| node_postgres
node_redis -.->|"uses cache"| node_cache

click node_http "https://github.com/mydevhero/caosdba/blob/main/libcaos/include/CrowCpp.hpp"
click node_node "https://github.com/mydevhero/caosdba/blob/main/bindings/node/bindings.cpp"
click node_php "https://github.com/mydevhero/caosdba/blob/main/bindings/php/bindings.cpp"
click node_python "https://github.com/mydevhero/caosdba/blob/main/bindings/python/bindings.cpp"
click node_repo "https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/IRepository.hpp"
click node_redis_query "https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Cache/Redis/Query.hpp"
click node_db_query "https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/Query.hpp"
click node_cache "https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Cache/Cache.hpp"
click node_redis "https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Cache/Redis/Redis.hpp"
click node_pool "https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/Database.cpp"
click node_maria "https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/MariaDB/Query.hpp"
click node_mysql "https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/MySQL/MySQL.hpp"
click node_postgres "https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/PostgreSQL/Query.hpp"
click node_facade "https://github.com/mydevhero/caosdba/blob/main/libcaos/include/libcaos.hpp"
click node_query_templates "https://github.com/mydevhero/caosdba/blob/main/template/bindings/nodejs/src/include/Database/MySQL/Query.hpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_http,node_node,node_php,node_python toneBlue
class node_repo,node_redis_query,node_db_query,node_query_templates,node_redis_store,node_db_store toneAmber
class node_cache,node_redis,node_pool,node_maria,node_mysql,node_postgres toneMint
class node_facade toneRose
class node_app toneIndigo
```

## Components

### Application Interfaces

- [CrowCpp HTTP](https://github.com/mydevhero/caosdba/blob/main/libcaos/include/CrowCpp.hpp): `libcaos/include/CrowCpp.hpp`
- [Node binding](https://github.com/mydevhero/caosdba/blob/main/bindings/node/bindings.cpp): `bindings/node/bindings.cpp`
- [PHP binding](https://github.com/mydevhero/caosdba/blob/main/bindings/php/bindings.cpp): `bindings/php/bindings.cpp`
- [Python binding](https://github.com/mydevhero/caosdba/blob/main/bindings/python/bindings.cpp): `bindings/python/bindings.cpp`

### Query Layer

- [Repository interface](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/IRepository.hpp): `libcaos/Middleware/Repository/IRepository.hpp`
- [Redis query](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Cache/Redis/Query.hpp): `libcaos/Middleware/Repository/Cache/Redis/Query.hpp`
- [Database queries](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/Query.hpp): `libcaos/Middleware/Repository/Database/Query.hpp`
- [Binding query templates](https://github.com/mydevhero/caosdba/blob/main/template/bindings/nodejs/src/include/Database/MySQL/Query.hpp): `template/bindings/nodejs/src/include/Database/MySQL/Query.hpp`

### Persistence

- [Cache manager](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Cache/Cache.hpp): `libcaos/Middleware/Repository/Cache/Cache.hpp`
- [Redis adapter](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Cache/Redis/Redis.hpp): `libcaos/Middleware/Repository/Cache/Redis/Redis.hpp`
- [Database pool](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/Database.cpp): `libcaos/Middleware/Repository/Database/Database.cpp`
- [MariaDB driver](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/MariaDB/Query.hpp): `libcaos/Middleware/Repository/Database/MariaDB/Query.hpp`
- [MySQL driver](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/MySQL/MySQL.hpp): `libcaos/Middleware/Repository/Database/MySQL/MySQL.hpp`
- [PostgreSQL driver](https://github.com/mydevhero/caosdba/blob/main/libcaos/Middleware/Repository/Database/PostgreSQL/Query.hpp): `libcaos/Middleware/Repository/Database/PostgreSQL/Query.hpp`

### Core Infrastructure

- [CAOSDBA facade](https://github.com/mydevhero/caosdba/blob/main/libcaos/include/libcaos.hpp): `libcaos/include/libcaos.hpp`

### Other components

- **Application caller**
- **Redis store**
- **Relational database**

## Connections

- Application caller → CrowCpp HTTP: calls REST
- Application caller → Node binding: calls native
- Application caller → PHP binding: calls native
- Application caller → Python binding: calls native
- CrowCpp HTTP → CAOSDBA facade: uses framework (evidence: `libcaos/include/libcaos.hpp`)
- Node binding → Binding query templates: exposes queries
- PHP binding → Binding query templates: exposes queries
- Python binding → Binding query templates: exposes queries
- CAOSDBA facade → Repository interface: exposes repository (evidence: `libcaos/include/libcaos.hpp`)
- Redis query → Redis store: reads cache (evidence: `libcaos/Middleware/Repository/Cache/Redis/Query.hpp`)
- Redis query → Database queries: queries on miss (evidence: `libcaos/Middleware/Repository/Cache/Redis/Query.hpp`)
- Redis query → Redis store: writes result (evidence: `libcaos/Middleware/Repository/Cache/Redis/Query.hpp`)
- Database queries → Database pool: acquires connection (evidence: `libcaos/Middleware/Repository/Database/Database.cpp`)
- Database queries → Relational database: executes query
- Binding query templates → Database pool: acquires connection (evidence: `template/bindings/nodejs/src/include/Database/MySQL/Query.hpp`)
- Database pool → MariaDB driver: dispatches driver
- Database pool → MySQL driver: dispatches driver (evidence: `libcaos/Middleware/Repository/Database/Database.cpp`)
- Database pool → PostgreSQL driver: dispatches driver
- Redis adapter → Cache manager: uses cache (evidence: `libcaos/Middleware/Repository/Cache/Redis/Redis.hpp`)
