From 512e55d81dcd215ca627e324c1ad406c8a3e61ed Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 18:09:01 +0000 Subject: [PATCH] refactor(arch): optimize patterns for deterministic Agent parsing Co-authored-by: beginwebdev2002 <102213457+beginwebdev2002@users.noreply.github.com> --- _sidebar.md | 4 ++++ architectures/agentic-architecture/readme.md | 4 ++++ architectures/backend-for-frontend/readme.md | 4 ++++ architectures/clean-architecture/readme.md | 4 ++++ architectures/cqrs/readme.md | 4 ++++ architectures/domain-driven-design/readme.md | 4 ++++ architectures/event-driven-architecture/readme.md | 4 ++++ architectures/event-sourcing/readme.md | 4 ++++ architectures/feature-sliced-design/readme.md | 4 ++++ architectures/hexagonal-architecture/readme.md | 4 ++++ architectures/micro-frontends/readme.md | 4 ++++ architectures/microservices/readme.md | 4 ++++ architectures/model-view-controller/readme.md | 4 ++++ architectures/monolithic-architecture/readme.md | 4 ++++ architectures/readme.md | 1 + architectures/serverless/readme.md | 4 ++++ architectures/space-based-architecture/readme.md | 8 ++++++-- 17 files changed, 67 insertions(+), 2 deletions(-) diff --git a/_sidebar.md b/_sidebar.md index 17acc05..e1148a0 100644 --- a/_sidebar.md +++ b/_sidebar.md @@ -86,6 +86,10 @@ * [Folder structure](architectures/space-based-architecture/folder-structure.md) * [Implementation guide](architectures/space-based-architecture/implementation-guide.md) * [Trade offs](architectures/space-based-architecture/trade-offs.md) + * **Agentic architecture** + * [Overview](architectures/agentic-architecture/readme.md) + * **Microkernel architecture** + * [Overview](architectures/microkernel-architecture/readme.md) * **Backend** * [Overview](backend/readme.md) * **Expressjs** diff --git a/architectures/agentic-architecture/readme.md b/architectures/agentic-architecture/readme.md index 3c0fef7..6ed0810 100644 --- a/architectures/agentic-architecture/readme.md +++ b/architectures/agentic-architecture/readme.md @@ -90,6 +90,10 @@ class MonolithicAIAgent { Loading a monolithic agent with unbounded context leads to "Context Explosion", resulting in non-deterministic hallucinations, excessive token costs, and security risks (like arbitrary code execution). A single LLM call attempting multiple distinct personas (Planner, Coder, Reviewer) fundamentally degrades reasoning quality. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript interface AgentTask { goal: string; diff --git a/architectures/backend-for-frontend/readme.md b/architectures/backend-for-frontend/readme.md index 490df6f..41d3272 100644 --- a/architectures/backend-for-frontend/readme.md +++ b/architectures/backend-for-frontend/readme.md @@ -95,6 +95,10 @@ class UniversalGatewayController { Using a single gateway or backend for diverse clients leads to bloated endpoints, complex `if/else` branching for different client needs, and over-fetching or under-fetching of data. Changing the API for a web feature risks breaking the mobile app. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript // --- Web BFF --- class WebDashboardController { diff --git a/architectures/clean-architecture/readme.md b/architectures/clean-architecture/readme.md index da03253..5db993c 100644 --- a/architectures/clean-architecture/readme.md +++ b/architectures/clean-architecture/readme.md @@ -85,6 +85,10 @@ export class User extends BaseEntity { The Domain layer (the core of the application) is tightly coupled with a specific third-party ORM library (`TypeORM`). This violates the Dependency Rule. Changing the database technology will require rewriting core business logic. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript // Pure Domain Entity completely agnostic of infrastructure export class User { diff --git a/architectures/cqrs/readme.md b/architectures/cqrs/readme.md index 675e114..0357782 100644 --- a/architectures/cqrs/readme.md +++ b/architectures/cqrs/readme.md @@ -85,6 +85,10 @@ class UserService { Combining complex read queries and heavy write operations in a single service and database leads to severe performance bottlenecks. Scaling writes and reads independently is impossible, and the Domain logic for commands becomes entangled with data-shaping logic for queries. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript // --- COMMAND SIDE --- class CreateUserCommandHandler { diff --git a/architectures/domain-driven-design/readme.md b/architectures/domain-driven-design/readme.md index 287d091..f275a17 100644 --- a/architectures/domain-driven-design/readme.md +++ b/architectures/domain-driven-design/readme.md @@ -78,6 +78,10 @@ class OrderService { Using Anemic Domain Models breaks the core principle of Domain-Driven Design. The Entity (`Order`) is reduced to a pure data structure without behavior. The business rules ("How does an order get paid?") leak into the `OrderService`, causing logic duplication, difficult testing, and poor encapsulation. The Domain becomes passive. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript // Rich Domain Entity - Encapsulates both data and behavior class Order { diff --git a/architectures/event-driven-architecture/readme.md b/architectures/event-driven-architecture/readme.md index cabcc7d..a1452c8 100644 --- a/architectures/event-driven-architecture/readme.md +++ b/architectures/event-driven-architecture/readme.md @@ -95,6 +95,10 @@ class OrderService { Treating an event bus like an RPC (Remote Procedure Call) mechanism defeats the purpose of EDA. Synchronous waiting re-introduces tight temporal coupling. If the consumer is slow, it blocks the producer, leading to cascading failures and timeouts across the system. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript class OrderService { async createOrder(data: OrderData) { diff --git a/architectures/event-sourcing/readme.md b/architectures/event-sourcing/readme.md index c8636cf..7a2f506 100644 --- a/architectures/event-sourcing/readme.md +++ b/architectures/event-sourcing/readme.md @@ -77,6 +77,10 @@ class BankAccount { Directly mutating state overwrites historical data. If there is a bug or an audit requirement, it is impossible to determine *why* an account has a specific balance. We have only the final snapshot, not the journey. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript class BankAccount { private balance: number = 0; diff --git a/architectures/feature-sliced-design/readme.md b/architectures/feature-sliced-design/readme.md index bf6870f..c01283f 100644 --- a/architectures/feature-sliced-design/readme.md +++ b/architectures/feature-sliced-design/readme.md @@ -68,6 +68,10 @@ import { User } from 'entities/user'; Violation of the upward dependency flow constraints. `shared` is the lowest infrastructure layer; it has no right to know anything about the business domain (`entities`), features (`features`), and widgets. This leads to circular dependencies and tight coupling. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript // The Entities layer naturally depends on the infra-layer below (Shared) import { Button } from 'shared/ui/button'; diff --git a/architectures/hexagonal-architecture/readme.md b/architectures/hexagonal-architecture/readme.md index 236bbe3..58b2702 100644 --- a/architectures/hexagonal-architecture/readme.md +++ b/architectures/hexagonal-architecture/readme.md @@ -69,6 +69,10 @@ export class ProcessDocumentService { The Core Domain is directly importing and depending on a specific technical implementation (`AWS S3`). If the project migrates to Azure or GCP, the core business logic must be rewritten. Testing requires a live S3 connection or complex module mocking. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript // Port (Interface defined in the Core Domain) export interface IFileStoragePort { diff --git a/architectures/micro-frontends/readme.md b/architectures/micro-frontends/readme.md index c8d0f1f..2508df1 100644 --- a/architectures/micro-frontends/readme.md +++ b/architectures/micro-frontends/readme.md @@ -63,6 +63,10 @@ const cart = window.__APP_STATE__.cart; Directly mutating and depending on global objects like `window` creates tight coupling between micro-frontends. This leads to race conditions, unpredictable state mutations, and makes isolated testing impossible. It destroys the independence of micro-frontends. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```javascript // Using an Event Bus or Custom Events for decoupled communication diff --git a/architectures/microservices/readme.md b/architectures/microservices/readme.md index f7cad4d..eb3bf5c 100644 --- a/architectures/microservices/readme.md +++ b/architectures/microservices/readme.md @@ -78,6 +78,10 @@ services: Sharing a single database among multiple microservices completely violates the core principle of microservices (independence). If `order-service` performs a heavy migration or drops a table, `inventory-service` crashes. Database schemas cannot evolve independently, recreating monolithic tight coupling at the data layer. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```yaml # docker-compose.yml services: diff --git a/architectures/model-view-controller/readme.md b/architectures/model-view-controller/readme.md index 878e662..a0bc604 100644 --- a/architectures/model-view-controller/readme.md +++ b/architectures/model-view-controller/readme.md @@ -84,6 +84,10 @@ class UserController { The Controller is overloaded with low-level implementation details (SQL, hashing, email processing). This grossly violates the Single Responsibility Principle (SRP) and makes the code monolithic and untestable. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript class UserController { constructor(private userService: UserService) {} diff --git a/architectures/monolithic-architecture/readme.md b/architectures/monolithic-architecture/readme.md index f52bad6..9b3454f 100644 --- a/architectures/monolithic-architecture/readme.md +++ b/architectures/monolithic-architecture/readme.md @@ -84,6 +84,10 @@ export class PaymentProcessor { Directly accessing tables or internal state of other modules within a monolith creates a "Big Ball of Mud". Changing the `users` table schema will silently break the `PaymentModule`. This prevents the monolith from ever being safely split into microservices in the future. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript // PaymentModule interacting with UserModule via an explicit Interface/Facade import { UserService } from '../users/user.service'; diff --git a/architectures/readme.md b/architectures/readme.md index 266a53a..17b3bb2 100644 --- a/architectures/readme.md +++ b/architectures/readme.md @@ -58,6 +58,7 @@ Don't know where to start? Here are a few golden rules: - [Space-Based Architecture](./space-based-architecture/readme.md) - [Serverless](./serverless/readme.md) - [Agentic Architecture (AI Agent Orchestration)](./agentic-architecture/readme.md) +- [Microkernel Architecture (Plugin Architecture)](./microkernel-architecture/readme.md) ## 🏆 Top 15 Best Architectural Approaches diff --git a/architectures/serverless/readme.md b/architectures/serverless/readme.md index e9a7e89..fe02b23 100644 --- a/architectures/serverless/readme.md +++ b/architectures/serverless/readme.md @@ -75,6 +75,10 @@ exports.handler = async (event) => { Grouping unrelated endpoints into a single function defeats the purpose of Serverless. It increases the deployment package size (slowing down cold starts), couples business domains together, complicates IAM permissions (granting excessive privileges), and makes individual function metrics/tracing impossible. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```javascript // One function strictly mapped to one specific capability // users-create.js diff --git a/architectures/space-based-architecture/readme.md b/architectures/space-based-architecture/readme.md index b0f14ac..d347a8d 100644 --- a/architectures/space-based-architecture/readme.md +++ b/architectures/space-based-architecture/readme.md @@ -70,7 +70,7 @@ import { Database } from 'infrastructure/database'; class OrderProcessingUnit { constructor(private readonly db: Database) {} - public async processOrder(orderData: any): Promise { + public async processOrder(orderData: unknown): Promise { // 1. Process business logic const processedOrder = this.calculateTaxes(orderData); @@ -78,7 +78,7 @@ class OrderProcessingUnit { await this.db.save(processedOrder); } - private calculateTaxes(data: any): any { + private calculateTaxes(data: unknown): unknown { return { ...data, tax: 10 }; } } @@ -88,6 +88,10 @@ class OrderProcessingUnit { Directly writing to a persistent database synchronously within a Processing Unit defeats the entire purpose of the Space-Based Architecture. During high-traffic spikes, the database connection pool will exhaust, locks will accumulate, and the central database will become a catastrophic bottleneck, crashing the independent processing units waiting for disk I/O. ### ✅ Best Practice + +> [!NOTE] +> **Internal Routing:** For more context, refer back to the [Architecture Map](../readme.md). + ```typescript import { InvalidateType } from 'infrastructure/cache';