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
4 changes: 2 additions & 2 deletions architectures/agentic-architecture/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ last_updated: 2026-04-17

# 🤖 Agentic Architecture (AI Agent Orchestration) Production-Ready Best Practices

# Context & Scope
# 🎯 Context & Scope
- **Primary Goal:** Document and execute the best practices for AI Agent Orchestration and Multi-Agent Systems.
- **Target Tooling:** AI Agents and Human Developers.
- **Tech Stack Version:** Agnostic
Expand Down Expand Up @@ -64,7 +64,7 @@ Agentic Architecture emphasizes the decomposition of monolithic tasks into granu

---

## 1. Monolithic Agent State Management
## 🚧 1. Monolithic Agent State Management

### ❌ Bad Practice
```typescript
Expand Down
2 changes: 1 addition & 1 deletion architectures/backend-for-frontend/data-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sequenceDiagram
deactivate MobileBFF
```

## Core Principles
## 🧱 Core Principles

1. **Aggregation:** The BFF aggregates responses from multiple services to reduce the number of client-side requests.
2. **Formatting:** The BFF formats data precisely according to what the client needs, stripping out unnecessary fields to save bandwidth.
Expand Down
4 changes: 2 additions & 2 deletions architectures/backend-for-frontend/folder-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ last_updated: 2026-03-29

---

## Architecture Diagram & Folder Tree
## 📐 Architecture Diagram & Folder Tree

```mermaid
graph TD
Expand All @@ -37,7 +37,7 @@ graph TD

---

## 1. Directory Blueprint
## 🚧 1. Directory Blueprint

### ❌ Bad Practice
```text
Expand Down
2 changes: 1 addition & 1 deletion architectures/backend-for-frontend/implementation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ last_updated: 2026-03-29

---

## 1. Concurrent Downstream Calls
## 🚧 1. Concurrent Downstream Calls

### ❌ Bad Practice
```typescript
Expand Down
10 changes: 5 additions & 5 deletions architectures/backend-for-frontend/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ last_updated: 2026-03-29

This engineering directive defines the **best practices** for the Backend-For-Frontend (BFF) architecture. This document is designed to ensure maximum scalability, security, and code quality when developing applications that require tailored APIs for different clients (e.g., web, mobile).

# Context & Scope
# 🎯 Context & Scope
- **Primary Goal:** Provide strict architectural rules and practical patterns for creating specialized backend services dedicated to specific frontend applications.
- **Description:** A pattern where a separate backend service is created for each specific frontend application or interface type, rather than having a single general-purpose API backend for all clients.

## Map of Patterns
## 🗺️ Map of Patterns
- 📊 [**Data Flow:** Request and Event Lifecycle](./data-flow.md)
- 📁 [**Folder Structure:** Layering logic](./folder-structure.md)
- ⚖️ [**Trade-offs:** Pros, Cons, and System Constraints](./trade-offs.md)
- 🛠️ [**Implementation Guide:** Code patterns and Anti-patterns](./implementation-guide.md)



### Structural Comparison: Backend-for-Frontend (BFF) vs API Gateway
### ⚖️ Structural Comparison: Backend-for-Frontend (BFF) vs API Gateway

| Feature | Backend-for-Frontend (BFF) | API Gateway |
| :--- | :--- | :--- |
Expand Down Expand Up @@ -59,15 +59,15 @@ graph TD
```


## Core Principles
## 🧱 Core Principles

1. **Client Focus:** Each BFF is built and maintained by the same team that builds the frontend client.
2. **Aggregation:** The BFF orchestrates and aggregates calls to various downstream microservices.
3. **Resilience:** The BFF must gracefully handle failures from downstream services, ensuring a seamless user experience.

---

## 1. Single Universal API for All Clients
## 🚧 1. Single Universal API for All Clients

