Skip to content

Cookbook (Patterns) πŸ§‘β€πŸ³

The Cookbook provides complete, end-to-end architectural patterns that show how pico-ioc’s features compose in real-world systems.


πŸ“– Patterns Overview

Pattern Description File
Multi-Tenant Applications Isolate tenants across configuration, scoped containers, and runtime boundaries. pattern-multi-tenant.md
Hot Reload (Dev Server) Dev-time module replacement with deterministic container rebuilds and safe teardown. pattern-hot-reload.md
CLI Applications Command registration, DI per invocation, and structured output. pattern-cli-app.md
CQRS Command Bus Segregated read/write models, command handlers, and middleware pipelines with AOP. pattern-cqrs.md
Feature Toggles (AOP) Cross-cutting feature flags via decorators and runtime config. pattern-aop-feature-toggle.md
Structured Logging (AOP) Enforced log context, correlation IDs, and function-level structured logs. pattern-aop-structured-logging.md
Security Checks (AOP) Permission/role gates, pre/post conditions, auditing hooks. pattern-aop-security.md
Method Profiling (AOP) Execution timing and performance insights for critical call paths. pattern-aop-profiling.md
Configuration Overrides Environment-driven overrides and deterministic container setup. pattern-config-overrides.md

πŸ”§ How to Use

  1. Pick a pattern that fits your scenario.
  2. Copy the module layout and minimal container scaffolding.
  3. Apply overrides / AOP / config depending on your environment.
  4. Combine patterns:
  5. The AOP patterns stack.
  6. Overrides apply everywhere.
  7. CQRS works well with profiling + structured logging.

🧩 Pattern Categories

Application Architecture - Multi-Tenant Applications - CQRS Command Bus

Developer Experience - Hot Reload - Configuration Overrides & Deterministic Setup

Interfaces - CLI Applications

Cross-Cutting Concerns (AOP) - Feature Toggles - Structured Logging - Security Checks (@secured) - Method Profiling

AI / LLM Integration - Dynamic LangChain Model / Prompt Selection & Caching


🀝 Contributing

  • Propose a new pattern or improvement by keeping:
  • Clear problem definition
  • Reproducible steps and code snippets
  • Dependency boundaries and lifecycle considerations
  • Testing and observability guidance
  • Aim for composability: demonstrate how the pattern integrates with existing patterns when relevant.