Skip to content
Configuration
On this page

Complete reference for selfdoc.json configuration options including project settings, themes, SEO, deployment, example validators, and branding.

#Configuration

selfdoc is configured via a selfdoc.json file in your project root. Run selfdoc init to generate a starter config interactively, or create one manually.

Five fields are required and nothing is inferred for them: base_url, search_engine, author, locales, and versions (or "unversioned": true in its place). source is optional -- a codeless project (a portfolio or personal site that is nothing but Markdown pages) declares none, and directives that extract from source code are then a hard error rather than an empty section. Everything else is optional and has defaults.

There is no top-level language key. Every source entry is an object naming its own path and language, so a polyglot repository declares one entry per language:

{} json
{
  "source": [
    {"path": "internal/", "language": "go"},
    {"path": "web/src/", "language": "typescript"}
  ]
}

Warning

base_url is required for deployment. Without it, canonical URLs, sitemaps, OG tags, and Atom feeds will have broken links. Set it to the URL where your site will be hosted (e.g., https://myproject.pages.dev).

#Config Reference

The table below lists every field recognized by selfdoc.json, including the field type, whether it is required, and a description of what it controls. Required fields have no default and must be provided explicitly.

Config Reference
FieldRequiredDescription
sourcenoList of source entries to extract documentation from.
base_urlyesBase URL of the generated site, used for canonical links and SEO.
versionnoProject version. When present, used by deploy instead of reading from the project manifest (VERSION, pyproject.toml or package.json).
docsnoDirectory containing the handwritten Markdown documentation templates. It lives inside the tool-state directory, and a value outside it is refused as the layout selfdoc used before.
outputnoOutput directory for generated HTML files. It lives inside the tool-state directory, in the uncommitted cache.
changelognoPath to the changelog document published as the site's changelog page, relative to the project root. Absent means the project root's CHANGELOG.md is used if it exists; declare it when that file is not this site's changelog.
themenoVisual theme for the generated site. One of the themes selfdoc ships -- 'minimal', 'clean' or 'tinymoon'. A build's --theme flag overrides this for that build only, without writing anything back here.
reponoGitHub repository URL shown in the site header.
langnoBCP 47 language tag for the site content (e.g. 'en', 'pt-BR').
namenoExplicit project name. Used as the single source of truth for the manifest name and the auto-generated API reference index description. When absent, the name is derived heuristically (single-source basename or project directory basename).
descriptionnoShort description of the project, used in meta tags and SEO.
branchnoGit branch used for source links in the generated site.
searchnoSearch UI mode: icon button, full bar, or hidden.
search_engineyesSearch engine that answers this site's search UI. Required and never inferred: every site builds a search UI, so the engine behind it is declared, not defaulted.
code_iconsnoStyle of language icons shown on code blocks.
line_numbersnoShow line numbers in code blocks.
run_buttonnoShow a run button on code blocks for supported languages.
page_navnoShow previous/next navigation links between pages.
page_progressnoShow a reading progress bar at the top of each page.
glossarynoAuto-generate a glossary page from dfn terms.
coverage_thresholdnoMinimum fraction of public symbols that must be documented for selfdoc check to pass (0.0-1.0). Default 1.0 requires 100% coverage.
feed_max_entriesnoMaximum number of entries in the Atom feed, sorted by most recent.
lint_ignorenoList of warning-severity lint rule IDs to suppress (e.g. 'SEO007', 'SEO008'). Error-severity codes cannot be suppressed and are refused at load.
root_filesnoList of underscore-prefixed template paths in docs/ for root file generation.
redirectsnoPage-level redirects expanded across all locale/version combos.
deploynoDeployment configuration for publishing the generated site.
directivesnoCustom directive mappings from directive name to source file path.
examplesnoValidator command templates keyed by code-block language, used by 'selfdoc check' to execute fenced blocks marked 'validate'. Each template must contain the '{file}' placeholder. Absent means example validation is off.
authoryesThe site's author: one Person, named in every page's structured data. Required -- there is no inferred author.
twitternoTwitter/X handle (starts with @) for the twitter:site meta tag.
feedbacknoFeedback collection configuration (at least one of webhook or ga required).
brandingnoLanding page branding and call-to-action configuration.
auto_detectnoAutomatic content detection settings for step guides and API entries.
gennoConfiguration for the gen command.
gen_datanoConfiguration for the gen-data command.
schema_typesnoMapping from page type to schema.org @type (e.g. guide -> TechArticle).
versionsnoList of documentation versions to build.
unversionednoDeclares that this project has no public version -- a personal site or portfolio that publishes no artifact. It replaces the 'versions' array (declaring both is an error) and is refused for a project that declares 'source', because code is the thing that gets released and therefore carries a version. An unversioned project's pages show no version badge, offer no version search filter and no version picker.
localesnoList of locales for multi-language documentation.
unifiednoConfiguration for unified multi-project documentation.
postsnoBlog post configuration.
topologynoDeployment topology for multi-project unified sites.
assemblynoAssembly configuration for unified site deployment.

#Common Configurations

#Minimal Python project

{} json
{
  "source": [{"path": "src/", "language": "python"}],
  "base_url": "https://myproject.pages.dev",
  "search_engine": "pagefind",
  "author": {"name": "Jane Doe", "url": "https://janedoe.example"},
  "versions": [{"version": "1.0.0"}],
  "locales": [{"code": "en", "label": "English", "default": true}]
}

#Go project with deployment

{} json
{
  "source": [
    {"path": "pkg/", "language": "go"},
    {"path": "internal/", "language": "go"}
  ],
  "base_url": "https://myproject.pages.dev",
  "search_engine": "pagefind",
  "author": {"name": "Jane Doe", "url": "https://janedoe.example"},
  "versions": [{"version": "1.0.0"}],
  "locales": [{"code": "en", "label": "English", "default": true}],
  "repo": "https://github.com/user/myproject",
  "branch": "main",
  "deploy": {
    "provider": "cloudflare-pages",
    "project": "myproject"
  }
}
{} json
{
  "source": [{"path": "mylib/", "language": "python"}],
  "base_url": "https://mylib.dev",
  "versions": [{"version": "1.0.0"}],
  "locales": [{"code": "en", "label": "English", "default": true}],
  "docs": ".stricttools/docs/",
  "output": ".stricttools/docs-cache/build/",
  "description": "A toolkit for building great things.",
  "repo": "https://github.com/user/mylib",
  "branch": "main",
  "lang": "en",
  "theme": "minimal",
  "search": "bar",
  "search_engine": "pagefind",
  "coverage_threshold": 0.8,
  "author": {
    "name": "Jane Doe",
    "url": "https://janedoe.example",
    "same_as": ["https://github.com/janedoe"]
  },
  "twitter": "@janedoe",
  "deploy": {
    "provider": "cloudflare-pages",
    "project": "mylib"
  },
  "branding": {
    "tagline": "Build great things.",
    "cta_text": "Get Started",
    "cta_link": "getting-started/",
    "features": [
      {
        "title": "Fast",
        "description": "Blazing fast builds with zero dependencies."
      },
      {
        "title": "Flexible",
        "description": "Works with Go, Python, TypeScript and six more languages."
      }
    ]
  },
  "directives": {
    "changelog": "scripts/changelog-directive.py"
  }
}

#Example Validators

The examples key maps a fenced-block language to the command that validates a snippet written in it. selfdoc check uses these commands for code blocks marked validate in their fence info string, writing each block to a scratch file and substituting its path for {file}:

{} json
{
  "examples": {
    "python": "uv run --directory python python {file}",
    "go": "scripts/validate-example-go.sh {file}",
    "ts": "scripts/validate-example-ts.sh {file}"
  }
}

Every command template must contain the {file} placeholder; a template without it is rejected when the config loads, since it would validate nothing. Keys are language names exactly as they appear after the opening fence, so a block opened with ```py needs a py entry, not a python one. Omitting examples entirely turns the feature off, and any validate marker in the docs then reports EXAMPLE003. See the Check Guide for the full behavior.

More tools from this site

  • claudestream Drive Claude Code from Python: run it as a subprocess and read its output as typed events, with async and sync sessions, sandbox policies, and tools you define in Python
  • claudewheel A TUI Claude Code Launcher that lets you have more than one profile, manage sessions lifecycle, pick the exact CC version, model to use (even older unlisted ones), pick which GitHub account to use, etc.
  • dirstat Fast, single-binary directory statistics CLI: every file under a tree grouped by format, with counts, sizes, and lines of code, as a colored terminal table or as JSON
  • fastware A batteries-included ASGI framework: msgspec JSON, a managed Granian server, dependency injection, SSE, WebSockets, auth, and a test client
  • go-toml-edit Zero-dep TOML editing library for Go with comment preservation
  • howmuchleft The fastest Claude Code statusline: context window, 5-hour, and weekly limit usage as three customizable gradient bars, rendering in about 6 ms
  • orxtra
  • pgdesign
  • predraw Declarative rendering pipeline: describe a scene in JSON and get SVG, PNG and WebP out, with light and dark style tokens, reusable components and text converted to path outlines
  • reposummary Turn a git repository's history into a Markdown journal: pick a time window or revision range and get a readable digest of what changed, optionally narrated by an LLM
  • rlsbl Release orchestration and project scaffolding CLI that bumps versions, validates a structured JSONL changelog, tags only the commit CI verified, and publishes to npm, PyPI, Go and more
  • safegit git wrapper CLI that gives each commit its own temporary index and retries ref updates on conflict, so concurrent agents share one repository
  • saferm Command-line replacement for rm that archives every deletion with a mandatory reason and the context it ran in, so deleted files can be listed, inspected and restored
  • strictcli
  • stricttest An always-on test-isolation floor: a pytest plugin and a Go env-hygiene module that make a test suite structurally unable to reach real credentials, the real HOME, the network, or the development repository.
  • wesktop A Python framework that turns an ASGI web app into a desktop application, serving it from a local Granian server and displaying it in a native OS window via pywebview
Search