How to generate your project’s documentation in DBT


generate and serve


DBT has two supported commands for generating documentation for the models.

dbt docs generate is responsible for generating your project’s documentation website. It does this by copying the website index.html file into the target/ directory of the server where the dbt is installed. Once dbt docs generate is triggered , it will compile the the project to target/manifest.json. This will also generate target/catalog.json file, which will contains metadata about the tables and views which is created by the models.

Command to execute

dbt docs generate

DBT compile will take some amount of time , so if you want to have docs generate without compile we have to use –no-compile option as below. In that case it will copy the website index.html file into the target/ directory and produce the target/catalog.json file 

dbt docs generate --no-compile


dbt docs serve launches your usual browser and starts a webserver on port 8000 to deliver your documentation locally. Your target/ directory serves as the webserver’s root. Because the serve command relies on the catalogue metadata item produced by the generate command, it is important to run dbt docs generate before dbt docs serve. If the catalogue is absent, an error notice will appear.

dbt docs serve --port 8001

Complete options for serve are as follows

dbt docs serve [--profiles-dir PROFILES_DIR]
               [--profile PROFILE] [--target TARGET]
               [--port PORT]
Author: user

Leave a Reply