Publishing DBT Docs to Netlify


What is DBT Docs?
DBT Docs is the fantastic new feature which enables the autogeneration of documentation of your models and enables you to create descriptions of fields and tables among its many neat new features.
It is available from v0.11 and can be generated with the command dbt docs generate.

To serve these docs locally, you can run the command: dbt docs serve.

Now this is great when you want to view this documentation on your own machine, but that isn’t very scalable when you’re in a distributed company of any size. An alternative is to host it on an ec2 instance with nginx or apache but this would be overkill for a static webpage.

Enter Netlify, a largely free static site web hosting solution:

In order to deploy your documentation site, you’ll need to

  • create a netlify account
  • run dbt docs generate from within your dbt folder
  • drag the “target” folder from dbt into netlify where it says to “drag and drop your site folder here”
  • this will create a manual site and viola you are done!

If you would like to password protect this site (recommended if it contains sensitive information about your companies data warehouse schemas), you can get that on a teams based plan which is $9 per user per month - here’s some docs on the feature:

Advanced topic
Integrating this into your CI/CD pipeline, you can auto-deploy after dbt run and dbt docs generate to Netlify using the following CLI tool:

Publishing DBT Docs from a Docker Container

Thanks @peter_hanssens - this is great! Just updated this section of the docs to link here :slight_smile: