August 2026
Legal Document Creator
Draft a legal agreement by chatting. Pick one of 11 Common Paper templates, answer in plain language, and watch the document fill in live.

- Role
- Solo build — frontend, backend, infrastructure
- Stack
- Next.js, FastAPI, SQLite, OpenRouter, Docker
What it brings
- The model replies against a Pydantic schema generated from each template's own fields, so a turn can only come back as valid, typed values.
- A turn is saved only after the model call succeeds — a failed request leaves nothing behind and is safe to retry.
- 161 tests across the stack: 86 on the backend, 75 on the frontend.
- One container, one origin. A multi-stage build compiles the Next.js export and FastAPI serves it, so there is no CORS layer to configure.
Technical design
chat completion
Client
Next.js 16
@react-pdf/renderer
The PDF is built in the browser.
Server
FastAPI
Routes: auth, documents, chat, saved, demo.
GitHub OAuth
app/document_chat.py
Data
SQLite
templates/*.md
Indexed by catalog.json.
External
OpenRouter
REST /api/*
SQLite
- Templates are markdown files in the repository. catalog.json indexes them, so there is no CMS and no content rows in the database — a template change arrives as a diff someone can review.
- The PDF is rendered in the browser. The server never generates a document, so no request holds a rendering process open.