3.8 KiB
3.8 KiB
Architecture Diagrams
System Overview
The system_overview.mmd
diagram shows the high-level architecture of our framework, including:
-
Core System
- Application lifecycle
- Dependency injection (Container)
- Event handling
- Pipeline processing
-
HTTP Layer
- Server handling
- HTTP kernel
- Routing
- Controllers
-
Service Layer
- Configuration
- Caching
- Queue management
- Database operations
-
Infrastructure
- Filesystem operations
- Process management
- Command bus
- Model layer
-
Testing Integration
- Test cases
- HTTP testing
- Database testing
- Event testing
Rendering the Diagram
Using Mermaid CLI
# Install Mermaid CLI
npm install -g @mermaid-js/mermaid-cli
# Generate SVG
mmdc -i system_overview.mmd -o system_overview.svg
# Generate PNG
mmdc -i system_overview.mmd -o system_overview.png
Using Online Tools
- Visit Mermaid Live Editor
- Copy content of system_overview.mmd
- Export as SVG or PNG
Using VSCode
- Install "Markdown Preview Mermaid Support" extension
- Open system_overview.mmd
- Use preview to view diagram
Modifying the Diagram
Component Structure
%% Component Template
subgraph ComponentName ["Display Name"]
Node1[Node One]
Node2[Node Two]
Node1 --> Node2
end
Style Definitions
%% Style Classes
classDef core fill:#f9f,stroke:#333,stroke-width:2px
classDef http fill:#bbf,stroke:#333,stroke-width:2px
classDef service fill:#bfb,stroke:#333,stroke-width:2px
classDef infra fill:#fbb,stroke:#333,stroke-width:2px
classDef test fill:#fff,stroke:#333,stroke-width:2px
Adding Components
- Define component in appropriate subgraph
- Add relationships using arrows
- Apply style class
- Update documentation
Component Descriptions
Core System
- Application: Main entry point and lifecycle manager
- Container: Dependency injection container
- Events: Event dispatching and handling
- Pipeline: Request/process pipeline handling
HTTP Layer
- Server: HTTP server implementation
- Kernel: HTTP request kernel
- Router: Route matching and handling
- Controller: Request controllers
Service Layer
- Config: Configuration management
- Cache: Data caching
- Queue: Job queue management
- Database: Database operations
Infrastructure
- FileSystem: File operations
- Process: Process management
- Bus: Command bus implementation
- Model: Data model layer
Testing
- TestCase: Base test functionality
- HttpTest: HTTP testing utilities
- DBTest: Database testing utilities
- EventTest: Event testing utilities
Relationships
Core Dependencies
graph LR
App --> Container
App --> Events
App --> Pipeline
Service Registration
graph LR
Container --> Services
Container --> Infrastructure
Request Flow
graph LR
Server --> App
Controller --> Services
Services --> Infrastructure
Event Flow
graph LR
Events --> Queue
Queue --> Process
Events --> Bus
Best Practices
-
Adding Components
- Place in appropriate subgraph
- Use consistent naming
- Add clear relationships
- Apply correct style
-
Updating Relationships
- Keep lines clear
- Show direct dependencies
- Avoid crossing lines
- Group related flows
-
Maintaining Styles
- Use defined classes
- Keep consistent colors
- Maintain line weights
- Use clear labels
-
Documentation
- Update README.md
- Explain changes
- Document relationships
- Keep synchronized
Questions?
For questions about architecture diagrams:
- Check diagram documentation
- Review Mermaid syntax
- Consult team leads
- Update documentation