### ❌ Bad Practice
```typescript
Expand Down
2 changes: 1 addition & 1 deletion architectures/backend-for-frontend/trade-offs.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ last_updated: 2026-03-29
4. **Maintenance Burden:** Requires frontend teams to have backend development and DevOps skills to maintain the BFF.


### Structural Comparison: Pros vs Cons
### ⚖️ Structural Comparison: Pros vs Cons

| Category | Factor | Description |
| :--- | :--- | :--- |
Expand Down
14 changes: 7 additions & 7 deletions architectures/clean-architecture/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ last_updated: 2026-03-29

This engineering directive defines the **best practices** for Clean Architecture. This document is designed to ensure maximum scalability, security, and code quality when developing enterprise-level applications.

# Context & Scope
# 🎯 Context & Scope
- **Primary Goal:** Provide strict architectural rules and practical patterns for creating scalable systems.
- > [!IMPORTANT]
> **Description:** A concept created by Robert C. Martin (Uncle Bob). It separates a project into concentric rings. The main rule is the Dependency Rule: dependencies MUST STRICTLY only point inward.

## Map of Patterns
## 🗺️ Map of Patterns
- 📊 [**Data Flow:** Request and Event Lifecycle](./data-flow.md)
- 📁 [**Folder Structure:** Layering logic](./folder-structure.md)
- ⚖️ [**Trade-offs:** Pros, Cons, and System Constraints](./trade-offs.md)
- 🛠️ [**Implementation Guide:** Code patterns and Anti-patterns](./implementation-guide.md)

## Core Principles
## 🧱 Core Principles

1. **Isolation & Testability:** Changing a single feature doesn't break the entire business process.
2. **Strict Boundaries:** Enforce rigid structural barriers between business logic and infrastructure.
Expand All @@ -41,7 +41,7 @@ graph LR
class Isolation,Boundaries,Decoupling default;
```

## Architecture Diagram
## 📐 Architecture Diagram

```mermaid
graph TD
Expand All @@ -62,7 +62,7 @@ graph TD

---

## 1. ORM Models Bleeding into Domain
## 🚧 1. ORM Models Bleeding into Domain

### ❌ Bad Practice
```typescript
Expand Down Expand Up @@ -111,7 +111,7 @@ Isolate your Domain models from any external libraries. Use Data Mapper patterns

---

## 2. Direct Infrastructure Injection into Use Cases
## 🚧 2. Direct Infrastructure Injection into Use Cases

### ❌ Bad Practice
```typescript
Expand Down Expand Up @@ -154,7 +154,7 @@ export class UploadAvatarUseCase {

---

## 3. Fat Controllers Dictating Business Flow
## 🚧 3. Fat Controllers Dictating Business Flow

### ❌ Bad Practice
```typescript
Expand Down
10 changes: 5 additions & 5 deletions architectures/cqrs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ last_updated: 2026-03-29
---

This engineering directive defines the **best practices** for the CQRS (Command Query Responsibility Segregation) architecture. This document is designed to ensure maximum scalability, security, and code quality when developing enterprise-level applications.
# Context & Scope
# 🎯 Context & Scope
- **Primary Goal:** Provide strict architectural rules and practical patterns for creating scalable systems.
- **Description:** A powerful pattern where Commands (actions that mutate system data) are entirely decoupled from Queries (actions that only read data).
## Map of Patterns
## 🗺️ Map of Patterns
- 📊 [**Data Flow:** Request and Event Lifecycle](./data-flow.md)
- 📁 [**Folder Structure:** Layering logic](./folder-structure.md)
- ⚖️ [**Trade-offs:** Pros, Cons, and System Constraints](./trade-offs.md)
- 🛠️ [**Implementation Guide:** Code patterns and Anti-patterns](./implementation-guide.md)
## Core Principles
## 🧱 Core Principles

1. **Isolation & Testability:** Changing a single feature doesn't break the entire business process.
2. **Strict Boundaries:** Enforce rigid structural barriers between business logic and infrastructure.
Expand All @@ -38,7 +38,7 @@ graph LR
class Isolation,Boundaries,Decoupling default;
```

## Architecture Diagram
## 📐 Architecture Diagram

```mermaid
graph LR
Expand All @@ -62,7 +62,7 @@ graph LR

---

## 1. Mixing Reads and Writes in a Monolithic Service
## 🚧 1. Mixing Reads and Writes in a Monolithic Service

