Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions _sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

* **Architectures**
* [Overview](architectures/readme.md)
* **Agentic architecture**
* [Overview](architectures/agentic-architecture/readme.md)
* [Data flow](architectures/agentic-architecture/data-flow.md)
* [Folder structure](architectures/agentic-architecture/folder-structure.md)
* [Implementation guide](architectures/agentic-architecture/implementation-guide.md)
* [Trade offs](architectures/agentic-architecture/trade-offs.md)
* **Backend for frontend**
* [Overview](architectures/backend-for-frontend/readme.md)
* [Data flow](architectures/backend-for-frontend/data-flow.md)
Expand Down Expand Up @@ -56,6 +62,12 @@
* [Folder structure](architectures/micro-frontends/folder-structure.md)
* [Implementation guide](architectures/micro-frontends/implementation-guide.md)
* [Trade offs](architectures/micro-frontends/trade-offs.md)
* **Microkernel architecture**
* [Overview](architectures/microkernel-architecture/readme.md)
* [Data flow](architectures/microkernel-architecture/data-flow.md)
* [Folder structure](architectures/microkernel-architecture/folder-structure.md)
* [Implementation guide](architectures/microkernel-architecture/implementation-guide.md)
* [Trade offs](architectures/microkernel-architecture/trade-offs.md)
* **Microservices**
* [Overview](architectures/microservices/readme.md)
* [Data flow](architectures/microservices/data-flow.md)
Expand Down
57 changes: 57 additions & 0 deletions architectures/agentic-architecture/data-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
technology: Agentic Architecture
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [ai-agents, orchestration, multi-agent-systems, vibe-coding, best-practices]
ai_role: Senior Software Architect
last_updated: 2026-05-03
---

<div align="center">
# 🤖 Agentic Architecture - Data Flow
</div>

---

## ❌ Bad Practice
Unstructured flow without a centralized orchestrator where agents call each other directly or loop infinitely.
```mermaid
sequenceDiagram
participant User
participant Planner
participant Coder
participant Reviewer

User->>Planner: Request
Planner->>Coder: Instruct
Coder->>Reviewer: Verify
Reviewer->>Coder: Fix
Coder->>Planner: Done?
```

## ⚠️ Problem
When agents interact in an unmanaged peer-to-peer network, you risk infinite loops, context overflow, and non-deterministic results that are impossible to debug or validate systemically.

## ✅ Best Practice
Orchestrator-driven flow ensuring strict validation at every stage.
```mermaid
sequenceDiagram
participant User
participant Orchestrator
participant Planner
participant Coder
participant Reviewer

User->>Orchestrator: Request
Orchestrator->>Planner: Generate Plan
Planner-->>Orchestrator: Validated Plan JSON
Orchestrator->>Coder: Execute Step 1
Coder-->>Orchestrator: Code Payload
Orchestrator->>Reviewer: Validate Code
Reviewer-->>Orchestrator: Approved
Orchestrator-->>User: Final Output
```

## 🚀 Solution
Centralizing data flow through an Orchestrator guarantees predictability, limits token consumption by bounding the context passed to each specialized worker, and enforces schema validation before the next agent takes over.
53 changes: 53 additions & 0 deletions architectures/agentic-architecture/folder-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
technology: Agentic Architecture
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [ai-agents, orchestration, multi-agent-systems, vibe-coding, best-practices]
ai_role: Senior Software Architect
last_updated: 2026-05-03
---

<div align="center">
# 🤖 Agentic Architecture - Folder Structure
</div>

---

## ❌ Bad Practice
Lumping all prompts, system instructions, and agent logic into a single file or directory.

## ⚠️ Problem
Monolithic agent codebases prevent reusability of skills, make prompts difficult to version control, and cause context pollution as the system scales.

