Skip to content

Create a documentation site

This guide covers scaffolding and customizing the VitePress documentation starter. By the end you have a running VitePress site deployable to Cloudflare Pages, with agent context configured for protoLabs.

What the starter includes

FeatureDetail
FrameworkVitePress 1.x
SearchBuilt-in local search (zero config)
ThemeCustom CSS variable overrides with dark/light mode
FormattingPrettier 3
Lintingmarkdownlint-cli2
CIGitHub Actions: build, format check, markdown lint, deploy to Cloudflare Pages
Agent context.automaker/CONTEXT.md loaded into every agent prompt

Pre-loaded board features: configure CI, set up branch protection, write README, add a tutorial, add a how-to guide, configure custom domain, create API reference.

Scaffold the project

Via CLI:

bash
npx create-protolab
# Select: docs
# Enter project name when prompted

Via UI:

Open the New Project dialog → select Docs from the template dropdown → enter a project name → click Create.

After scaffolding:

bash
cd <your-project-name>
npm install
npm run dev

The dev server starts at http://localhost:5173.

Add pages

All documentation pages live as .md files in the project root, organized by directory. Add a file to create a new route.

bash
# Creates /guides/my-guide
touch guides/my-guide.md

Every page uses a # Heading as its title. For SEO control, add frontmatter:

markdown
---
title: My Guide
description: A short description shown in meta tags and search results.
---

# My Guide

Content here.

After creating a page, add it to the sidebar in .vitepress/config.mts:

ts
sidebar: {
  '/guides/': [
    {
      text: 'How-to Guides',
      items: [
        { text: 'Add a Page', link: '/guides/add-a-page' },
        { text: 'My Guide', link: '/guides/my-guide' },
      ],
    },
  ],
},

Customize the theme

Brand colors, fonts, and dark/light mode tokens are defined in .vitepress/theme/custom.css. Override VitePress CSS variables:

css
/* .vitepress/theme/custom.css */
:root {
  --vp-c-brand-1: #7c3aed;
  --vp-c-brand-2: #6d28d9;
  --vp-font-family-base: 'Geist', sans-serif;
}

.dark {
  --vp-c-bg: #09090b;
  --vp-c-brand-1: #a78bfa;
}

Update site metadata

Edit .vitepress/config.mts to set the site title, description, and nav:

ts
// .vitepress/config.mts
import { defineConfig } from 'vitepress';

export default defineConfig({
  title: 'My Docs',
  description: 'Documentation for My Project.',
  themeConfig: {
    socialLinks: [{ icon: 'github', link: 'https://github.com/your-org/your-repo' }],
  },
});

Deploy to Cloudflare Pages

The scaffolded CI workflow (.github/workflows/ci.yml) handles deployment automatically on push to main.

To set it up manually:

  1. Push the repo to GitHub.
  2. In Cloudflare Pages, click Create a projectConnect to Git → select your repo.
  3. Set build command: npm run build
  4. Set output directory: .vitepress/dist
  5. Add environment variables if needed.

For the GitHub Actions deployment path, add these secrets to your repo:

SecretValue
CLOUDFLARE_API_TOKENCloudflare API token with Pages:Edit permission
CLOUDFLARE_ACCOUNT_IDYour Cloudflare account ID

How AI agents interact with this starter

When an agent works on a feature in this project, protoLabs loads .automaker/CONTEXT.md into the agent's system prompt. The file explains the project structure, VitePress routing, sidebar configuration, theming approach, and CI pipeline.

The .automaker/coding-rules.md file enforces stack-specific rules: Diataxis content structure, Markdown formatting, and content guidelines.

You can extend both files with project-specific rules. See Context Files for the full format.

Key constraints

ConstraintReason
Pages are .md filesVitePress uses Markdown; no .mdx support
Sidebar is manually configuredAdd new pages to .vitepress/config.mts sidebar arrays
Output directory is .vitepress/dist/VitePress default; CI deploy uses this path
Search is built-inLocal provider enabled by default, no extra config needed

Next steps

Built by protoLabs — Open source on GitHub