System Architecture

Complete architectural overview of the BizFirstAI platform with detailed component interactions and data flows.

6-Layer Architecture Model

graph TB subgraph Layer1["🎨 Presentation Layer"] UI["BizFirst AI Studio
React 18 + React Flow
150+ Node Types
3-Mode Interface"] end subgraph Layer2["🔌 API & Real-time Layer"] REST["REST Controllers
HTTP/REST
GoWebRequest/Response"] SIG["EdgeStream Hub
SignalR 8.0
WebSocket Communication"] end subgraph Layer3["⚙️ Orchestration Layer"] Flow["ProcessEngine
Stack-based LIFO
26 Executors
Pause/Resume/Cancel"] end subgraph Layer4["🧠 Intelligence Layer"] Oct["Octopus AI Engine
15+ LLM Providers
40+ Plugins
MCP Integration"] end subgraph Layer5["💾 Data Layer"] DB["Atlas Data Ocean
SQL Server / PostgreSQL
40+ Tables
EF Core ORM"] end subgraph Layer6["📋 Schema Layer"] Forms["Atlas Forms
Schema-Driven UI
20+ Controls
JSON Configuration"] end UI -->|REST| REST UI -->|WebSocket| SIG REST --> Flow Flow -->|Events| SIG Flow -->|Invoker| Oct Flow -->|ORM| DB Forms <-->|Schema| DB SIG -->|Broadcast| UI Oct <-->|Queries| DB style Layer1 fill:#1f6feb,stroke:#58a6ff,stroke-width:2px,color:#c9d1d9 style Layer2 fill:#238636,stroke:#3fb950,stroke-width:2px,color:#c9d1d9 style Layer3 fill:#9e6a03,stroke:#fb8500,stroke-width:2px,color:#c9d1d9 style Layer4 fill:#ae3f6e,stroke:#f97583,stroke-width:2px,color:#c9d1d9 style Layer5 fill:#1158c7,stroke:#58a6ff,stroke-width:2px,color:#c9d1d9 style Layer6 fill:#54aeff,stroke:#58a6ff,stroke-width:2px,color:#c9d1d9

Key insight: Each layer has a single responsibility with clear interfaces. Communication is asynchronous where possible for scalability.

Execution Flow Architecture

graph LR A["Studio
User Clicks
Execute"] -->|1. HTTP POST
execute| B["ProcessEngine
API"] B -->|2. Load
ProcessDef| C["Database"] C -->|3. ProcessDef
+ Variables| B B -->|4. Initialize
Execution
Stack| D["Orchestration
Processor"] D -->|5. Pop
Trigger Node| E["Execute
Trigger
Executor"] E -->|6. Output
Port Key| F["Execution
Router"] F -->|7. Find
Downstream| C C -->|8. Next
Nodes| F F -->|9. Push
to Stack| D D -->|10. Loop
Until Empty| E E -->|11. Events
NodeExecuting| G["SignalR
Hub"] G -->|12. Broadcast
WebSocket| H["Studio
Real-time
Updates"] E -->|13. Results
to Database| C style A fill:#1f6feb,stroke:#58a6ff,color:#c9d1d9 style B fill:#238636,stroke:#3fb950,color:#c9d1d9 style C fill:#1158c7,stroke:#58a6ff,color:#c9d1d9 style D fill:#9e6a03,stroke:#fb8500,color:#c9d1d9 style E fill:#9e6a03,stroke:#fb8500,color:#c9d1d9 style F fill:#9e6a03,stroke:#fb8500,color:#c9d1d9 style G fill:#238636,stroke:#3fb950,color:#c9d1d9 style H fill:#1f6feb,stroke:#58a6ff,color:#c9d1d9

Stack-Based Execution Model (LIFO)

How It Works

1. Initialization
Push trigger node onto ExecutionStack

2. Execution
Pop top node from stack

3. Routing
ExecutionRouter finds downstream nodes for output port

4. Stacking
Push downstream nodes onto stack

5. Loop
Repeat until stack is empty

Example Workflow

graph TD T["🟦 Trigger
Manual Trigger"] N1["🟩 Node 1
Data Mapping"] N2["🟧 Node 2
AI Agent"] N3["🟩 Node 3
Send Email"] N4["🟩 Node 4
Log Result"] T -->|Output
main| N1 N1 -->|Output
main| N2 N2 -->|Output
main| N3 N2 -->|Output
error| N4 style T fill:#1f6feb,stroke:#58a6ff,color:#c9d1d9 style N1 fill:#238636,stroke:#3fb950,color:#c9d1d9 style N2 fill:#ae3f6e,stroke:#f97583,color:#c9d1d9 style N3 fill:#238636,stroke:#3fb950,color:#c9d1d9 style N4 fill:#238636,stroke:#3fb950,color:#c9d1d9

Execution Stack Progression:
1. [T] → 2. [N1] → 3. [N2, N3] → 4. [N3] → 5. [] (done)

Component Integration Matrix

From Component To Component Communication Method Data Format Sync/Async
Studio Flow REST API (HTTP) JSON (GoWebRequest) Async
Flow Octopus In-process (IAgentInvoker) Dictionary Sync
Flow EdgeStream Event Publisher ProcessHubMessageResponse Async
EdgeStream Studio SignalR (WebSocket) JSON (SignalR protocol) Real-time
Flow Database EF Core ORM Mapped Entities Sync
Octopus Database EF Core ORM + Custom Queries Mapped Entities Sync
Studio Forms React Component JSON Schema Sync
Octopus External LLMs REST/WebSocket API Provider-specific JSON Async

Architecture Design Principles

Separation of Concerns

Each layer has single responsibility with clear interfaces. Design→Execution→Intelligence layers are loosely coupled.

Dependency Injection

All dependencies injected via constructor. Enables testing, mocking, and runtime swapping of implementations.

Plugin Architecture

40+ plugins extend platform without core modification. New providers, utilities, integrations are plugin-based.

Multi-Tenancy First

TenantID enforced at database level. Queries automatically filtered by tenant. Data isolation guaranteed.

Event-Driven

Components communicate via events for loose coupling. ProcessEngine raises 5+ event types broadcasted to clients.

Schema-Driven

Forms defined via JSON schema. Enables no-code UI generation and dynamic control configuration.

Performance & Scalability

<100ms
Event Latency (SignalR)

Real-time updates to clients via WebSocket

10K+
Concurrent Workflows

Parallel execution capability

99.99%
Uptime SLA

With automatic fallback mechanisms