# What is docs-as-code?

Source: https://rimfe.com/learn/docs-as-code
Updated: October 30, 2026

Docs-as-code means writing and shipping documentation with the same tools as code: plain-text files in git, changed through pull requests, built and checked by automation. It gives docs version history and review. It does not, by itself, make them correct: nothing checks that a page still matches the code.

## What it includes

- Source files in Markdown, MDX, reStructuredText or AsciiDoc.
- A repository, ideally the same one as the code.
- Pull requests and review for every change.
- A static site generator such as Docusaurus, MkDocs, Sphinx or Starlight.
- CI that builds the site and runs linters and link checks.

## What it fixes

Writers and engineers use one workflow. Docs have history, so you can see when a sentence changed and why. A release can ship the docs that match it, and a pull request can include the docs change next to the code change that needs it.

## What it does not fix

Build and link checks tell you the site compiles. They cannot tell you that a page says the default is 30 seconds while the code now says 10. A docs-as-code repository can drift as easily as a wiki. The files are just easier to check.

## Closing the gap

- Keep docs and code in one repository, or map code folders to the pages that describe them.
- Review docs impact in each pull request, with the evidence quoted.
- Scope the check to the pages that matter, and skip generated pages and changelogs.
- Audit existing pages on a schedule to find the drift that is already there.

## A small example

A team keeps docs in the same repository as the code. A pull request changes the default retry count from three to five. The docs build passes, links resolve and the reviewer approves. Three weeks later a user asks why retries seem to run longer than the page claims. Every docs-as-code check passed, because none of them compares a sentence with a value. The page was fine as a file and wrong as a statement, and only a check that reads both would have said so.

## Related

- [What is documentation drift](https://rimfe.com/learn/documentation-drift)
- [What is docs review](https://rimfe.com/learn/docs-review)
- [MkDocs](https://rimfe.com/docs-frameworks/mkdocs)
- [Hugo](https://rimfe.com/docs-frameworks/hugo)
- [Templates](https://rimfe.com/templates)
- [How to review AI-suggested Markdown docs patches](https://rimfe.com/guides/markdown-docs-patch-review-workflow)
- [Rimfe for Docusaurus docs](https://rimfe.com/docs-frameworks/docusaurus)
- [Rimfe for Astro Starlight docs](https://rimfe.com/docs-frameworks/starlight)
- [Rimfe for VitePress docs](https://rimfe.com/docs-frameworks/vitepress)
- [Rimfe for Nextra docs](https://rimfe.com/docs-frameworks/nextra)
- [Rimfe for Antora and AsciiDoc docs](https://rimfe.com/docs-frameworks/antora)
- [Rimfe for GitBook repositories](https://rimfe.com/docs-frameworks/gitbook)
- [Rimfe vs Mintlify](https://rimfe.com/compare/mintlify)
- [Rimfe vs GitBook](https://rimfe.com/compare/gitbook)
- [Python docs drift](https://rimfe.com/stacks/python)
- [Shell script docs drift](https://rimfe.com/stacks/shell)