## ✅ Best Practice
Isolating agents by domain and separating prompts from execution logic.
```mermaid
classDiagram
class AgentSystem:::component
note for AgentSystem "Root Agentic Directory"

class Orchestrator:::layout
note for Orchestrator "Orchestrator Logic"

class Agents:::component
note for Agents "Specialized Agents"

class Skills:::component
note for Skills "Reusable Tools/Functions"

class Prompts:::layout
note for Prompts "Versioned System Prompts"

AgentSystem --> Orchestrator
AgentSystem --> Agents
AgentSystem --> Skills
AgentSystem --> Prompts

classDef default fill:#e1f5fe,stroke:#03a9f4,stroke-width:2px,color:#000;
classDef component fill:#e8f5e9,stroke:#4caf50,stroke-width:2px,color:#000;
classDef layout fill:#f3e5f5,stroke:#9c27b0,stroke-width:2px,color:#000;
```

## 🚀 Solution
A strict folder structure ensures that agents load only the skills and prompts they explicitly need, adhering to the principle of least privilege and optimizing token usage.
51 changes: 51 additions & 0 deletions architectures/agentic-architecture/implementation-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
technology: Agentic Architecture
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [ai-agents, orchestration, multi-agent-systems, vibe-coding, best-practices]
ai_role: Senior Software Architect
last_updated: 2026-05-03
---

<div align="center">
# 🤖 Agentic Architecture - Implementation Guide
</div>

---

## ❌ Bad Practice
```typescript
async function runAgent(prompt: string) {
const result = await llm.chat(prompt);
// Unsafe and non-deterministic execution
return result.text;
}
```

## ⚠️ Problem
Treating LLMs as simple text-in/text-out generators in production leads to fragile systems that break when output formatting inevitably shifts.

## ✅ Best Practice
Enforce Structured Outputs (JSON Schema) and strict personas.
```typescript
// Define strict schemas
const planSchema = z.object({
steps: z.array(z.string()),
complexity: z.enum(["low", "high"])
});

// Orchestrator wrapper
async function runPlanner(task: string) {
const result = await llm.generateStructured({
persona: "Senior Architect",
task: task,
schema: planSchema
});

return result; // Type-safe and deterministic
}
```

## 🚀 Solution
By mandating that every agent returns structured data validated against a schema (e.g. Zod), you transform non-deterministic LLM output into predictable software components that can be safely integrated into traditional software pipelines.
34 changes: 34 additions & 0 deletions architectures/agentic-architecture/trade-offs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
technology: Agentic Architecture
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [ai-agents, orchestration, multi-agent-systems, vibe-coding, best-practices]
ai_role: Senior Software Architect
last_updated: 2026-05-03
---

<div align="center">
# 🤖 Agentic Architecture - Trade Offs
</div>

---

## ❌ Bad Practice
Ignoring latency and token costs, assuming agents can run synchronously in real-time user flows.

## ⚠️ Problem
Multi-agent systems require multiple sequential LLM calls, which can take 10s-30s. Putting this in the critical path of a web request causes severe UX degradation and potential timeouts.

## ✅ Best Practice
Implement asynchronous, event-driven architectures for agent workloads.

| Feature | Monolithic App | Multi-Agent System |
| :--- | :--- | :--- |
| **Latency** | O(1) ms | O(n) seconds |
| **Complexity** | Low | High |
| **Reasoning Depth** | Shallow | Deep |
| **Determinism** | High | Medium (with validation) |

## 🚀 Solution
Embrace the latency trade-off by offloading agent workflows to background job queues (e.g. Redis/BullMQ) and using WebSockets or polling to update the UI. You trade speed for advanced, autonomous reasoning capabilities.
53 changes: 53 additions & 0 deletions architectures/microkernel-architecture/data-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
technology: Microkernel Architecture
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [plugin-architecture, extensibility, solid-principles, core-system, architecture-patterns, best-practices]
ai_role: Senior Software Architect
last_updated: 2026-05-03
---

<div align="center">
# 🧩 Microkernel Architecture - Data Flow
</div>

---

## ❌ Bad Practice
Directly hardcoding plugin logic inside the core processing flow.
```mermaid
sequenceDiagram
participant User
participant Core
participant StripeAPI
participant PayPalAPI

User->>Core: Process Payment
Core->>StripeAPI: If method == stripe
Core->>PayPalAPI: If method == paypal
Core-->>User: Result
```

