# thesauravyadav925925-gif/cognicore architecture

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

- Interactive diagram: https://gitdiagram.com/thesauravyadav925925-gif/cognicore
- Repository: https://github.com/thesauravyadav925925-gif/cognicore

## Overview

CogniCore is an enterprise data copilot: users connect or upload structured data and documents, ask questions, and receive answers grounded in executed queries or retrieved passages. The main path runs from the client through API routes into query planning and specialized engines, then composes an answer with evidence. Separate branches cover ingestion, analytics and reporting, permissions and governance, and tools/actions. The graph follows the sampled code and README; some feature links use README documentation because their route or implementation source was not excerpted.

Main entry points: [`server/src/app.js`](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/app.js) (HTTP API), [`server/src/core/engines/structured.engine.js`](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/engines/structured.engine.js) (Structured engine), [`server/src/ingestion/ingestion.pipeline.js`](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/ingestion/ingestion.pipeline.js) (File ingestion), [`server/src/core/query.router.js`](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/query.router.js) (Query router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_webapp["Workspace UI<br/>[App.jsx]"]
  node_clientstate["App and auth state<br/>[AppState.jsx]"]
  node_chat["Chat panel<br/>[ChatPanel.jsx]"]
  node_clientapi["API client<br/>[api.js]"]
end

subgraph group_ingest["Data onboarding"]
  node_ingestpipe["File ingestion"]
  node_connectpipe["Database connections"]
  node_docpipe["Document ingestion"]
  node_adapters["Source adapters<br/>[index.js]"]
  node_schema["Schema discovery<br/>[schema.analyzer.js]"]
  node_registry[("Dataset registry")]
end

subgraph group_query["Question answering"]
  node_core["Query coordinator<br/>[core.engine.js]"]
  node_router["Query router<br/>[query.router.js]"]
  node_structured["Structured engine"]
  node_document["Document retrieval<br/>[document.engine.js]"]
  node_hybrid["Hybrid engine<br/>[hybrid.engine.js]"]
  node_analysis["Deep analysis<br/>[analysis.engine.js]"]
  node_evidence["Evidence builder"]
  node_llm["Model providers<br/>[model.manager.js]"]
end

subgraph group_insights["Analytics and tools"]
  node_analytics["Analytics capabilities"]
  node_reports["Reports and exports"]
  node_tools["Tools and charts"]
end

subgraph group_govern["Security and governance"]
  node_auth["Authentication and roles<br/>[auth.registry.js]"]
  node_policies["Data access policies<br/>[data.policy.js]"]
  node_actions["Approval actions"]
  node_knowledge[("Organizational knowledge")]
end

node_user(("User"))
node_api["HTTP API<br/>[app.js]"]

node_user -->|"uses"| node_webapp
node_webapp -->|"provides state"| node_clientstate
node_webapp -->|"renders"| node_chat
node_chat -->|"requests answers"| node_clientapi
node_clientapi -->|"calls endpoints"| node_api
node_api -.->|"accepts uploads"| node_ingestpipe
node_api -.->|"connects sources"| node_connectpipe
node_ingestpipe -->|"selects adapter"| node_adapters
node_ingestpipe -->|"routes documents"| node_docpipe
node_ingestpipe -->|"analyzes schema"| node_schema
node_ingestpipe -->|"registers datasets"| node_registry
node_connectpipe -->|"selects adapter"| node_adapters
node_connectpipe -->|"reads schema"| node_schema
node_connectpipe -->|"registers datasets"| node_registry
node_core -->|"routes questions"| node_router
node_router -->|"dispatches structured"| node_structured
node_router -->|"dispatches document"| node_document
node_router -->|"dispatches hybrid"| node_hybrid
node_router -->|"dispatches analysis"| node_analysis
node_structured -->|"executes queries"| node_adapters
node_structured -->|"builds evidence"| node_evidence
node_document -->|"builds evidence"| node_evidence
node_hybrid -->|"runs structured"| node_structured
node_hybrid -->|"retrieves passages"| node_document
node_hybrid -->|"combines evidence"| node_evidence
node_structured -->|"generates SQL"| node_llm
node_analysis -->|"runs subqueries"| node_structured
node_api -.->|"offers analysis"| node_analytics
node_api -.->|"offers reports"| node_reports
node_api -.->|"offers tools"| node_tools
node_api -.->|"offers authentication"| node_auth
node_api -.->|"enforces data access"| node_policies
node_api -.->|"offers approvals"| node_actions
node_api -.->|"offers knowledge"| node_knowledge

click node_webapp "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/client/src/App.jsx"
click node_clientstate "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/client/src/state/AppState.jsx"
click node_chat "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/client/src/components/ChatPanel.jsx"
click node_clientapi "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/client/src/services/api.js"
click node_api "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/app.js"
click node_ingestpipe "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/ingestion/ingestion.pipeline.js"
click node_connectpipe "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/ingestion/connection.pipeline.js"
click node_docpipe "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/ingestion/document.pipeline.js"
click node_adapters "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/ingestion/adapters/index.js"
click node_schema "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/schema/schema.analyzer.js"
click node_registry "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/ingestion/dataset.registry.js"
click node_core "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/core.engine.js"
click node_router "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/query.router.js"
click node_structured "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/engines/structured.engine.js"
click node_document "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/engines/document.engine.js"
click node_hybrid "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/engines/hybrid.engine.js"
click node_analysis "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/engines/analysis.engine.js"
click node_evidence "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/evidence/evidence.manager.js"
click node_llm "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/llm/model.manager.js"
click node_analytics "https://github.com/thesauravyadav925925-gif/cognicore/tree/main/server/src/analytics"
click node_reports "https://github.com/thesauravyadav925925-gif/cognicore/tree/main/server/src/report"
click node_tools "https://github.com/thesauravyadav925925-gif/cognicore/tree/main/server/src/tools"
click node_auth "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/security/auth.registry.js"
click node_policies "https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/security/data.policy.js"
click node_actions "https://github.com/thesauravyadav925925-gif/cognicore/tree/main/server/src/actions"
click node_knowledge "https://github.com/thesauravyadav925925-gif/cognicore/tree/main/server/src/knowledge"

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_clientstate,node_chat,node_clientapi,node_user toneBlue
class node_ingestpipe,node_connectpipe,node_docpipe,node_adapters,node_schema,node_registry toneAmber
class node_core,node_router,node_structured,node_document,node_hybrid,node_analysis,node_evidence,node_llm,node_api toneMint
class node_analytics,node_reports,node_tools toneRose
class node_auth,node_policies,node_actions,node_knowledge toneIndigo
```

## Components

### Client experience

- [Workspace UI](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [App and auth state](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/client/src/state/AppState.jsx): `client/src/state/AppState.jsx`
- [Chat panel](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/client/src/components/ChatPanel.jsx): `client/src/components/ChatPanel.jsx`
- [API client](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/client/src/services/api.js): `client/src/services/api.js`

### Data onboarding

- [File ingestion](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/ingestion/ingestion.pipeline.js): `server/src/ingestion/ingestion.pipeline.js`
- [Database connections](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/ingestion/connection.pipeline.js): `server/src/ingestion/connection.pipeline.js`
- [Document ingestion](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/ingestion/document.pipeline.js): `server/src/ingestion/document.pipeline.js`
- [Source adapters](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/ingestion/adapters/index.js): `server/src/ingestion/adapters/index.js`
- [Schema discovery](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/schema/schema.analyzer.js): `server/src/schema/schema.analyzer.js`
- [Dataset registry](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/ingestion/dataset.registry.js): `server/src/ingestion/dataset.registry.js`

### Question answering

- [Query coordinator](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/core.engine.js): `server/src/core/core.engine.js`
- [Query router](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/query.router.js): `server/src/core/query.router.js`
- [Structured engine](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/engines/structured.engine.js): `server/src/core/engines/structured.engine.js`
- [Document retrieval](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/engines/document.engine.js): `server/src/core/engines/document.engine.js`
- [Hybrid engine](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/engines/hybrid.engine.js): `server/src/core/engines/hybrid.engine.js`
- [Deep analysis](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/core/engines/analysis.engine.js): `server/src/core/engines/analysis.engine.js`
- [Evidence builder](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/evidence/evidence.manager.js): `server/src/evidence/evidence.manager.js`
- [Model providers](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/llm/model.manager.js): `server/src/llm/model.manager.js`

### Analytics and tools

- [Analytics capabilities](https://github.com/thesauravyadav925925-gif/cognicore/tree/main/server/src/analytics): `server/src/analytics`
- [Reports and exports](https://github.com/thesauravyadav925925-gif/cognicore/tree/main/server/src/report): `server/src/report`
- [Tools and charts](https://github.com/thesauravyadav925925-gif/cognicore/tree/main/server/src/tools): `server/src/tools`

### Security and governance

- [Authentication and roles](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/security/auth.registry.js): `server/src/security/auth.registry.js`
- [Data access policies](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/security/data.policy.js): `server/src/security/data.policy.js`
- [Approval actions](https://github.com/thesauravyadav925925-gif/cognicore/tree/main/server/src/actions): `server/src/actions`
- [Organizational knowledge](https://github.com/thesauravyadav925925-gif/cognicore/tree/main/server/src/knowledge): `server/src/knowledge`

### Other components

- **User**
- [HTTP API](https://github.com/thesauravyadav925925-gif/cognicore/blob/main/server/src/app.js): `server/src/app.js`

## Connections

- User → Workspace UI: uses (evidence: `client/src/App.jsx`)
- Workspace UI → App and auth state: provides state (evidence: `client/src/App.jsx`)
- Workspace UI → Chat panel: renders (evidence: `client/src/App.jsx`)
- Chat panel → API client: requests answers (evidence: `client/src/components/ChatPanel.jsx`)
- API client → HTTP API: calls endpoints (evidence: `client/src/services/api.js`)
- HTTP API → File ingestion: accepts uploads (evidence: `README.md`)
- HTTP API → Database connections: connects sources (evidence: `README.md`)
- File ingestion → Source adapters: selects adapter (evidence: `server/src/ingestion/ingestion.pipeline.js`)
- File ingestion → Document ingestion: routes documents (evidence: `server/src/ingestion/ingestion.pipeline.js`)
- File ingestion → Schema discovery: analyzes schema (evidence: `server/src/ingestion/ingestion.pipeline.js`)
- File ingestion → Dataset registry: registers datasets (evidence: `server/src/ingestion/ingestion.pipeline.js`)
- Database connections → Source adapters: selects adapter (evidence: `server/src/ingestion/connection.pipeline.js`)
- Database connections → Schema discovery: reads schema (evidence: `server/src/ingestion/connection.pipeline.js`)
- Database connections → Dataset registry: registers datasets (evidence: `server/src/ingestion/connection.pipeline.js`)
- Query coordinator → Query router: routes questions (evidence: `server/src/core/core.engine.js`)
- Query router → Structured engine: dispatches structured (evidence: `server/src/core/query.router.js`)
- Query router → Document retrieval: dispatches document (evidence: `server/src/core/query.router.js`)
- Query router → Hybrid engine: dispatches hybrid (evidence: `server/src/core/query.router.js`)
- Query router → Deep analysis: dispatches analysis (evidence: `server/src/core/query.router.js`)
- Structured engine → Source adapters: executes queries (evidence: `server/src/core/engines/structured.engine.js`)
- Structured engine → Evidence builder: builds evidence (evidence: `server/src/core/engines/structured.engine.js`)
- Document retrieval → Evidence builder: builds evidence (evidence: `server/src/core/engines/document.engine.js`)
- Hybrid engine → Structured engine: runs structured (evidence: `server/src/core/engines/hybrid.engine.js`)
- Hybrid engine → Document retrieval: retrieves passages (evidence: `server/src/core/engines/hybrid.engine.js`)
- Hybrid engine → Evidence builder: combines evidence (evidence: `server/src/core/engines/hybrid.engine.js`)
- Structured engine → Model providers: generates SQL (evidence: `server/src/core/engines/structured.engine.js`)
- Deep analysis → Structured engine: runs subqueries (evidence: `server/src/core/engines/analysis.engine.js`)
- HTTP API → Analytics capabilities: offers analysis (evidence: `README.md`)
- HTTP API → Reports and exports: offers reports (evidence: `README.md`)
- HTTP API → Tools and charts: offers tools (evidence: `README.md`)
- HTTP API → Authentication and roles: offers authentication (evidence: `README.md`)
- HTTP API → Data access policies: enforces data access (evidence: `README.md`)
- HTTP API → Approval actions: offers approvals (evidence: `README.md`)
- HTTP API → Organizational knowledge: offers knowledge (evidence: `README.md`)
