Architecture¶
Last verified: 2026-07-26 against current checkout c09254f.
DocGen is a monorepo with a Python engine/service, a React component library, a Next.js demo app, seeded solution specs, and project records.
Components¶
| Component | Responsibility |
|---|---|
docgen Python package |
Core engine, FastAPI service, authoring bridge, data model, tools, generation pipeline, seeding. |
/v1 config API |
Public authoring/configuration surface for templates and documents. |
docgen-ui |
Reusable React components consumed by the demo app and solution UIs. |
apps/web |
Next.js demo/product app that exercises the public component/API surface. |
docs/solutions |
Per-organization solution documentation and pointers to template specs/seeds. |
docgen/src/docgen/authoring/specs |
Version-controlled declarative template specs. |
| Built-in tools/MCP clients | Deterministic data-gathering layer for the gather phase. |
vendor/ submodules |
Shared AltaForge UI, libraries, and Claude assets consumed by the repo. |
Pipeline¶
- Template or document configuration defines fields, sections, data needs, tools, render modes, prompts, texts, and snippets.
- Gather runs deterministic tool/data-source work once per document.
- Compute/synthesize builds shared document context.
- Render emits each section based on its render mode.
- Verify checks cited source support where enabled.
- The UI/API exposes generated sections for review, edit, regenerate, and export.
Deployment Shapes¶
- Local development: Next.js app plus Python FastAPI service.
- Library import: solution repos submodule DocGen and call the engine directly.
- Client-cloud / shared-infra deployment: same engine and public semantics, different hosting and data boundary.
- Future SaaS HTTP API: same API principles applied as a hosted service.
Design Principle¶
The public contract is the API, template specs, domain model, and component library. Solution code should not reach through those surfaces into internals.