# business8281/nuvexadb architecture

> Architecture diagram of the GitHub repository business8281/nuvexadb, 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/business8281/nuvexadb
- Repository: https://github.com/business8281/nuvexadb

## Overview

This repository is a Next.js commerce administration application with a substantial AI-agent and knowledge-ingestion runtime. The clearest evidenced runtime workflow is a scheduled worker claiming queued tasks, processing them through the agent engine, and accessing agent tools and Firebase Data Connect. Store operations, payments, reporting, and administration are prominent in the route tree, but their internal connections were not sampled; those capabilities are shown without inferred call paths.

Main entry points: [`src/lib/services/agent/agent-engine.ts`](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/agent-engine.ts) (Agent engine), [`src/lib/services/knowledge/fdc-client.ts`](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/knowledge/fdc-client.ts) (Data Connect client), [`src/app/api/agents/worker/route.ts`](https://github.com/business8281/nuvexadb/blob/main/src/app/api/agents/worker/route.ts) (Task worker), [`src/app/admin/(dashboard)/stores/[storeId]/page.tsx`](https://github.com/business8281/nuvexadb/blob/main/src/app/admin/(dashboard)/stores/%5BstoreId%5D/page.tsx) (Store admin)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commerce["Commerce administration"]
  node_admin["Store admin<br/>[page.tsx]"]
  node_store_ops["Store operations<br/>[page.tsx]"]
  node_analytics["Analytics and reports<br/>[page.tsx]"]
  node_payments["Payments<br/>[route.ts]"]
  node_category_manager["Category manager"]
  node_format_manager["Format manager"]
end

subgraph group_agents["Agent runtime"]
  node_agent_admin["Agent console<br/>[page.tsx]"]
  node_worker["Task worker<br/>[route.ts]"]
  node_queue["Task queue<br/>[task-queue.ts]"]
  node_engine["Agent engine<br/>[agent-engine.ts]"]
  node_tool_registry["Tool registry<br/>[tool-registry.ts]"]
  node_business_tools["Commerce tools<br/>[products-tools.ts]"]
  node_analytics_tools["Analytics tools<br/>[analytics-tools.ts]"]
  node_security["Security and approvals"]
  node_task_manager["Task manager<br/>[task-manager.ts]"]
  node_orchestrator["Subtask orchestrator"]
  node_memory["Agent memory<br/>[memory-service.ts]"]
  node_telemetry["Telemetry<br/>[telemetry.ts]"]
end

subgraph group_knowledge["Knowledge and data"]
  node_knowledge_ingest_api["Knowledge ingestion API<br/>[route.ts]"]
  node_ingestion["Document ingestion"]
  node_fdc_client["Data Connect client<br/>[fdc-client.ts]"]
  node_data_connect[("Firebase Data Connect")]
end

subgraph group_shared["Shared services"]
  node_firebase["Firebase configuration<br/>[config.ts]"]
  node_email["Email service<br/>[email.ts]"]
  node_button["Button primitive<br/>[button.tsx]"]
  node_dialog["Dialog primitive<br/>[dialog.tsx]"]
  node_input["Input primitive<br/>[input.tsx]"]
end

node_worker_actor(("Scheduler"))

node_worker_actor -.->|"invokes tick"| node_worker
node_worker -->|"claims and processes"| node_queue
node_queue -.->|"processes task"| node_engine
node_engine -->|"registers tools"| node_tool_registry
node_engine -->|"registers tools"| node_business_tools
node_engine -->|"imports tools"| node_analytics_tools
node_engine -->|"checks permissions"| node_security
node_engine -->|"manages tasks"| node_task_manager
node_engine -->|"uses memory"| node_memory
node_engine -->|"logs events"| node_telemetry
node_engine -->|"runs operations"| node_fdc_client
node_orchestrator -->|"saves task result"| node_memory
node_orchestrator -->|"requeues parent"| node_fdc_client
node_security -->|"checks approval"| node_fdc_client
node_knowledge_ingest_api -.->|"starts ingestion"| node_ingestion
node_ingestion -->|"stores chunks"| node_fdc_client
node_fdc_client -->|"reads project config"| node_firebase
node_fdc_client -->|"queries and mutates"| node_data_connect
node_worker -->|"initializes connection"| node_firebase
node_category_manager -->|"renders"| node_button
node_category_manager -->|"renders"| node_dialog
node_category_manager -->|"renders"| node_input
node_format_manager -->|"renders"| node_button
node_format_manager -->|"renders"| node_dialog
node_format_manager -->|"renders"| node_input
node_admin -.->|"offers store workflows"| node_store_ops
node_admin -.->|"offers reporting"| node_analytics
node_admin -.->|"offers payment workflows"| node_payments
node_agent_admin -.->|"supports agent operations"| node_worker
node_email -.-> node_data_connect

click node_admin "https://github.com/business8281/nuvexadb/blob/main/src/app/admin/(dashboard)/stores/%5BstoreId%5D/page.tsx"
click node_store_ops "https://github.com/business8281/nuvexadb/blob/main/src/app/admin/(dashboard)/stores/%5BstoreId%5D/orders/page.tsx"
click node_analytics "https://github.com/business8281/nuvexadb/blob/main/src/app/admin/(dashboard)/analytics/page.tsx"
click node_payments "https://github.com/business8281/nuvexadb/blob/main/src/app/api/razorpay/create-order/route.ts"
click node_agent_admin "https://github.com/business8281/nuvexadb/blob/main/src/app/admin/(dashboard)/ai/page.tsx"
click node_worker "https://github.com/business8281/nuvexadb/blob/main/src/app/api/agents/worker/route.ts"
click node_queue "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/task-queue.ts"
click node_engine "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/agent-engine.ts"
click node_tool_registry "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/tools/tool-registry.ts"
click node_business_tools "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/tools/products-tools.ts"
click node_analytics_tools "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/tools/analytics-tools.ts"
click node_security "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/security-manager.ts"
click node_task_manager "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/task-manager.ts"
click node_orchestrator "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/orchestrator-service.ts"
click node_memory "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/memory-service.ts"
click node_telemetry "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/telemetry.ts"
click node_knowledge_ingest_api "https://github.com/business8281/nuvexadb/blob/main/src/app/api/knowledge/ingest/route.ts"
click node_ingestion "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/knowledge/ingestion-service.ts"
click node_fdc_client "https://github.com/business8281/nuvexadb/blob/main/src/lib/services/knowledge/fdc-client.ts"
click node_firebase "https://github.com/business8281/nuvexadb/blob/main/src/lib/firebase/config.ts"
click node_email "https://github.com/business8281/nuvexadb/blob/main/src/lib/email.ts"
click node_button "https://github.com/business8281/nuvexadb/blob/main/src/components/ui/button.tsx"
click node_dialog "https://github.com/business8281/nuvexadb/blob/main/src/components/ui/dialog.tsx"
click node_input "https://github.com/business8281/nuvexadb/blob/main/src/components/ui/input.tsx"
click node_category_manager "https://github.com/business8281/nuvexadb/blob/main/src/components/admin/CategoryManagerModal.tsx"
click node_format_manager "https://github.com/business8281/nuvexadb/blob/main/src/components/admin/FormatManagerModal.tsx"

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_admin,node_store_ops,node_analytics,node_payments,node_category_manager,node_format_manager toneBlue
class node_agent_admin,node_worker,node_queue,node_engine,node_tool_registry,node_business_tools,node_analytics_tools,node_security,node_task_manager,node_orchestrator,node_memory,node_telemetry toneAmber
class node_knowledge_ingest_api,node_ingestion,node_fdc_client,node_data_connect toneMint
class node_firebase,node_email,node_button,node_dialog,node_input,node_worker_actor toneRose
```

## Components

### Commerce administration

- [Store admin](https://github.com/business8281/nuvexadb/blob/main/src/app/admin/(dashboard)/stores/%5BstoreId%5D/page.tsx): `src/app/admin/(dashboard)/stores/[storeId]/page.tsx`
- [Store operations](https://github.com/business8281/nuvexadb/blob/main/src/app/admin/(dashboard)/stores/%5BstoreId%5D/orders/page.tsx): `src/app/admin/(dashboard)/stores/[storeId]/orders/page.tsx`
- [Analytics and reports](https://github.com/business8281/nuvexadb/blob/main/src/app/admin/(dashboard)/analytics/page.tsx): `src/app/admin/(dashboard)/analytics/page.tsx`
- [Payments](https://github.com/business8281/nuvexadb/blob/main/src/app/api/razorpay/create-order/route.ts): `src/app/api/razorpay/create-order/route.ts`
- [Category manager](https://github.com/business8281/nuvexadb/blob/main/src/components/admin/CategoryManagerModal.tsx): `src/components/admin/CategoryManagerModal.tsx`
- [Format manager](https://github.com/business8281/nuvexadb/blob/main/src/components/admin/FormatManagerModal.tsx): `src/components/admin/FormatManagerModal.tsx`

### Agent runtime

- [Agent console](https://github.com/business8281/nuvexadb/blob/main/src/app/admin/(dashboard)/ai/page.tsx): `src/app/admin/(dashboard)/ai/page.tsx`
- [Task worker](https://github.com/business8281/nuvexadb/blob/main/src/app/api/agents/worker/route.ts): `src/app/api/agents/worker/route.ts`
- [Task queue](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/task-queue.ts): `src/lib/services/agent/task-queue.ts`
- [Agent engine](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/agent-engine.ts): `src/lib/services/agent/agent-engine.ts`
- [Tool registry](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/tools/tool-registry.ts): `src/lib/services/agent/tools/tool-registry.ts`
- [Commerce tools](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/tools/products-tools.ts): `src/lib/services/agent/tools/products-tools.ts`
- [Analytics tools](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/tools/analytics-tools.ts): `src/lib/services/agent/tools/analytics-tools.ts`
- [Security and approvals](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/security-manager.ts): `src/lib/services/agent/security-manager.ts`
- [Task manager](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/task-manager.ts): `src/lib/services/agent/task-manager.ts`
- [Subtask orchestrator](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/orchestrator-service.ts): `src/lib/services/agent/orchestrator-service.ts`
- [Agent memory](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/memory-service.ts): `src/lib/services/agent/memory-service.ts`
- [Telemetry](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/agent/telemetry.ts): `src/lib/services/agent/telemetry.ts`

### Knowledge and data

- [Knowledge ingestion API](https://github.com/business8281/nuvexadb/blob/main/src/app/api/knowledge/ingest/route.ts): `src/app/api/knowledge/ingest/route.ts`
- [Document ingestion](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/knowledge/ingestion-service.ts): `src/lib/services/knowledge/ingestion-service.ts`
- [Data Connect client](https://github.com/business8281/nuvexadb/blob/main/src/lib/services/knowledge/fdc-client.ts): `src/lib/services/knowledge/fdc-client.ts`
- **Firebase Data Connect**

### Shared services

- [Firebase configuration](https://github.com/business8281/nuvexadb/blob/main/src/lib/firebase/config.ts): `src/lib/firebase/config.ts`
- [Email service](https://github.com/business8281/nuvexadb/blob/main/src/lib/email.ts): `src/lib/email.ts`
- [Button primitive](https://github.com/business8281/nuvexadb/blob/main/src/components/ui/button.tsx): `src/components/ui/button.tsx`
- [Dialog primitive](https://github.com/business8281/nuvexadb/blob/main/src/components/ui/dialog.tsx): `src/components/ui/dialog.tsx`
- [Input primitive](https://github.com/business8281/nuvexadb/blob/main/src/components/ui/input.tsx): `src/components/ui/input.tsx`

### Other components

- **Scheduler**

## Connections

- Scheduler → Task worker: invokes tick
- Task worker → Task queue: claims and processes (evidence: `src/app/api/agents/worker/route.ts`)
- Task queue → Agent engine: processes task (evidence: `src/lib/services/agent/task-queue.ts`)
- Agent engine → Tool registry: registers tools (evidence: `src/lib/services/agent/agent-engine.ts`)
- Agent engine → Commerce tools: registers tools (evidence: `src/lib/services/agent/agent-engine.ts`)
- Agent engine → Analytics tools: imports tools (evidence: `src/lib/services/agent/agent-engine.ts`)
- Agent engine → Security and approvals: checks permissions (evidence: `src/lib/services/agent/agent-engine.ts`)
- Agent engine → Task manager: manages tasks (evidence: `src/lib/services/agent/agent-engine.ts`)
- Agent engine → Agent memory: uses memory (evidence: `src/lib/services/agent/agent-engine.ts`)
- Agent engine → Telemetry: logs events (evidence: `src/lib/services/agent/agent-engine.ts`)
- Agent engine → Data Connect client: runs operations (evidence: `src/lib/services/agent/agent-engine.ts`)
- Subtask orchestrator → Agent memory: saves task result (evidence: `src/lib/services/agent/orchestrator-service.ts`)
- Subtask orchestrator → Data Connect client: requeues parent (evidence: `src/lib/services/agent/orchestrator-service.ts`)
- Security and approvals → Data Connect client: checks approval (evidence: `src/lib/services/agent/security-manager.ts`)
- Knowledge ingestion API → Document ingestion: starts ingestion
- Document ingestion → Data Connect client: stores chunks (evidence: `src/lib/services/knowledge/ingestion-service.ts`)
- Data Connect client → Firebase configuration: reads project config (evidence: `src/lib/services/knowledge/fdc-client.ts`)
- Data Connect client → Firebase Data Connect: queries and mutates (evidence: `src/lib/services/knowledge/fdc-client.ts`)
- Task worker → Firebase configuration: initializes connection (evidence: `src/app/api/agents/worker/route.ts`)
- Category manager → Button primitive: renders (evidence: `src/components/admin/CategoryManagerModal.tsx`)
- Category manager → Dialog primitive: renders (evidence: `src/components/admin/CategoryManagerModal.tsx`)
- Category manager → Input primitive: renders (evidence: `src/components/admin/CategoryManagerModal.tsx`)
- Format manager → Button primitive: renders (evidence: `src/components/admin/FormatManagerModal.tsx`)
- Format manager → Dialog primitive: renders (evidence: `src/components/admin/FormatManagerModal.tsx`)
- Format manager → Input primitive: renders (evidence: `src/components/admin/FormatManagerModal.tsx`)
- Store admin → Store operations: offers store workflows
- Store admin → Analytics and reports: offers reporting
- Store admin → Payments: offers payment workflows
- Agent console → Task worker: supports agent operations
- Email service → Firebase Data Connect
