The Documentation Gate: Our DDD Philosophy

In the Espalier ecosystem, we operate under the principle that documentation is the implementation. We reject the traditional model of testing components in a vacuum. Instead, we utilize Documentation Driven Development (DDD)—a philosophy where a component is only considered "stable" when it can be successfully explained, demonstrated, and interacted with in our live documentation.

This approach ensures that the "Developer Experience" (DX) is never an afterthought; it is the primary metric of architectural success.

The Strategy: Documentation as the Ultimate Test

From a Startup Strategist’s perspective, DDD is a tool for Risk Mitigation. In many projects, documentation is a "debt" that is paid at the end of a sprint. In Espalier, documentation is the Quality Gate.

1. Verification through Explanation

If a component’s API is too complex to describe in a concise JSDoc comment, the implementation is likely flawed. By forcing developers to write Markdown descriptions for every @prop and @slot, we ensure that our components remain modular and simple.

2. Live Integration Testing

Isolated unit tests often fail to catch visual bugs or subtle interaction failures. By using our documentation site as our testing environment, we verify that our components function correctly in a real DOM environment, alongside other elements, using our live JavaScript injection engine.

3. Single Source of Truth

We utilize custom-elements-manifest (CEM) to extract metadata directly from our source code. This ensures that:

  • The README always reflects the current properties of the component.
  • The API documentation cannot "drift" from the implementation.
  • External tools (like IDEs and design-to-code bridges) can consume our component logic automatically.

The Process: From JSDoc to Live UI

The lifecycle of an Espalier component follows a rigid path:

  1. Commentary: The developer defines the API using JSDoc-style comments written in Markdown.
  2. Manifestation: Our build tool generates a custom-elements.json manifest.
  3. Transformation: 11ty consumes the manifest and source files, rendering a static site where JavaScript code blocks are transformed into active, live components.
  4. Verification: The component is tested by interacting with it on its own documentation page.

Challenge the Assumption: "Unit Tests are Enough"

A common assumption in enterprise software is that 100% unit test coverage equals a bug-free UI. We challenge this. A button can pass a unit test while being visually broken or having a non-accessible contrast ratio.

For a defensible architecture, we prioritize Usage Testing. If it works in the docs, it works in the product.

Strategic Impact: The ROI of Good Docs

Investing in a DDD workflow delivers measurable business value:

  • Reduced Support Burden: Clear, live examples allow engineers to self-serve, reducing the internal Slack "how do I use X?" noise by up to 40% .
  • Onboarding Speed: New contributors can understand the entire library by reading a single, live resource rather than digging through test suites.
  • API Resilience: Because the manifest is machine-readable, we can automate the detection of breaking changes before they reach production.

Where does this show?