# abrahamkonchellah/ayiyacms architecture

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

- Interactive diagram: https://gitdiagram.com/abrahamkonchellah/ayiyacms
- Repository: https://github.com/abrahamkonchellah/ayiyacms

## Overview

AyiyaCMS is a legal case-management system for firm staff, administrators, and clients. Its principal workflow is role-aware sign-in and navigation into dashboards and matter work, with API controllers handling matter and document operations and infrastructure services providing persistence, file storage, and search. The tree also shows billing, calendar, reporting, administration, audit, and clause-analysis capabilities. Relationships are limited to routes shown in the frontend excerpt and dependencies named in the source index; unsampled service wiring and client-to-API calls are not asserted.

Main entry points: [`client/src/App.tsx`](https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/App.tsx) (Role-based routes), [`server/AyiyaCMS.API/Controllers/DocumentsController.cs`](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.API/Controllers/DocumentsController.cs) (Document endpoints), [`server/AyiyaCMS.API/Controllers/AuthController.cs`](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.API/Controllers/AuthController.cs) (Authentication endpoints), [`server/AyiyaCMS.API/Controllers/MattersController.cs`](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.API/Controllers/MattersController.cs) (Matter endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_webapp["Role-based routes<br/>[App.tsx]"]
  node_authstate["Authentication state<br/>[AuthContext.tsx]"]
  node_dashboards["Role dashboards"]
  node_matterpages["Matter workspace<br/>[MatterDetail.tsx]"]
  node_documentpages["Document workspace<br/>[Documents.tsx]"]
  node_billingpages["Billing screens<br/>[Billing.tsx]"]
  node_calendarpages["Calendar screens<br/>[Calendar.tsx]"]
  node_otherpages["Admin and reports<br/>[AdminPanel.tsx]"]
end

subgraph group_api["API and identity"]
  node_authapi["Authentication endpoints<br/>[AuthController.cs]"]
  node_matterapi["Matter endpoints"]
  node_documentapi["Document endpoints"]
  node_paymentapi["Payment endpoints"]
  node_login["Login command<br/>[LoginCommand.cs]"]
  node_mfa["MFA service<br/>[MfaService.cs]"]
  node_tokens["Token service<br/>[TokenService.cs]"]
end

subgraph group_casework["Legal casework"]
  node_matters["Matter operations<br/>[MatterCommand.cs]"]
  node_matteraccess["Matter access rules"]
  node_documents["Document operations<br/>[DocumentCommand.cs]"]
end

subgraph group_finance["Billing and payments"]
  node_invoices["Invoice operations<br/>[InvoiceCommand.cs]"]
  node_mpesa["M-Pesa payments<br/>[MpesaService.cs]"]
end

subgraph group_platform["Data and integrations"]
  node_database[("Application database<br/>[AppDbContext.cs]")]
  node_storage["S3 file storage"]
  node_search["Document search"]
  node_ml["ML service<br/>[app.py]"]
end

node_user(("Firm or client user"))
node_s3service[("S3 object store")]
node_meili[("Meilisearch")]
node_daraja["M-Pesa Daraja"]

node_user -->|"uses"| node_webapp
node_webapp -->|"reads identity"| node_authstate
node_webapp -->|"routes by role"| node_dashboards
node_webapp -->|"routes"| node_matterpages
node_webapp -->|"routes"| node_documentpages
node_webapp -->|"routes"| node_billingpages
node_webapp -->|"routes"| node_calendarpages
node_webapp -->|"routes"| node_otherpages
node_authapi -->|"invokes"| node_login
node_authapi -->|"invokes"| node_mfa
node_authapi -->|"uses"| node_tokens
node_matterapi -->|"invokes"| node_matters
node_matterapi -->|"checks access"| node_matteraccess
node_documentapi -->|"invokes"| node_documents
node_documentapi -->|"uses files"| node_storage
node_documentapi -->|"checks access"| node_matteraccess
node_documentapi -->|"uses search"| node_search
node_paymentapi -->|"invokes"| node_invoices
node_paymentapi -->|"reads and writes"| node_database
node_storage -->|"stores objects"| node_s3service
node_search -->|"indexes and queries"| node_meili
node_mpesa -.->|"initiates payments"| node_daraja

click node_webapp "https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/App.tsx"
click node_authstate "https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/store/AuthContext.tsx"
click node_dashboards "https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/ClientDashboard.tsx"
click node_matterpages "https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/MatterDetail.tsx"
click node_documentpages "https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/Documents.tsx"
click node_billingpages "https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/Billing.tsx"
click node_calendarpages "https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/Calendar.tsx"
click node_otherpages "https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/AdminPanel.tsx"
click node_authapi "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.API/Controllers/AuthController.cs"
click node_matterapi "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.API/Controllers/MattersController.cs"
click node_documentapi "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.API/Controllers/DocumentsController.cs"
click node_paymentapi "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.API/Controllers/PaymentsController.cs"
click node_login "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Features/Auth/LoginCommand.cs"
click node_mfa "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Services/MfaService.cs"
click node_tokens "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Services/TokenService.cs"
click node_matters "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Features/Matters/MatterCommand.cs"
click node_matteraccess "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Services/MatterAccessService.cs"
click node_documents "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Features/Documents/DocumentCommand.cs"
click node_invoices "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Features/Billing/InvoiceCommand.cs"
click node_mpesa "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Features/Payments/MpesaService.cs"
click node_database "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Data/AppDbContext.cs"
click node_storage "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Storage/S3StorageService.cs"
click node_search "https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Services/MeilisearchService.cs"
click node_ml "https://github.com/abrahamkonchellah/ayiyacms/blob/main/ml-service/app.py"

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_webapp,node_authstate,node_dashboards,node_matterpages,node_documentpages,node_billingpages,node_calendarpages,node_otherpages,node_user toneBlue
class node_authapi,node_matterapi,node_documentapi,node_paymentapi,node_login,node_mfa,node_tokens,node_s3service,node_meili toneAmber
class node_matters,node_matteraccess,node_documents toneMint
class node_invoices,node_mpesa toneRose
class node_database,node_storage,node_search,node_ml,node_daraja toneIndigo
```

## Components

### Web application

- [Role-based routes](https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Authentication state](https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/store/AuthContext.tsx): `client/src/store/AuthContext.tsx`
- [Role dashboards](https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/ClientDashboard.tsx): `client/src/pages/ClientDashboard.tsx`
- [Matter workspace](https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/MatterDetail.tsx): `client/src/pages/MatterDetail.tsx`
- [Document workspace](https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/Documents.tsx): `client/src/pages/Documents.tsx`
- [Billing screens](https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/Billing.tsx): `client/src/pages/Billing.tsx`
- [Calendar screens](https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/Calendar.tsx): `client/src/pages/Calendar.tsx`
- [Admin and reports](https://github.com/abrahamkonchellah/ayiyacms/blob/main/client/src/pages/AdminPanel.tsx): `client/src/pages/AdminPanel.tsx`

### API and identity

- [Authentication endpoints](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.API/Controllers/AuthController.cs): `server/AyiyaCMS.API/Controllers/AuthController.cs`
- [Matter endpoints](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.API/Controllers/MattersController.cs): `server/AyiyaCMS.API/Controllers/MattersController.cs`
- [Document endpoints](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.API/Controllers/DocumentsController.cs): `server/AyiyaCMS.API/Controllers/DocumentsController.cs`
- [Payment endpoints](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.API/Controllers/PaymentsController.cs): `server/AyiyaCMS.API/Controllers/PaymentsController.cs`
- [Login command](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Features/Auth/LoginCommand.cs): `server/AyiyaCMS.Infrastructure/Features/Auth/LoginCommand.cs`
- [MFA service](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Services/MfaService.cs): `server/AyiyaCMS.Infrastructure/Services/MfaService.cs`
- [Token service](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Services/TokenService.cs): `server/AyiyaCMS.Infrastructure/Services/TokenService.cs`

### Legal casework

- [Matter operations](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Features/Matters/MatterCommand.cs): `server/AyiyaCMS.Infrastructure/Features/Matters/MatterCommand.cs`
- [Matter access rules](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Services/MatterAccessService.cs): `server/AyiyaCMS.Infrastructure/Services/MatterAccessService.cs`
- [Document operations](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Features/Documents/DocumentCommand.cs): `server/AyiyaCMS.Infrastructure/Features/Documents/DocumentCommand.cs`

### Billing and payments

- [Invoice operations](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Features/Billing/InvoiceCommand.cs): `server/AyiyaCMS.Infrastructure/Features/Billing/InvoiceCommand.cs`
- [M-Pesa payments](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Features/Payments/MpesaService.cs): `server/AyiyaCMS.Infrastructure/Features/Payments/MpesaService.cs`

### Data and integrations

- [Application database](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Data/AppDbContext.cs): `server/AyiyaCMS.Infrastructure/Data/AppDbContext.cs`
- [S3 file storage](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Storage/S3StorageService.cs): `server/AyiyaCMS.Infrastructure/Storage/S3StorageService.cs`
- [Document search](https://github.com/abrahamkonchellah/ayiyacms/blob/main/server/AyiyaCMS.Infrastructure/Services/MeilisearchService.cs): `server/AyiyaCMS.Infrastructure/Services/MeilisearchService.cs`
- [ML service](https://github.com/abrahamkonchellah/ayiyacms/blob/main/ml-service/app.py): `ml-service/app.py`

### Other components

- **Firm or client user**
- **S3 object store**
- **Meilisearch**
- **M-Pesa Daraja**

## Connections

- Firm or client user → Role-based routes: uses (evidence: `client/src/App.tsx`)
- Role-based routes → Authentication state: reads identity (evidence: `client/src/App.tsx`)
- Role-based routes → Role dashboards: routes by role (evidence: `client/src/App.tsx`)
- Role-based routes → Matter workspace: routes (evidence: `client/src/App.tsx`)
- Role-based routes → Document workspace: routes (evidence: `client/src/App.tsx`)
- Role-based routes → Billing screens: routes (evidence: `client/src/App.tsx`)
- Role-based routes → Calendar screens: routes (evidence: `client/src/App.tsx`)
- Role-based routes → Admin and reports: routes (evidence: `client/src/App.tsx`)
- Authentication endpoints → Login command: invokes (evidence: `server/AyiyaCMS.API/Controllers/AuthController.cs`)
- Authentication endpoints → MFA service: invokes (evidence: `server/AyiyaCMS.API/Controllers/AuthController.cs`)
- Authentication endpoints → Token service: uses (evidence: `server/AyiyaCMS.API/Controllers/AuthController.cs`)
- Matter endpoints → Matter operations: invokes (evidence: `server/AyiyaCMS.API/Controllers/MattersController.cs`)
- Matter endpoints → Matter access rules: checks access (evidence: `server/AyiyaCMS.API/Controllers/MattersController.cs`)
- Document endpoints → Document operations: invokes (evidence: `server/AyiyaCMS.API/Controllers/DocumentsController.cs`)
- Document endpoints → S3 file storage: uses files (evidence: `server/AyiyaCMS.API/Controllers/DocumentsController.cs`)
- Document endpoints → Matter access rules: checks access (evidence: `server/AyiyaCMS.API/Controllers/DocumentsController.cs`)
- Document endpoints → Document search: uses search (evidence: `server/AyiyaCMS.API/Controllers/DocumentsController.cs`)
- Payment endpoints → Invoice operations: invokes (evidence: `server/AyiyaCMS.API/Controllers/PaymentsController.cs`)
- Payment endpoints → Application database: reads and writes (evidence: `server/AyiyaCMS.API/Controllers/PaymentsController.cs`)
- S3 file storage → S3 object store: stores objects (evidence: `server/AyiyaCMS.Infrastructure/Storage/S3StorageService.cs`)
- Document search → Meilisearch: indexes and queries (evidence: `server/AyiyaCMS.Infrastructure/Services/MeilisearchService.cs`)
- M-Pesa payments → M-Pesa Daraja: initiates payments
