Comprehensive examples demonstrating CodeUChain v2.0 in both TypeScript and Python.
Each directory demonstrates a specific concept in isolation, with full test coverage:
examples/
├── 01-state/ # State: Immutable data container
├── 02-link/ # Link: Single unit of business logic
├── 03-chain/ # Chain: Orchestration layer
├── 04-hook/ # Hook: Cross-cutting concerns
├── 05-integration/ # All parts working together
└── BEST_PRACTICES.md # Guidelines for building pipelines
These examples follow a three-tier testing strategy:
- Unit Tests (Isolation): Each component tested independently
- Integration Tests: Components working together
- Trust but Verify: Runnable tests prove documentation accuracy
cd 01-state && node --test state.test.ts.js
cd 02-link && node --test link.test.ts.js
cd 03-chain && node --test chain.test.ts.js
cd 04-hook && node --test hook.test.ts.js
cd 05-integration && node --test integration.test.ts.jscd 01-state && python3 -m pytest test_state.py -v
cd 02-link && python3 -m pytest test_link.py -v
cd 03-chain && python3 -m pytest test_chain.py -v
cd 04-hook && python3 -m pytest test_hook.py -v
cd 05-integration && python3 -m pytest test_integration.py -v./verify-examples.sh| Concept | Purpose | Analogy |
|---|---|---|
| State | Immutable data container | The "box" on the belt |
| Link | Single transformation | A "station" |
| Chain | Orchestration | The "conveyor belt" |
| Hook | Cross-cutting concerns | "Sensors" observing the belt |
- 01-state: Understand immutability
- 02-link: Single-responsibility transformations
- 03-chain: Orchestration patterns
- 04-hook: Add observability
- 05-integration: Real-world registration flow
- BEST_PRACTICES.md: Production guidelines