## ⚠️ Problem
Every new plugin requires modifying the core system, violating the Open/Closed principle and risking regressions in fundamental functionality.

## ✅ Best Practice
Data flows strictly through defined interfaces.
```mermaid
sequenceDiagram
participant User
participant Core
participant PluginRegistry
participant Plugin

User->>Core: Action Request
Core->>PluginRegistry: Get Plugin for Action
PluginRegistry-->>Core: Plugin Instance
Core->>Plugin: Execute(payload)
Plugin-->>Core: Standardized Result
Core-->>User: Response
```

## 🚀 Solution
Data passes between the core and plugins solely through standardized Data Transfer Objects (DTOs) and established interfaces. This guarantees O(1) impact on the core logic when registering or unregistering runtime extensions.
53 changes: 53 additions & 0 deletions architectures/microkernel-architecture/folder-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
technology: Microkernel Architecture
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [plugin-architecture, extensibility, solid-principles, core-system, architecture-patterns, best-practices]
ai_role: Senior Software Architect
last_updated: 2026-05-03
---

<div align="center">
# 🧩 Microkernel Architecture - Folder Structure
</div>

---

## ❌ Bad Practice
Mixing core system code with plugin implementations in the same directory.

## ⚠️ Problem
Lack of physical separation inevitably leads to logical coupling, where the core accidentally imports specific plugin details or dependencies.

## ✅ Best Practice
Strict separation using package boundaries or directories.
```mermaid
classDiagram
class AppRoot:::layout
note for AppRoot "Application Root"

class Core:::component
note for Core "Core Engine / Interfaces"

class Plugins:::component
note for Plugins "External Extensions"

class PluginA:::default
note for PluginA "Payment Plugin"

class PluginB:::default
note for PluginB "Auth Plugin"

AppRoot --> Core
AppRoot --> Plugins
Plugins --> PluginA
Plugins --> PluginB

classDef default fill:#e1f5fe,stroke:#03a9f4,stroke-width:2px,color:#000;
classDef component fill:#e8f5e9,stroke:#4caf50,stroke-width:2px,color:#000;
classDef layout fill:#f3e5f5,stroke:#9c27b0,stroke-width:2px,color:#000;
```

## 🚀 Solution
A strict structural divide guarantees that plugins can be added, removed, or developed in complete isolation, often as independent packages, enabling scalable, risk-free extensibility.
57 changes: 57 additions & 0 deletions architectures/microkernel-architecture/implementation-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
technology: Microkernel Architecture
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [plugin-architecture, extensibility, solid-principles, core-system, architecture-patterns, best-practices]
ai_role: Senior Software Architect
last_updated: 2026-05-03
---

<div align="center">
# 🧩 Microkernel Architecture - Implementation Guide
</div>

---

## ❌ Bad Practice
```typescript
class OrderSystem {
process(order: any) {
if (order.type === 'digital') {
processDigital(order);
} else {
processPhysical(order);
}
}
}
```

## ⚠️ Problem
Using switch/if statements for features directly inside the core logic means the core is never truly closed to modification.

## ✅ Best Practice
Define a robust interface and registry mechanism.
```typescript
interface ProcessorPlugin {
supports(type: string): boolean;
execute(order: unknown): Promise<void>;
}

class MicrokernelRegistry {
private plugins: ProcessorPlugin[] = [];

register(plugin: ProcessorPlugin) {
this.plugins.push(plugin);
}

async process(order: { type: string }) {
const plugin = this.plugins.find(p => p.supports(order.type));
if (!plugin) throw new Error("No deterministic handler found");
await plugin.execute(order);
}
}
```

## 🚀 Solution
By utilizing the Registry Pattern and Dependency Inversion, you offload all specific implementation details to plugins. The core only orchestrates matching and execution, creating a perfectly closed and extensible system architecture.
Loading
Loading