Case study 02, 2026

Sekkin

A schema-first code generator. You draw entities, relationships, and API contracts on a canvas. Sekkin compiles a runnable FastAPI app from that schema, lets your own model fill in only the business logic, and then proves the output still matches what you drew.

Role
Solo. Design, compiler, evaluator, and UI.
Stack
Python, FastAPI, SQLAlchemy, pytest, React, React Flow, Docker
Models
Bring your own: Anthropic, OpenAI, DeepSeek, or any OpenAI-compatible local server
Code
Private, 371 commits. Demo available on request.

01

The idea

Models are good at writing a function body in a small, well described box. They are bad at keeping forty files consistent with each other. Most AI code tools ask the model to do both.

Sekkin splits the work. The structure (models, schemas, routes, migrations) comes from a deterministic compiler, so the same schema always produces the same files. The model only ever sees marked stubs, and it only ever writes inside them.

There's no chat box. The human designs the schema, the machine implements it, and the evaluator is the proof.

02

The pipeline

  1. Canvas to IR. The React Flow canvas serializes to a strict JSON intermediate representation.
  2. Validate. Broken references block generation before any code is written. Rename User to Users and it tells you which foreign key broke and suggests the fix.
  3. Compile. Deterministic output: SQLAlchemy models, Pydantic schemas, routes, and tests.
  4. Inject. The model fills only # AI_INJECT stubs, using your key or your local model.
  5. Evaluate. AST checks confirm every declared route and field exists, then a generated pytest suite runs against the app.

With no model configured, the whole pipeline still runs. Route bodies stay as 501 stubs and the evaluator confirms the structure. The AI is an optional layer, not a dependency.

Cutting prompt tokens

The locked schema context goes into every prompt, so its size is a direct cost. I added an option to serialize it as TOON instead of JSON and measured about a 25% token reduction on Sekkin's own payloads with the o200k_base tokenizer. The encoding is deterministic, and the generated app's own API contracts stay plain JSON.

03

The finding I'm proudest of

Because it was my own bug.

Graduation exam, live provider, nothing intercepted

A feature that passed 16 of 16 and could not be reached

Large schema requests were supposed to hit the output limit and get offered a "build it in steps" plan instead. The test suite was green. In the real browser, the user got an error and nothing to click.

The UI streams first, and the streaming endpoint kept only the error message from the exception, dropping the plan at the transport boundary. The test harness aborted the stream route to exercise the fallback, which was the one thing that made the offer reachable. The test was right about the path it took and wrong about the path the product takes.

Since then, anything I call done has been run once through the shipped path, live, with nothing mocked or intercepted.

04

Scope and limits

  • Single machine, one docker-compose up. No auth, no cloud sync, no team features in v1.
  • One target: FastAPI with SQLAlchemy, Postgres in production and SQLite for the evaluator's test run.
  • Provider keys stay in a local SQLite database and are never logged or returned by any endpoint.
Next case study Corridor FX →