Datalumina

Getting started

Project setup

Clone the starter, install the backend with uv and the frontend with pnpm, fill in the environment file, and start a FastAPI app with a health check.

By the end of this page both halves of the project are installed, your .env is filled in, and a FastAPI app answers on /health.

Clone the starter

git clone https://github.com/daveebbelaar/e2e-contract-drafting.git
cd e2e-contract-drafting
git switch development
pyproject.toml
uv.lock
architecture.md
build-along.md
client-brief.md
package.json
pnpm-lock.yaml
.env.example

docs/client-brief.md is the user story and docs/architecture.md is the target. samples/intakes/ holds ten fictional intake notes, and nothing else, so you can upload or paste them as they are. The expected answers for the evals are in a separate file, samples/expected.json. frontend/public/ holds the stylesheet and fonts of the signing page, taken from a production signing app. backend/app/ and frontend/src/ are empty.

Install the dependencies

cd backend
uv sync --locked

cd ../frontend
pnpm install --frozen-lockfile

cd ..

Every version is pinned in a lockfile, so you get the same packages as the video. Both installs finish without resolving anything new. The backend refuses packages younger than seven days (exclude-newer in pyproject.toml), and so does pnpm (minimumReleaseAge in pnpm-workspace.yaml).

Moved the project?

A .venv points at the folder it was created in. If you move or copy the project, leave .venv behind and run uv sync --locked again.

Create the environment file

cp .env.example .env
.env.example
# Postgres. Use a hex password: openssl rand -hex 24
POSTGRES_PASSWORD=
DATABASE_URL=postgresql+psycopg://postgres:<POSTGRES_PASSWORD>@127.0.0.1:5432/postgres

# AI. AI_MODEL=test runs without a key.
ANTHROPIC_API_KEY=
AI_MODEL=anthropic:claude-opus-5-5

# The app
COMPANY_NAME=Pinewick Systems
ADMIN_PASSWORD=
# Shared by FastAPI and Next.js for the PDF render route: openssl rand -hex 32
RENDER_TOKEN=
# Start of the signing links in emails. Leave it out locally: links then go to
# http://localhost:3000 in local development and http://localhost in the full Docker stack.
# On the server, set it to the server's address:
# BASE_URL=http://<server-ip>

# Email. Leave SMTP_HOST empty to print emails in the API log instead.
SMTP_HOST=
SMTP_PORT=587
SMTP_USER=
SMTP_PASSWORD=
EMAIL_FROM=contracts@pinewick.example.com

Generate a random value for POSTGRES_PASSWORD and ADMIN_PASSWORD, and a longer one for RENDER_TOKEN:

openssl rand -hex 24
openssl rand -hex 32

Paste them into .env, and put the Postgres password in DATABASE_URL in place of <POSTGRES_PASSWORD>. Leave ANTHROPIC_API_KEY empty until the AI pages, and the email settings until the Gmail page.

BASE_URL stays commented out on your laptop. The signing links in emails then start with http://localhost:3000 while you develop, and with http://localhost when the whole app runs in Docker. You set it on the server, on the deploy page.

A password with @, :, or / breaks DATABASE_URL. A hex password only has letters and numbers, so it is always safe.

See the finished app (optional)

You can run the finished app before you write any code. It needs Docker, and an ANTHROPIC_API_KEY in .env. Without a key, set AI_MODEL=test, and every intake lands in review.

git switch solution
docker compose up -d --build

Open http://localhost and log in with the user admin and your ADMIN_PASSWORD. Pick samples/intakes/01-dental-phone-receptionist.md, click Process, and watch the sections fill in. Then click Send and open the signing link the page shows.

The client addresses in the samples are made up, and email to them bounces. Before you click Process, replace the client's email address in the text box with your own test inbox. Until you set up Gmail, the emails are printed in the API log instead, which you read with docker compose logs api.

Stop it and go back to the starter before you continue. Run down -v first, because the starter has no Compose file yet.

docker compose down -v
git switch development

Add the settings

backend/app/config.py
from pathlib import Path

from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
    # Local runs read .env in the project root. In Docker, Compose passes the same values.
    model_config = SettingsConfigDict(env_file=Path(__file__).parents[2] / ".env", extra="ignore")

    company_name: str = "Pinewick Systems"


settings = Settings()

All backend settings live in this one file. Locally it reads the .env in the project root. In Docker, Compose passes the same values as environment variables. extra="ignore" skips the keys in .env that only the frontend uses.

Add the FastAPI app

backend/app/main.py
from fastapi import FastAPI

from app.config import settings

app = FastAPI(title="Contract drafting")


@app.get("/health")
def health() -> dict:
    return {"status": "ok", "company": settings.company_name}

Dictate your prompts

Prompting a coding agent goes faster when you speak instead of type. Dave uses Glaido for that. It handles technical terms well, and its custom dictionary keeps names like Pydantic, FastAPI, and Postgres spelled right.

Accelerate your workflowGet one free month of Glaido Pro

Glaido is the dictation tool Dave uses. Dictate prompts with technical terms, and add your own words to the custom dictionary.

Get one free month

Check

cd backend
uv run --locked --no-sync fastapi dev app/main.py

Open http://localhost:8000/health in your browser.

{"status": "ok", "company": "Pinewick Systems"}

Port 8000 is taken

Stop whatever uses it, or start FastAPI with --port 8001 at the end of the command. Then add API_URL=http://localhost:8001 to .env, so the Next.js app finds the API later.

Keep this terminal open. fastapi dev reloads when you save a file, so the API stays up for the next pages.

config.py
main.py
pyproject.toml
.env
.env.example

On this page