# edraj/csdmart architecture

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

- Interactive diagram: https://gitdiagram.com/edraj/csdmart
- Repository: https://github.com/edraj/csdmart

## Overview

DMART is a headless information-management platform with REST-like JSON APIs and two browser interfaces. The principal path is a user querying or managing entries through an API or UI, with query handling applying permission-aware search before repository access. Its domain spans spaces, entries, payloads, attachments, and workflows; supporting layers include SQL persistence, authentication, and plugins. The README documents additional API, MCP, WebSocket, import/export, and semantic-search capabilities. Some subsystem links are documented rather than verified in sampled implementation excerpts.

Main entry points: [`Services/QueryService.cs`](https://github.com/edraj/csdmart/blob/master/Services/QueryService.cs) (Query service), [`Api/Public/PublicEndpoints.cs`](https://github.com/edraj/csdmart/blob/master/Api/Public/PublicEndpoints.cs) (Public API), [`Api/Managed/ManagedEndpoints.cs`](https://github.com/edraj/csdmart/blob/master/Api/Managed/ManagedEndpoints.cs) (Managed API), [`DataAdapters/Sql/EntryRepository.cs`](https://github.com/edraj/csdmart/blob/master/DataAdapters/Sql/EntryRepository.cs) (Entry repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Clients and API"]
  node_cxb["CXB admin UI<br/>[App.svelte]"]
  node_catalog["Catalog UI<br/>[App.svelte]"]
  node_public_api["Public API<br/>[PublicEndpoints.cs]"]
  node_managed_api["Managed API"]
  node_query_handler["Query handlers<br/>[QueryHandler.cs]"]
end

subgraph group_domain["Information services"]
  node_query_service["Query service<br/>[QueryService.cs]"]
  node_entry_service["Entry service<br/>[EntryService.cs]"]
  node_workflow["Workflow engine<br/>[WorkflowEngine.cs]"]
  node_semantic["Semantic search"]
  node_import_export["Import/export"]
  node_models["Entry and query models<br/>[Entry.cs]"]
end

subgraph group_storage["Persistence and policy"]
  node_permission["Permission service"]
  node_query_policies["Query policies<br/>[QueryPolicies.cs]"]
  node_query_helper["SQL query execution<br/>[QueryHelper.cs]"]
  node_entry_repository["Entry repository<br/>[EntryRepository.cs]"]
  node_database[("SQL database<br/>[DbParams.cs]")]
end

subgraph group_extensions["Identity and extensions"]
  node_auth["Authentication<br/>[AuthHandler.cs]"]
  node_plugins["Plugin manager<br/>[PluginManager.cs]"]
  node_mcp["MCP tools<br/>[McpTools.cs]"]
  node_websocket["WebSocket updates"]
  node_ldap["LDAP server<br/>[LdapServer.cs]"]
end

node_operator(("User"))

node_operator -->|"uses"| node_cxb
node_operator -->|"uses"| node_catalog
node_cxb -.->|"calls"| node_managed_api
node_catalog -.->|"calls"| node_public_api
node_operator -->|"requests"| node_public_api
node_operator -->|"manages"| node_managed_api
node_public_api -.->|"queries"| node_query_service
node_managed_api -->|"routes"| node_query_handler
node_query_handler -->|"calls"| node_query_service
node_query_service -->|"checks access"| node_permission
node_query_service -->|"executes queries"| node_query_helper
node_query_service -->|"reads entries"| node_entry_repository
node_query_helper -.->|"runs SQL"| node_database
node_entry_repository -.->|"reads and writes"| node_database
node_entry_service -.->|"uses"| node_entry_repository
node_query_policies -->|"derives policy from"| node_models
node_query_service -->|"processes"| node_models
node_operator -->|"authenticates"| node_auth
node_operator -->|"transitions tickets"| node_workflow
node_operator -->|"searches semantically"| node_semantic
node_operator -->|"imports and exports"| node_import_export
node_operator -->|"uses agent tools"| node_mcp
node_plugins -.->|"exposes tools"| node_mcp
node_plugins -.->|"notifies"| node_websocket
node_operator -->|"receives updates"| node_websocket
node_operator -.->|"binds"| node_ldap

click node_cxb "https://github.com/edraj/csdmart/blob/master/cxb/src/App.svelte"
click node_catalog "https://github.com/edraj/csdmart/blob/master/catalog/src/App.svelte"
click node_public_api "https://github.com/edraj/csdmart/blob/master/Api/Public/PublicEndpoints.cs"
click node_managed_api "https://github.com/edraj/csdmart/blob/master/Api/Managed/ManagedEndpoints.cs"
click node_query_handler "https://github.com/edraj/csdmart/blob/master/Api/Managed/QueryHandler.cs"
click node_query_service "https://github.com/edraj/csdmart/blob/master/Services/QueryService.cs"
click node_entry_service "https://github.com/edraj/csdmart/blob/master/Services/EntryService.cs"
click node_workflow "https://github.com/edraj/csdmart/blob/master/Services/WorkflowEngine.cs"
click node_semantic "https://github.com/edraj/csdmart/blob/master/Services/SemanticSearchService.cs"
click node_import_export "https://github.com/edraj/csdmart/blob/master/Services/ImportExportService.cs"
click node_models "https://github.com/edraj/csdmart/blob/master/Dmart.Models/Core/Entry.cs"
click node_permission "https://github.com/edraj/csdmart/blob/master/Services/PermissionService.cs"
click node_query_policies "https://github.com/edraj/csdmart/blob/master/Utils/QueryPolicies.cs"
click node_query_helper "https://github.com/edraj/csdmart/blob/master/DataAdapters/Sql/QueryHelper.cs"
click node_entry_repository "https://github.com/edraj/csdmart/blob/master/DataAdapters/Sql/EntryRepository.cs"
click node_database "https://github.com/edraj/csdmart/blob/master/DataAdapters/Sql/DbParams.cs"
click node_auth "https://github.com/edraj/csdmart/blob/master/Api/User/AuthHandler.cs"
click node_plugins "https://github.com/edraj/csdmart/blob/master/Plugins/PluginManager.cs"
click node_mcp "https://github.com/edraj/csdmart/blob/master/Api/Mcp/McpTools.cs"
click node_websocket "https://github.com/edraj/csdmart/blob/master/Services/WebSocketManager.cs"
click node_ldap "https://github.com/edraj/csdmart/blob/master/Ldap/LdapServer.cs"

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_cxb,node_catalog,node_public_api,node_managed_api,node_query_handler,node_operator toneBlue
class node_query_service,node_entry_service,node_workflow,node_semantic,node_import_export,node_models toneAmber
class node_permission,node_query_policies,node_query_helper,node_entry_repository,node_database toneMint
class node_auth,node_plugins,node_mcp,node_websocket,node_ldap toneRose
```

## Components

### Clients and API

- [CXB admin UI](https://github.com/edraj/csdmart/blob/master/cxb/src/App.svelte): `cxb/src/App.svelte`
- [Catalog UI](https://github.com/edraj/csdmart/blob/master/catalog/src/App.svelte): `catalog/src/App.svelte`
- [Public API](https://github.com/edraj/csdmart/blob/master/Api/Public/PublicEndpoints.cs): `Api/Public/PublicEndpoints.cs`
- [Managed API](https://github.com/edraj/csdmart/blob/master/Api/Managed/ManagedEndpoints.cs): `Api/Managed/ManagedEndpoints.cs`
- [Query handlers](https://github.com/edraj/csdmart/blob/master/Api/Managed/QueryHandler.cs): `Api/Managed/QueryHandler.cs`

### Information services

- [Query service](https://github.com/edraj/csdmart/blob/master/Services/QueryService.cs): `Services/QueryService.cs`
- [Entry service](https://github.com/edraj/csdmart/blob/master/Services/EntryService.cs): `Services/EntryService.cs`
- [Workflow engine](https://github.com/edraj/csdmart/blob/master/Services/WorkflowEngine.cs): `Services/WorkflowEngine.cs`
- [Semantic search](https://github.com/edraj/csdmart/blob/master/Services/SemanticSearchService.cs): `Services/SemanticSearchService.cs`
- [Import/export](https://github.com/edraj/csdmart/blob/master/Services/ImportExportService.cs): `Services/ImportExportService.cs`
- [Entry and query models](https://github.com/edraj/csdmart/blob/master/Dmart.Models/Core/Entry.cs): `Dmart.Models/Core/Entry.cs`

### Persistence and policy

- [Permission service](https://github.com/edraj/csdmart/blob/master/Services/PermissionService.cs): `Services/PermissionService.cs`
- [Query policies](https://github.com/edraj/csdmart/blob/master/Utils/QueryPolicies.cs): `Utils/QueryPolicies.cs`
- [SQL query execution](https://github.com/edraj/csdmart/blob/master/DataAdapters/Sql/QueryHelper.cs): `DataAdapters/Sql/QueryHelper.cs`
- [Entry repository](https://github.com/edraj/csdmart/blob/master/DataAdapters/Sql/EntryRepository.cs): `DataAdapters/Sql/EntryRepository.cs`
- [SQL database](https://github.com/edraj/csdmart/blob/master/DataAdapters/Sql/DbParams.cs): `DataAdapters/Sql/DbParams.cs`

### Identity and extensions

- [Authentication](https://github.com/edraj/csdmart/blob/master/Api/User/AuthHandler.cs): `Api/User/AuthHandler.cs`
- [Plugin manager](https://github.com/edraj/csdmart/blob/master/Plugins/PluginManager.cs): `Plugins/PluginManager.cs`
- [MCP tools](https://github.com/edraj/csdmart/blob/master/Api/Mcp/McpTools.cs): `Api/Mcp/McpTools.cs`
- [WebSocket updates](https://github.com/edraj/csdmart/blob/master/Services/WebSocketManager.cs): `Services/WebSocketManager.cs`
- [LDAP server](https://github.com/edraj/csdmart/blob/master/Ldap/LdapServer.cs): `Ldap/LdapServer.cs`

### Other components

- **User**

## Connections

- User → CXB admin UI: uses (evidence: `README.md`)
- User → Catalog UI: uses (evidence: `README.md`)
- CXB admin UI → Managed API: calls
- Catalog UI → Public API: calls
- User → Public API: requests (evidence: `README.md`)
- User → Managed API: manages (evidence: `README.md`)
- Public API → Query service: queries
- Managed API → Query handlers: routes
- Query handlers → Query service: calls (evidence: `Api/Managed/QueryHandler.cs`)
- Query service → Permission service: checks access (evidence: `Services/QueryService.cs`)
- Query service → SQL query execution: executes queries (evidence: `Services/QueryService.cs`)
- Query service → Entry repository: reads entries (evidence: `Services/QueryService.cs`)
- SQL query execution → SQL database: runs SQL (evidence: `DataAdapters/Sql/QueryHelper.cs`)
- Entry repository → SQL database: reads and writes (evidence: `DataAdapters/Sql/EntryRepository.cs`)
- Entry service → Entry repository: uses
- Query policies → Entry and query models: derives policy from (evidence: `Utils/QueryPolicies.cs`)
- Query service → Entry and query models: processes (evidence: `Services/QueryService.cs`)
- User → Authentication: authenticates (evidence: `README.md`)
- User → Workflow engine: transitions tickets (evidence: `README.md`)
- User → Semantic search: searches semantically (evidence: `README.md`)
- User → Import/export: imports and exports (evidence: `README.md`)
- User → MCP tools: uses agent tools (evidence: `README.md`)
- Plugin manager → MCP tools: exposes tools
- Plugin manager → WebSocket updates: notifies
- User → WebSocket updates: receives updates (evidence: `README.md`)
- User → LDAP server: binds
