100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Programming

The dbt Project Structure

A tour of a dbt project's folders and configuration files, and the staging/intermediate/marts convention used to organize models.

FoundationsBeginner8 min readJul 10, 2026
Analogies

Anatomy of a dbt Project

Every dbt project is anchored by dbt_project.yml, a required YAML file at the project root that declares the project's name, the dbt version it targets, and default configuration — such as materialization strategy or schema — applied to models in specific folders. dbt reads this file first on every invocation to understand the project's shape, and it is what turns an ordinary directory of SQL files into something dbt recognizes as a project it can compile and run.

🏏

Cricket analogy: dbt_project.yml is like the team sheet handed to the umpire before a match — it declares who's playing and under what rules before a single ball is bowled, just as dbt reads this file before compiling anything.

Key Directories

A scaffolded dbt project contains several purpose-built folders: models/ holds the SQL SELECT statements that become tables or views; seeds/ holds small static CSV files dbt can load directly, useful for lookup tables like country codes; snapshots/ holds logic for capturing slowly changing dimensions over time; macros/ holds reusable Jinja functions callable from any model; tests/ holds custom singular data tests written as SQL; and analyses/ holds ad hoc SQL that compiles but is never run as part of dbt run.

🏏

Cricket analogy: These folders are like the distinct zones of a cricket academy — nets for practice (models), a video library of past matches (snapshots), and a physio room (macros) — each serving a specific function within one facility.

Organizing the models Directory

Within models/, the widely adopted convention splits SQL into three layers: staging models (prefixed stg_) do light cleanup of a single raw source table — renaming columns, casting types — with a one-to-one relationship to that source; intermediate models combine or reshape multiple staging models for a specific purpose; and mart models (in a marts/ subfolder, often further split into marts/finance/ or marts/marketing/) produce the final, business-facing tables that dashboards and analysts query directly. This staging-intermediate-marts layering keeps raw cleanup logic separate from business logic, so a single source-column rename doesn't need to be repeated across a dozen downstream models.

🏏

Cricket analogy: The staging-to-marts flow mirrors a player's development pathway — from age-group cricket (staging, raw and close to the source), through state-level cricket (intermediate, combined and reshaped), to the national team (marts, the final, presentation-ready product).

yaml
models/
  staging/
    stripe/
      stg_stripe__payments.sql
      _stripe__sources.yml
  intermediate/
    int_payments_pivoted_to_orders.sql
  marts/
    finance/
      fct_orders.sql
      dim_customers.sql

dbt does not enforce the staging/intermediate/marts naming convention technically — it's a community best practice from dbt Labs' 'How we structure our dbt projects' guide, not a hard requirement. You can name folders anything, but following the convention makes projects easier for other analytics engineers to navigate.

  • dbt_project.yml at the project root is required and declares project name, dbt version, and default config.
  • Standard folders include models/, seeds/, snapshots/, macros/, tests/, and analyses/, each with a distinct purpose.
  • seeds/ holds small static CSVs loaded directly by dbt via dbt seed.
  • macros/ holds reusable Jinja functions callable across models.
  • The models/ folder is typically split into staging, intermediate, and marts layers.
  • Staging models (stg_) do light, one-to-one cleanup of a single raw source table.
  • Marts models are the final, business-facing tables that dashboards query directly.

Practice what you learned

Was this page helpful?

Topics covered

#Programming#DbtDataBuildToolStudyNotes#TheDbtProjectStructure#Dbt#Project#Structure#Anatomy#StudyNotes#SkillVeris#ExamPrep