Step 3 - Scaffolding Domain Modules
Use the ZCore CLI to generate a structured, decoupled domain module for your tasks.
A core philosophy of ZCore is organizing applications into decoupled, modular domains. Instead of throwing all files into a single routers.py or models.py, we structure them by business capability.
Generate the Domain Module
Run the zc startapp command to scaffold a tasks domain. The --template flag populates all standard layers with working boilerplate code.
zc startapp tasks --templateYou can also run zc startapp tasks without flags for an interactive prompt where you can select specific architectural layers to generate.
Examine the 7-Layer Structure
ZCore generates a self-contained directory for your domain:
Separation of Concerns: This structure cleanly decouples:
- Data Mapping:
models.py(SQLAlchemy 2.0) - Validation & Projection:
schemas.py(Zchema / Pydantic V2) - Data Access:
repositories.py(BaseRepository) - Business Logic:
services.py(BaseService) - HTTP Endpoints:
routers.py(BaseRouter) - Lifecycle & Wiring:
plugin.py(Plugin) - Integration Tests:
test_tasks.py(ZTestClient)
Now we have a clean modular domain ready. In the next step, we will define our database model inside tasks/models.py.