# yonnn101/the-startup architecture

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

- Interactive diagram: https://gitdiagram.com/yonnn101/the-startup
- Repository: https://github.com/yonnn101/the-startup

## Overview

SelamTrust is a governance, risk, and compliance platform: organizations manage frameworks, evidence, controls, findings, policies, risks, and tasks, with AI services for grounded policy generation and knowledge processing. The repository also includes an endpoint agent and a policy-library package. The graph preserves these major product areas, but excerpts do not establish many cross-application connections; those links are omitted rather than inferred.

Main entry points: [`packages/db/src/tenant-client.ts`](https://github.com/yonnn101/the-startup/blob/main/packages/db/src/tenant-client.ts) (Tenant Database), [`apps/agent/cmd/selamtrust-agent/main.go`](https://github.com/yonnn101/the-startup/blob/main/apps/agent/cmd/selamtrust-agent/main.go) (Agent Command), [`apps/ai/app/domain/services/policy_generation_service.py`](https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/domain/services/policy_generation_service.py) (Policy Generation), [`apps/ai/app/domain/services/knowledge_ingestion_service.py`](https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/domain/services/knowledge_ingestion_service.py) (Knowledge Ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["GRC Web App"]
  node_webapp["Web Experience"]
  node_evidence["Evidence API<br/>[route.ts]"]
  node_dashboard["Dashboard API<br/>[route.ts]"]
  node_findings["Findings API<br/>[route.ts]"]
  node_policies["Policies API<br/>[route.ts]"]
  node_risks["Risk API<br/>[route.ts]"]
  node_tasks["Task API<br/>[route.ts]"]
end

subgraph group_ai["AI Services"]
  node_ai_service["AI API Service<br/>[main.py]"]
  node_ai_router["Versioned API Router<br/>[router.py]"]
  node_policy_generation["Policy Generation"]
  node_retrieval["Knowledge Retrieval"]
  node_ingestion["Knowledge Ingestion"]
  node_parsers["Document Parsers"]
  node_knowledge_repo[("Knowledge Repository")]
  node_llm["LLM Adapter<br/>[litellm_adapter.py]"]
  node_assessment["Control Assessment"]
end

subgraph group_agent["Endpoint Agent"]
  node_agent_cli["Agent Command<br/>[main.go]"]
  node_agent_collector["Endpoint Collectors"]
  node_agent_client["Agent Client<br/>[client.go]"]
  node_agent_queue[("Disk Queue<br/>[disk_queue.go]")]
end

subgraph group_library["Policy Library"]
  node_policy_library["Policy Library<br/>[tailoring.ts]"]
end

subgraph group_data["Framework Data"]
  node_framework_seeds["Framework Seeds<br/>[index.ts]"]
  node_framework_registry["Framework Definitions"]
end

node_user(("Organization User"))
node_db[("Tenant Database<br/>[tenant-client.ts]")]

node_user -->|"uses"| node_webapp
node_evidence -->|"queries"| node_db
node_dashboard -->|"queries"| node_db
node_findings -->|"queries"| node_db
node_policies -->|"queries"| node_db
node_risks -->|"queries"| node_db
node_tasks -->|"queries"| node_db
node_ai_service -->|"mounts routes"| node_ai_router
node_ai_router -.->|"routes to"| node_policy_generation
node_policy_generation -->|"retrieves context"| node_retrieval
node_policy_generation -.->|"generates with"| node_llm
node_retrieval -->|"searches"| node_knowledge_repo
node_ingestion -->|"parses documents"| node_parsers
node_ingestion -->|"persists knowledge"| node_knowledge_repo
node_agent_cli -.->|"runs collection"| node_agent_collector
node_agent_cli -.->|"sends evidence"| node_agent_client
node_agent_cli -.->|"queues offline data"| node_agent_queue
node_framework_seeds -->|"loads definitions"| node_framework_registry

click node_webapp "https://github.com/yonnn101/the-startup/tree/main/apps/web/app"
click node_evidence "https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/evidence/route.ts"
click node_dashboard "https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/dashboard/route.ts"
click node_findings "https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/findings/route.ts"
click node_policies "https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/policies/route.ts"
click node_risks "https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/risks/route.ts"
click node_tasks "https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/tasks/route.ts"
click node_db "https://github.com/yonnn101/the-startup/blob/main/packages/db/src/tenant-client.ts"
click node_ai_service "https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/main.py"
click node_ai_router "https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/api/v1/router.py"
click node_policy_generation "https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/domain/services/policy_generation_service.py"
click node_retrieval "https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/domain/services/knowledge_retrieval_service.py"
click node_ingestion "https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/domain/services/knowledge_ingestion_service.py"
click node_parsers "https://github.com/yonnn101/the-startup/tree/main/apps/ai/app/infrastructure/parsers"
click node_knowledge_repo "https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/infrastructure/persistence/pg_knowledge_repository.py"
click node_llm "https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/infrastructure/llm/litellm_adapter.py"
click node_assessment "https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/domain/services/control_assessment_engine.py"
click node_agent_cli "https://github.com/yonnn101/the-startup/blob/main/apps/agent/cmd/selamtrust-agent/main.go"
click node_agent_collector "https://github.com/yonnn101/the-startup/tree/main/apps/agent/pkg/collector"
click node_agent_client "https://github.com/yonnn101/the-startup/blob/main/apps/agent/pkg/client/client.go"
click node_agent_queue "https://github.com/yonnn101/the-startup/blob/main/apps/agent/pkg/queue/disk_queue.go"
click node_policy_library "https://github.com/yonnn101/the-startup/blob/main/packages/policy-library/src/tailoring.ts"
click node_framework_seeds "https://github.com/yonnn101/the-startup/blob/main/seeds/frameworks/index.ts"
click node_framework_registry "https://github.com/yonnn101/the-startup/tree/main/seeds/frameworks"

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_evidence,node_dashboard,node_findings,node_policies,node_risks,node_tasks,node_user toneBlue
class node_ai_service,node_ai_router,node_policy_generation,node_retrieval,node_ingestion,node_parsers,node_knowledge_repo,node_llm,node_assessment,node_db toneAmber
class node_agent_cli,node_agent_collector,node_agent_client,node_agent_queue toneMint
class node_policy_library toneRose
class node_framework_seeds,node_framework_registry toneIndigo
```

## Components

### GRC Web App

- [Web Experience](https://github.com/yonnn101/the-startup/tree/main/apps/web/app): `apps/web/app`
- [Evidence API](https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/evidence/route.ts): `apps/web/app/api/evidence/route.ts`
- [Dashboard API](https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/dashboard/route.ts): `apps/web/app/api/dashboard/route.ts`
- [Findings API](https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/findings/route.ts): `apps/web/app/api/findings/route.ts`
- [Policies API](https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/policies/route.ts): `apps/web/app/api/policies/route.ts`
- [Risk API](https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/risks/route.ts): `apps/web/app/api/risks/route.ts`
- [Task API](https://github.com/yonnn101/the-startup/blob/main/apps/web/app/api/tasks/route.ts): `apps/web/app/api/tasks/route.ts`

### AI Services

- [AI API Service](https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/main.py): `apps/ai/app/main.py`
- [Versioned API Router](https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/api/v1/router.py): `apps/ai/app/api/v1/router.py`
- [Policy Generation](https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/domain/services/policy_generation_service.py): `apps/ai/app/domain/services/policy_generation_service.py`
- [Knowledge Retrieval](https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/domain/services/knowledge_retrieval_service.py): `apps/ai/app/domain/services/knowledge_retrieval_service.py`
- [Knowledge Ingestion](https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/domain/services/knowledge_ingestion_service.py): `apps/ai/app/domain/services/knowledge_ingestion_service.py`
- [Document Parsers](https://github.com/yonnn101/the-startup/tree/main/apps/ai/app/infrastructure/parsers): `apps/ai/app/infrastructure/parsers`
- [Knowledge Repository](https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/infrastructure/persistence/pg_knowledge_repository.py): `apps/ai/app/infrastructure/persistence/pg_knowledge_repository.py`
- [LLM Adapter](https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/infrastructure/llm/litellm_adapter.py): `apps/ai/app/infrastructure/llm/litellm_adapter.py`
- [Control Assessment](https://github.com/yonnn101/the-startup/blob/main/apps/ai/app/domain/services/control_assessment_engine.py): `apps/ai/app/domain/services/control_assessment_engine.py`

### Endpoint Agent

- [Agent Command](https://github.com/yonnn101/the-startup/blob/main/apps/agent/cmd/selamtrust-agent/main.go): `apps/agent/cmd/selamtrust-agent/main.go`
- [Endpoint Collectors](https://github.com/yonnn101/the-startup/tree/main/apps/agent/pkg/collector): `apps/agent/pkg/collector`
- [Agent Client](https://github.com/yonnn101/the-startup/blob/main/apps/agent/pkg/client/client.go): `apps/agent/pkg/client/client.go`
- [Disk Queue](https://github.com/yonnn101/the-startup/blob/main/apps/agent/pkg/queue/disk_queue.go): `apps/agent/pkg/queue/disk_queue.go`

### Policy Library

- [Policy Library](https://github.com/yonnn101/the-startup/blob/main/packages/policy-library/src/tailoring.ts): `packages/policy-library/src/tailoring.ts`

### Framework Data

- [Framework Seeds](https://github.com/yonnn101/the-startup/blob/main/seeds/frameworks/index.ts): `seeds/frameworks/index.ts`
- [Framework Definitions](https://github.com/yonnn101/the-startup/tree/main/seeds/frameworks): `seeds/frameworks`

### Other components

- **Organization User**
- [Tenant Database](https://github.com/yonnn101/the-startup/blob/main/packages/db/src/tenant-client.ts): `packages/db/src/tenant-client.ts`

## Connections

- Organization User → Web Experience: uses
- Evidence API → Tenant Database: queries (evidence: `apps/web/app/api/evidence/route.ts`)
- Dashboard API → Tenant Database: queries (evidence: `apps/web/app/api/dashboard/route.ts`)
- Findings API → Tenant Database: queries (evidence: `apps/web/app/api/findings/route.ts`)
- Policies API → Tenant Database: queries (evidence: `apps/web/app/api/policies/route.ts`)
- Risk API → Tenant Database: queries (evidence: `apps/web/app/api/risks/route.ts`)
- Task API → Tenant Database: queries (evidence: `apps/web/app/api/tasks/route.ts`)
- AI API Service → Versioned API Router: mounts routes (evidence: `apps/ai/app/main.py`)
- Versioned API Router → Policy Generation: routes to
- Policy Generation → Knowledge Retrieval: retrieves context (evidence: `apps/ai/app/domain/services/policy_generation_service.py`)
- Policy Generation → LLM Adapter: generates with
- Knowledge Retrieval → Knowledge Repository: searches (evidence: `apps/ai/app/domain/services/knowledge_retrieval_service.py`)
- Knowledge Ingestion → Document Parsers: parses documents (evidence: `apps/ai/app/domain/services/knowledge_ingestion_service.py`)
- Knowledge Ingestion → Knowledge Repository: persists knowledge (evidence: `apps/ai/app/domain/services/knowledge_ingestion_service.py`)
- Agent Command → Endpoint Collectors: runs collection
- Agent Command → Agent Client: sends evidence
- Agent Command → Disk Queue: queues offline data
- Framework Seeds → Framework Definitions: loads definitions (evidence: `seeds/frameworks/index.ts`)
