# bininfotech0/r2wai architecture

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

- Interactive diagram: https://gitdiagram.com/bininfotech0/r2wai
- Repository: https://github.com/bininfotech0/r2wai

## Overview

R2WAI is a tenant-scoped platform for connecting external systems, creating and configuring AI agents, testing and publishing them, and monitoring usage. The documented journey is Connect → Create Agent → Configure → Test → Publish → Monitor. The React client fronts a .NET API; application features represent the domain capabilities, while infrastructure persists and serves them. The graph preserves the major documented stages and sampled domain areas. Some controller-to-feature and runtime wiring is not shown, so those links are omitted rather than inferred.

Main entry points: [`src/R2WAI.Api/Controllers/AssistantsController.cs`](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Api/Controllers/AssistantsController.cs) (Product API), [`src/R2WAI.Application/Features/Assistants/Queries/GetAssistantsQuery.cs`](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Application/Features/Assistants/Queries/GetAssistantsQuery.cs) (Agent management), [`src/R2WAI.Application/Features/Chat`](https://github.com/bininfotech0/r2wai/tree/main/src/R2WAI.Application/Features/Chat) (Conversations), [`src/R2WAI.Domain/Interfaces/IRepository.cs`](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Domain/Interfaces/IRepository.cs) (Repository contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_client["Web client<br/>[main.tsx]"]
end

subgraph group_api["API and identity"]
  node_auth["Authentication<br/>[AuthController.cs]"]
  node_api_routes["Product API"]
end

subgraph group_agent["Agent capabilities"]
  node_connections["External connections"]
  node_agents["Agent management"]
  node_capabilities["Tools and capabilities<br/>[ToolDefinition.cs]"]
  node_knowledge["Knowledge bases<br/>[KnowledgeBases]"]
  node_documents["Document processing<br/>[Documents]"]
  node_chat["Conversations<br/>[Chat]"]
  node_message["Message state<br/>[Message.cs]"]
  node_chatbots["Chatbot channels<br/>[Chatbots]"]
end

subgraph group_automation["Automation"]
  node_workflows["Workflow authoring<br/>[Workflow.cs]"]
  node_workflow_runtime["Workflow execution"]
  node_approvals["Approval handling<br/>[ApprovalService.cs]"]
  node_monitoring["Usage metrics"]
end

subgraph group_platform["Platform data"]
  node_tenant_user["Tenant user<br/>[User.cs]"]
  node_repository["Repository contract<br/>[IRepository.cs]"]
  node_database[("Application database")]
end

node_user(("Platform user"))

node_user -->|"uses"| node_client
node_client -.->|"requests"| node_api_routes
node_user -->|"signs in"| node_auth
node_auth -->|"loads and updates"| node_tenant_user
node_api_routes -.->|"connects"| node_connections
node_api_routes -.->|"creates agent"| node_agents
node_agents -.->|"configures tools"| node_capabilities
node_agents -.->|"configures knowledge"| node_knowledge
node_documents -.->|"adds sources"| node_knowledge
node_user -.->|"chats"| node_chat
node_chat -.->|"records messages"| node_message
node_chatbots -.->|"offers channel"| node_chat
node_workflows -.->|"executes"| node_workflow_runtime
node_workflow_runtime -.->|"requests approval"| node_approvals
node_user -->|"monitors"| node_monitoring
node_monitoring -->|"queries metrics"| node_repository
node_connections -->|"loads definitions"| node_repository
node_repository -.->|"persists entities"| node_database
node_database -->|"stores"| node_tenant_user

click node_client "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Client/src/main.tsx"
click node_auth "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Api/Controllers/AuthController.cs"
click node_api_routes "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Api/Controllers/AssistantsController.cs"
click node_connections "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Application/Features/Integrations/Queries/GetIntegrationsQueryHandler.cs"
click node_agents "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Application/Features/Assistants/Queries/GetAssistantsQuery.cs"
click node_capabilities "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Domain/Entities/ToolDefinition.cs"
click node_knowledge "https://github.com/bininfotech0/r2wai/tree/main/src/R2WAI.Application/Features/KnowledgeBases"
click node_documents "https://github.com/bininfotech0/r2wai/tree/main/src/R2WAI.Application/Features/Documents"
click node_chat "https://github.com/bininfotech0/r2wai/tree/main/src/R2WAI.Application/Features/Chat"
click node_message "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Domain/Entities/Message.cs"
click node_chatbots "https://github.com/bininfotech0/r2wai/tree/main/src/R2WAI.Application/Features/Chatbots"
click node_workflows "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Domain/Entities/Workflow.cs"
click node_workflow_runtime "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Api/Workflows/StepActivityFactory.cs"
click node_approvals "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Infrastructure/Services/ApprovalService.cs"
click node_monitoring "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Application/Features/Operations/Queries/GetMetricsQueryHandler.cs"
click node_tenant_user "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Domain/Entities/User.cs"
click node_repository "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Domain/Interfaces/IRepository.cs"
click node_database "https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Infrastructure/Persistence/ApplicationDbContext.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_client,node_user toneBlue
class node_auth,node_api_routes toneAmber
class node_connections,node_agents,node_capabilities,node_knowledge,node_documents,node_chat,node_message,node_chatbots toneMint
class node_workflows,node_workflow_runtime,node_approvals,node_monitoring toneRose
class node_tenant_user,node_repository,node_database toneIndigo
```

## Components

### User experience

- [Web client](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Client/src/main.tsx): `src/R2WAI.Client/src/main.tsx`

### API and identity

- [Authentication](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Api/Controllers/AuthController.cs): `src/R2WAI.Api/Controllers/AuthController.cs`
- [Product API](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Api/Controllers/AssistantsController.cs): `src/R2WAI.Api/Controllers/AssistantsController.cs`

### Agent capabilities

- [External connections](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Application/Features/Integrations/Queries/GetIntegrationsQueryHandler.cs): `src/R2WAI.Application/Features/Integrations/Queries/GetIntegrationsQueryHandler.cs`
- [Agent management](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Application/Features/Assistants/Queries/GetAssistantsQuery.cs): `src/R2WAI.Application/Features/Assistants/Queries/GetAssistantsQuery.cs`
- [Tools and capabilities](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Domain/Entities/ToolDefinition.cs): `src/R2WAI.Domain/Entities/ToolDefinition.cs`
- [Knowledge bases](https://github.com/bininfotech0/r2wai/tree/main/src/R2WAI.Application/Features/KnowledgeBases): `src/R2WAI.Application/Features/KnowledgeBases`
- [Document processing](https://github.com/bininfotech0/r2wai/tree/main/src/R2WAI.Application/Features/Documents): `src/R2WAI.Application/Features/Documents`
- [Conversations](https://github.com/bininfotech0/r2wai/tree/main/src/R2WAI.Application/Features/Chat): `src/R2WAI.Application/Features/Chat`
- [Message state](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Domain/Entities/Message.cs): `src/R2WAI.Domain/Entities/Message.cs`
- [Chatbot channels](https://github.com/bininfotech0/r2wai/tree/main/src/R2WAI.Application/Features/Chatbots): `src/R2WAI.Application/Features/Chatbots`

### Automation

- [Workflow authoring](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Domain/Entities/Workflow.cs): `src/R2WAI.Domain/Entities/Workflow.cs`
- [Workflow execution](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Api/Workflows/StepActivityFactory.cs): `src/R2WAI.Api/Workflows/StepActivityFactory.cs`
- [Approval handling](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Infrastructure/Services/ApprovalService.cs): `src/R2WAI.Infrastructure/Services/ApprovalService.cs`
- [Usage metrics](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Application/Features/Operations/Queries/GetMetricsQueryHandler.cs): `src/R2WAI.Application/Features/Operations/Queries/GetMetricsQueryHandler.cs`

### Platform data

- [Tenant user](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Domain/Entities/User.cs): `src/R2WAI.Domain/Entities/User.cs`
- [Repository contract](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Domain/Interfaces/IRepository.cs): `src/R2WAI.Domain/Interfaces/IRepository.cs`
- [Application database](https://github.com/bininfotech0/r2wai/blob/main/src/R2WAI.Infrastructure/Persistence/ApplicationDbContext.cs): `src/R2WAI.Infrastructure/Persistence/ApplicationDbContext.cs`

### Other components

- **Platform user**

## Connections

- Platform user → Web client: uses
- Web client → Product API: requests
- Platform user → Authentication: signs in
- Authentication → Tenant user: loads and updates (evidence: `src/R2WAI.Api/Controllers/AuthController.cs`)
- Product API → External connections: connects
- Product API → Agent management: creates agent
- Agent management → Tools and capabilities: configures tools
- Agent management → Knowledge bases: configures knowledge
- Document processing → Knowledge bases: adds sources
- Platform user → Conversations: chats
- Conversations → Message state: records messages
- Chatbot channels → Conversations: offers channel
- Workflow authoring → Workflow execution: executes
- Workflow execution → Approval handling: requests approval
- Platform user → Usage metrics: monitors
- Usage metrics → Repository contract: queries metrics (evidence: `src/R2WAI.Application/Features/Operations/Queries/GetMetricsQueryHandler.cs`)
- External connections → Repository contract: loads definitions (evidence: `src/R2WAI.Application/Features/Integrations/Queries/GetIntegrationsQueryHandler.cs`)
- Repository contract → Application database: persists entities
- Application database → Tenant user: stores (evidence: `src/R2WAI.Infrastructure/Persistence/ApplicationDbContext.cs`)
