Skip to main content

Scaffolding New Projects

Doom provides a powerful scaffolding system that helps you create new documentation projects from templates. This guide walks you through using the doom new command to bootstrap your documentation.

Quick Start

1

Run the scaffolding command

Use the doom new command to start the scaffolding wizard:
doom new
This will use the default product-doc template.
2

Select a scaffolding type

The wizard will present you with available scaffolding types:
? 请选择脚手架类型 (Use arrow keys)
❯ basic - Basic documentation structure
  api - API documentation with OpenAPI support
  multilingual - Multilingual documentation setup
Choose the one that best fits your project needs.
3

Answer the prompts

The wizard will ask for project-specific information:
  • Project name
  • Description
  • Default language
  • Features to enable
Your responses will customize the generated files.
4

Review generated files

Doom will generate your project structure:
✨ Generating scaffolding...
✔ Scaffolding generated successfully!
Check the created files and directories.

Available Templates

Product Documentation Template

The default product-doc template includes:
  • Bilingual support (English and Chinese)
  • Basic directory structure
  • Configuration file (doom.config.yml)
  • Sample documentation pages
  • Package.json with scripts
npx doom new product-doc

Specifying Template Type

You can skip the interactive prompt by specifying the template type directly:
doom new product-doc:basic
Format: [template-name]:[type]

Using Cached Templates

Doom caches downloaded templates locally to speed up scaffolding. Templates are fetched from the configured repository (default: alauda-public/product-doc-guide).

Force Update Templates

To fetch the latest template version, use the --force flag:
doom new --force
This will:
  • Download the latest template from the remote repository
  • Bypass the local cache
  • Ensure you’re using the most recent scaffolding
The --force option is useful when template updates are available or when your cached version is corrupted.

Template Configuration

Templates are defined in a scaffolding.yaml file at the template repository:
scaffolding:
  - name: basic
    description: Basic documentation structure
    parameters:
      - name: projectName
        type: input
        options:
          message: "What is your project name?"
          default: my-docs
      - name: includeApi
        type: confirm
        options:
          message: "Include API documentation?"
          default: false
    layout:
      - type: folder
        source: templates/basic
        target: .

Generated Project Structure

A typical scaffolded project looks like this:
my-docs/
├── docs/
│   ├── en/
│   │   ├── index.md
│   │   └── getting-started.md
│   ├── zh/
│   │   ├── index.md
│   │   └── getting-started.md
│   ├── public/
│   │   ├── en/
│   │   └── zh/
│   └── shared/
├── doom.config.yml
├── package.json
└── tsconfig.json

Key Files

The main configuration file for your documentation site:
title: My Documentation
lang: en
logo: /logo.svg
logoText: My Docs
base: /
Contains all your documentation content:
  • en/ - English documentation
  • zh/ - Chinese documentation
  • public/ - Static assets (images, files)
  • shared/ - Reusable components and content
Includes helpful npm scripts:
{
  "scripts": {
    "dev": "doom dev",
    "build": "doom build",
    "serve": "doom serve"
  }
}

Next Steps

After scaffolding your project:

Start Development

Launch the dev server with doom dev

Configure Your Site

Customize configuration and appearance

Add Content

Start writing documentation pages

Deploy

Learn deployment strategies

Troubleshooting

If you see a “Template not found” error:
Template `product-doc` not found
Try using the --force flag to download the latest templates:
doom new --force
If scaffolding fails to load:
  1. Check your internet connection
  2. Verify the repository is accessible
  3. Remove local cache and retry:
    rm -rf ~/.doom/cache
    doom new --force
    
If you encounter template rendering errors:
  • Ensure all required parameters are provided
  • Check that parameter names match the template expectations
  • Review the scaffolding.yaml configuration for typos

Custom Templates

You can create custom templates for your organization. A template consists of:
  1. Template repository - Git repository containing template files
  2. scaffolding.yaml - Configuration defining parameters and layout
  3. Template files - Files and directories to be copied
Template files can use EJS syntax (<%= parameter.name %>) to dynamically insert values based on user input.

Example Custom Template

scaffolding:
  - name: custom
    description: Custom company template
    parameters:
      - name: productName
        type: input
        options:
          message: "Product name?"
      - name: version
        type: input
        options:
          message: "Initial version?"
          default: "1.0.0"
    layout:
      - type: folder
        source: templates/custom
        target: .
        matchers:
          - match:
              - "**/*.ejs"
            processors:
              - type: ejsTemplate
With a template file like README.md.ejs:
# <%= parameters.productName %>

Version: <%= parameters.version %>
When scaffolded with productName="My Product" and version="2.0", it generates:
# My Product

Version: 2.0

Build docs developers (and LLMs) love