### ❌ Bad Practice
```typescript
Expand Down
10 changes: 5 additions & 5 deletions architectures/domain-driven-design/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ last_updated: 2026-03-22
---

Этот инженерный директив определяет **лучшие практики (best practices)** для архитектуры Domain-Driven Design. Данный документ спроектирован для обеспечения максимальной масштабируемости, безопасности и качества кода при разработке приложений корпоративного уровня.
# Context & Scope
# 🎯 Context & Scope
- **Primary Goal:** Предоставить строгие архитектурные правила и практические паттерны для создания масштабируемых систем.
- **Description:** A philosophy and design approach centered entirely around the business "Domain". The whole team communicates using a "Ubiquitous Language," and domains are split into Bounded Contexts.
## Map of Patterns
## 🗺️ Map of Patterns
- 📊 [**Data Flow:** Request and Event Lifecycle](./data-flow.md)
- 📁 [**Folder Structure:** Layering logic](./folder-structure.md)
- ⚖️ [**Trade-offs:** Pros, Cons, and System Constraints](./trade-offs.md)
- 🛠️ [**Implementation Guide:** Code patterns and Anti-patterns](./implementation-guide.md)
## Core Principles
## 🧱 Core Principles

1. **Isolation & Testability:** Changing a single feature doesn't break the entire business process.
2. **Strict Boundaries:** Enforce rigid structural barriers between business logic and infrastructure.
3. **Decoupling:** Decouple how data is stored from how it is queried and displayed.

## Architecture Diagram
## 📐 Architecture Diagram

```mermaid
graph TD
Expand All @@ -50,7 +50,7 @@ graph TD

---

## 1. Anemic Domain Models
## 🚧 1. Anemic Domain Models

### ❌ Bad Practice
```typescript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ classDiagram
DomainEvent <-- EventPublisher
```
---
## 1. Idempotent Consumers (Crucial)
## 🚧 1. Idempotent Consumers (Crucial)

