This directory contains comprehensive examples demonstrating various patterns and use cases with the Kizuna dependency injection library.
Domain-Driven Design with Multiple Containers
A complete e-commerce application example showing how to use multiple containers to separate business domains while sharing infrastructure services.
What you'll learn:
- How to create domain-specific containers (User, Order domains)
- Sharing infrastructure services (Logger, EmailService) across domains
- Preventing cross-domain dependencies
- Request-scoped processing with Express.js integration
- Testing individual domains in isolation
- Cross-domain workflows
Key patterns demonstrated:
- Shared infrastructure container
- Domain container factories
- Cross-container dependency injection
- Scoped request handling
- Resource cleanup and disposal
- Mock testing strategies
Run the example:
npm run build
node dist/examples/multiple-containers-domain-separation.jsThis example is perfect for understanding how to architect larger applications with clear domain boundaries while maintaining shared infrastructure concerns.
-
Build the project:
npm run build
-
Run individual examples:
node dist/examples/[example-name].js
When adding new examples:
- Include comprehensive TypeScript documentation
- Demonstrate a specific pattern or use case
- Add error handling and cleanup
- Update this README with the new example
- Ensure examples compile without errors
Examples should be self-contained and runnable, providing clear learning value for different Kizuna usage patterns.