# dbt Best Practices
Scaling dbt from a few models to thousands requires a disciplined approach to structure and testing.
1. Modular Architecture
Always follow the staging -> intermediate -> marts layering.
* **Staging**: 1:1 with source data, minimal cleaning.
* **Intermediate**: Complex joins and shared logic.
* **Marts**: Business-ready entities (dim_users, fct_orders).
2. Documentation is Mandatory
If a model isn't documented, it doesn't exist. Use dbt's doc blocks to ensure every column has a description.
3. Automated Testing
Every model should have at least `unique` and `not_null` tests on its primary key. Supplement this with custom data tests for business logic.
4. Version Control
Treat your SQL like software. Use pull requests, code reviews, and CI/CD pipelines to ensure data quality remains high.