Examples
Pacta includes several example projects demonstrating different architectural patterns and use cases.
Available Examples
| Example | Description | Best For |
|---|---|---|
| Simple Layered App | Classic N-tier architecture | Teams familiar with layered architecture |
| Hexagonal Architecture | Ports and Adapters pattern | Domain-driven design, high testability |
| Legacy Migration | Baseline workflow for brownfield | Existing codebases, incremental adoption |
Quick Start
Each example includes:
architecture.yml- System and layer definitionsrules.pacta.yml- Architectural constraintssrc/- Sample Python code demonstrating the architecture
To run any example:
cd examples/<example-name>
# One-step (scan = snapshot + check):
pacta scan . --model architecture.yml --rules rules.pacta.yml
# Or two-step:
pacta snapshot save . --model architecture.yml
pacta check . --rules rules.pacta.yml
Creating Your Own
- Copy the example closest to your needs
- Modify
architecture.ymlto match your directory structure - Adjust
rules.pacta.ymlfor your constraints - Run
pacta scanand iterate
See the Configuration Reference for full schema documentation.