Skip to main content

Prerequisites

Before you start, make sure you have the following tools installed:

Docker

Docker and Docker Compose are required to run the containerized local preview. This is the recommended path for most developers.

Node.js

Node.js 22 or later and npm are required if you want to run scripts directly outside of Docker.

Git

Git is required to clone the repository and for the migration scripts to clone product source repositories.

Go (optional)

Go is only required if you need to run Packer documentation code generation via make generate.

Quick start with Docker

The fastest way to get a working local preview is to use the make command. This starts the unified-docs Docker Compose profile, which spins up both the unified docs API and the dev-portal frontend.
make
Once both containers have finished starting up, you can access:
URLService
http://localhost:3000Dev-portal — a local instance of the HashiCorp developer portal configured to pull from the unified docs API
http://localhost:8080Unified docs API — serves content from the content/ directory
The unified-docs-api container takes time to process all content and assets at startup. Wait for both containers to fully initialize before testing content in the dev-portal preview at localhost:3000.

Verify the API is ready

Visit the following URL to confirm the unified docs API has finished processing content:
http://localhost:8080/api/all-docs-paths
This endpoint returns a list of all known documentation paths. If it responds successfully, the API is ready and the dev-portal can fetch content. You can also test a specific content endpoint:
http://localhost:8080/api/content/terraform-plugin-framework/doc/latest/plugin/framework

Stopping the local preview

make clean
Run make clean in a separate terminal while the containers are running.

Granular control with npm scripts

For more control over individual steps — for example, when iterating on prebuild scripts or running tests — you can use npm scripts directly instead of make.
1

Install dependencies

npm install
2

Run the prebuild script

The prebuild step processes content from content/ and writes transformed files into public/content and public/assets. It also generates app/api/versionMetadata.json and app/api/docsPathsAllVersions.json.
npm run prebuild
3

Start the development server

npm run dev

Running tests

npm run coverage
This runs the full test suite with coverage reporting. Individual test files can be found alongside the scripts they test — for example, scripts/prebuild/gather-version-metadata.test.ts.

Available make commands

CommandDescription
makeStart the unified-docs Docker profile (equivalent to make unified-docs)
make cleanStop and remove project Docker containers and images, and delete public/content and public/assets
make clean CLEAN_OPTION=fullStop containers, remove images including hashicorp/dev-portal, and delete build output
make helpList all available make targets
make generateGenerate Packer plugin documentation (requires Go)

What each service does

unified-docs-api (port 8080) This is the unified docs API built from the local repository. On startup it runs the prebuild script, which:
  • Applies MDX transforms to files in content/ and writes output to public/content
  • Copies assets to public/assets
  • Generates app/api/versionMetadata.json
  • Generates app/api/docsPathsAllVersions.json
The API then serves this processed content over HTTP, implementing the same request and response shapes as the existing content.hashicorp.com API. dev-portal (port 3000) This is the HashiCorp developer portal (hashicorp/dev-portal), configured with HASHI_ENV=unified-docs-sandbox so it fetches documentation content from the local unified docs API instead of the production content API. It depends on the unified-docs-api container being healthy before it starts.

Build docs developers (and LLMs) love