DocTreen

Installation

Install doctreen for Node.js, Python, or PHP.

npm install doctreen

NestJS peers

For NestJS projects, also install the peer dependencies (if not already present):

npm install reflect-metadata rxjs

Zod support

For Zod schema support:

npm install zod

Zod is optional — DocTreen ships its own lightweight schema builder (s) if you don't want to add Zod. See Schema builder.

Faker (mock server)

To get realistic values from doctreen mock, install Faker:

npm install --save-dev @faker-js/faker

Without it, the mock server falls back to deterministic placeholders.

Requirements

  • Node.js 18+ (Hono v4 is ESM-only)
  • One of: Express 4/5, Fastify 4/5, Hono 4, Koa 2 (with @koa/router), or NestJS 10/11
pip install doctreen

Zero runtime dependencies. Everything else is opt-in via extras:

pip install "doctreen[pydantic]"   # Pydantic v2 schemas
pip install "doctreen[flask]"      # Flask adapter
pip install "doctreen[fastapi]"    # FastAPI adapter (drift over the app's own spec)
pip install "doctreen[drf]"        # Django + DRF adapter
pip install "doctreen[django]"     # Django only

Installing the package also registers the doctreen-flow CLI and the pytest plugin — no conftest.py line needed.

Requirements

  • Python 3.9+
  • One of: Flask 2.2+, FastAPI 0.100+, or Django 4.2+ (with DRF 3.14+ for serializer schemas)
  • Pydantic v2 if you want runtime validation on Flask — the s.* builder documents but does not validate

On Python 3.9, write Pydantic fields as Optional[str] rather than str | None. Pydantic evaluates annotations at runtime, and | needs 3.10 — from __future__ import annotations defers the evaluation.

composer require doctreen/doctreen

Zero runtime dependencies — the Laravel service provider is auto-discovered and simply never loads outside Laravel.

Optionally publish the config file:

php artisan vendor:publish --tag=doctreen-config

For realistic values from doctreen mock, add Faker (already a dev dependency in most Laravel apps):

composer require --dev fakerphp/faker

Requirements

  • PHP 8.2+
  • Laravel (Symfony and PSR-15 adapters are planned)

On this page