> [!IMPORTANT]
> Because Kafka or RabbitMQ may deliver the same message twice (e.g., during a consumer rebalance), handlers must be purely idempotent. Processing the exact same `eventId` twice MUST NOT duplicate the business outcome (e.g., charging a credit card twice).
Expand Down Expand Up @@ -93,7 +93,7 @@ Without tracking `eventId` locally, duplicate deliveries from the broker (due to
### 🚀 Solution
Implementing an Idempotent Receiver pattern with a unique constraint on `eventId` ensures that duplicate events are safely ignored. Wrapping the deduplication check and the business logic within an atomic database transaction guarantees state consistency even under high concurrency.
---
## 2. The Transactional Outbox Pattern
## 🚧 2. The Transactional Outbox Pattern

To solve the "Dual-Write Problem" (saving state to the DB and publishing to Kafka reliably), we use an Outbox table. If the application crashes after saving to the DB but before publishing to Kafka, the message is permanently lost.

Expand Down Expand Up @@ -146,7 +146,7 @@ The Dual-Write Anti-Pattern occurs when an application attempts to update a data
### 🚀 Solution
The Transactional Outbox pattern guarantees atomic operations. By saving the event to a local `outbox` table within the same DB transaction as the domain change, we achieve atomicity. A separate, reliable process (like a Debezium Connector or background poller) then reads the outbox table and guarantees "at-least-once" delivery to the broker.
---
## 3. Strictly Typed Schemas (Schema Registry)
## 🚧 3. Strictly Typed Schemas (Schema Registry)

Microservices evolve independently. If a publisher changes the shape of a JSON event payload, all downstream subscribers will break. Always enforce a Schema Registry (Avro, Protobuf, JSON Schema) for all events.

Expand Down
8 changes: 4 additions & 4 deletions architectures/event-driven-architecture/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ To deeply understand the nuances of EDA, consult the following specialized modul
- 🛠️ [**Implementation Guide:** Code patterns and Anti-patterns](./implementation-guide.md)
---

### Structural Comparison: Event-Driven vs Request-Response
### ⚖️ Structural Comparison: Event-Driven vs Request-Response

| Feature | Event-Driven Architecture | Request-Response (REST/RPC) |
| :--- | :--- | :--- |
Expand All @@ -43,7 +43,7 @@ To deeply understand the nuances of EDA, consult the following specialized modul
| **Scalability** | Excellent (Easy to add new consumers) | Good (Requires load balancing) |
| **Complexity** | High (Eventual consistency, tracking flows) | Low (Straightforward flows) |

## Architecture Diagram
## 📐 Architecture Diagram

```mermaid
graph LR
Expand All @@ -62,7 +62,7 @@ graph LR
class Pub component;
```

## Core Principles
## 🧱 Core Principles

1. **Asynchronous by Default:** Synchronous RPC (REST/gRPC) is restricted only to immediate read-queries or initial gateway ingress. All inter-service state mutations must occur asynchronously.
2. **Event Sourcing (Optional but Recommended):** State is derived from an immutable, append-only log of events rather than overwriting records in a database.
Expand All @@ -74,7 +74,7 @@ graph LR
<b>Adhere to these EDA principles to establish a relentlessly scalable, highly-decoupled system ecosystem! 🚀</b>
</div>

## 1. Synchronous Blocking on Events
## 🚧 1. Synchronous Blocking on Events

### ❌ Bad Practice
```typescript
Expand Down
4 changes: 2 additions & 2 deletions architectures/event-driven-architecture/trade-offs.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ last_updated: 2026-03-29
---

This document outlines the high-level trade-offs associated with Event-Driven Architecture. EDA introduces incredible scalability and loose coupling but incurs extreme operational complexity, eventual consistency, and distributed debugging challenges.
## 1. High-Level Comparison
## 🚧 1. High-Level Comparison

| 🌟 **Pros (Advantages)** | ⚠️ **Cons (Disadvantages)** |
| ------------------------ | --------------------------- |
Expand All @@ -25,7 +25,7 @@ This document outlines the high-level trade-offs associated with Event-Driven Ar
| **Extensibility:** Adding a new feature (e.g., a new Notification Service) requires zero changes to the Publisher. | **Duplicate Events:** Brokers guarantee "at-least-once" delivery. Consumers MUST be strictly idempotent. |
| **Polyglot Systems:** Microservices can be written in any language as long as they adhere to the broker protocol and schema. | **Dual-Write Problem:** Guaranteeing a local DB commit and a Kafka publish simultaneously requires the Outbox Pattern. |
---
## 2. Distributed Anti-Patterns
## 🚧 2. Distributed Anti-Patterns

### ❌ The "Distributed Monolith"
**Symptom:** Microservices communicate via events, but they expect an immediate asynchronous response via a "reply queue" (RPC over Kafka). The system halts if the response event is not received within a timeout.
Expand Down
2 changes: 1 addition & 1 deletion architectures/event-sourcing/implementation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ last_updated: 2026-03-29

---

## 1. Mutating Existing Events
## 🚧 1. Mutating Existing Events

### ❌ Bad Practice
```typescript
Expand Down
10 changes: 5 additions & 5 deletions architectures/event-sourcing/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ last_updated: 2026-03-29

This engineering directive defines the **best practices** for the Event Sourcing architecture. This document is designed to ensure maximum scalability, security, and code quality when developing applications that require a robust audit trail and complex state reconstruction.

# Context & Scope
# 🎯 Context & Scope
- **Primary Goal:** Provide strict architectural rules and practical patterns for building systems where state is derived from an immutable sequence of events.
- **Description:** A pattern where all changes to application state are stored as a sequence of events. Instead of storing just the current state of the data in a domain, use an append-only store to record the full series of actions taken on that data.

## Map of Patterns
## 🗺️ Map of Patterns
- 📊 [**Data Flow:** Request and Event Lifecycle](./data-flow.md)
- 📁 [**Folder Structure:** Layering logic](./folder-structure.md)
- ⚖️ [**Trade-offs:** Pros, Cons, and System Constraints](./trade-offs.md)
- 🛠️ [**Implementation Guide:** Code patterns and Anti-patterns](./implementation-guide.md)

## Architecture Diagram
## 📐 Architecture Diagram

```mermaid
graph TD
Expand All @@ -51,13 +51,13 @@ graph TD

---

## Core Principles
## 🧱 Core Principles

1. **Immutable Log:** Events are facts that happened in the past. They cannot be changed or deleted, only appended.
2. **Replayable State:** Any entity's current state can be fully reconstructed by replaying all its past events from the beginning.
3. **Decoupled Read/Write:** Often combined with CQRS, Event Sourcing naturally decouples the write model (Event Store) from the read models (Projections).

## 1. Mutating State Instead of Appending Events
## 🚧 1. Mutating State Instead of Appending Events

### ❌ Bad Practice
```typescript
Expand Down
Loading
Loading