Zero-Dependency Design Philosophy#
independoc is designed for teams and projects that want to maintain technical documentation long term without external npm dependency churn or supply-chain exposure.
1. True Zero Dependencies Across All Three Layers#
Rather than hiding dependencies behind pre-bundled scripts or external CDNs, independoc keeps external package dependencies at 0 across every layer:
- Build time: Only Node.js 22+ standard modules (
node:fs,node:path,node:util,node:child_process). Nonpm installrequired. - Development & testing:
node:http+fs.watch+ SSE dev server and automated tests usingnode --test.devDependenciesis also 0. - Browser delivery: No external fonts, no external CDNs, and no JS frameworks. Static HTML and CSS deliver readable pages and navigation on their own.
2. Why Web Components Instead of React / MDX#
Using JSX or MDX requires a compiler and bundler toolchain, whereas most documentation UI patterns (callouts, tabs, cards, step lists, file trees, collapsible sections, small interactive demos) work cleanly with raw HTML in Markdown and standard browser Web Components (Custom Elements).
- Standard Markdown can be nested inside
<nd-tabs>,<nd-card-grid>,<nd-callout>, and other elements components.jsis loaded only on pages that actually use<nd-*>tags- Team-specific interactive widgets require only a single vanilla JS file under
static/(see Custom Web Components Guide)
3. Progressive Enhancement Without JavaScript#
- Content, headings, ToC, syntax highlighting, Admonitions, breadcrumbs, and tag lists: All rendered to static HTML at build time.
- Sidebar categories & language/version switchers: Built on native
<details>/<summary>and standard<a href>links. - Mobile navigation drawer: Implemented with a hidden checkbox,
<label>, and CSS so small viewports remain fully navigable even with JavaScript disabled.
4. Build & Dev Server Safeguards#
- Source protection: Refuses builds if
outDiroverlaps the project root, any locale/versiondocsDir,staticDir, or the config file (including symlinked real paths). - Output collision checks: Validates a unified output manifest before writing so duplicate routes or file-vs-directory conflicts fail cleanly.
- Atomic staging swap: Writes to a temporary staging directory first and swaps it into place so failed builds never leave a broken
dist/. - Dev server hardening: Enforces
Hostheader validation on loopback binds (DNS rebinding protection), path traversal guards, and sanitized HTTP error responses.