Skip to main content

Archiet's core algorithm in one file: PRD text -> FastAPI app ZIP, pure stdlib, zero dependencies.

Project description

archiet-microcodegen

PRD text → working FastAPI + PostgreSQL app → ZIP. One command. No LLM. No API key. Pure Python stdlib. 1,377 lines you can read in 20 minutes.

Inspired by Karpathy's micrograd: this file is the complete algorithm. Everything else is just efficiency on top.

pip install archiet-microcodegen
archiet-microcodegen prd.md --out ./myapp/
cd myapp && docker compose up
# → http://localhost:8000/docs

What you get

Write a PRD describing your entities and user stories. Get back a bootable app:

File What it does
main.py FastAPI app with /docs OpenAPI explorer
models/*.py SQLAlchemy 2.0 models, one per entity
schemas/*.py Pydantic v2 Create / Update / Response schemas
routers/*.py Full CRUD — list, create, get, update, delete
auth.py JWT via httpOnly cookies — register / login / logout / me
alembic/ Migrations pre-configured, run alembic upgrade head
tests/test_*.py pytest suite with DB override, auto-skip if Postgres unreachable
docker-compose.yml Postgres 16 with healthcheck-gated startup
ARCHITECTURE.md ArchiMate 3.2 element map — ApplicationComponent, DataObject, ApplicationService, ApplicationInterface
openapi.yaml Machine-readable API contract, importable into Postman

Every entity has per-tenant data isolation built in. Every query filters by the authenticated user's ID. No data leaks between users.

Zero LLM calls. Zero API keys. Zero runtime dependencies. Pure Python stdlib.

The four stages

PRD text
  │
  ▼ parse_prd()        — regex extraction: entities, fields, user stories, integrations
manifest dict
  │
  ▼ manifest_to_genome() — maps to canonical IR with ArchiMate 3.2 element typing
genome dict              (same schema as archiet.com's full platform)
  │
  ▼ render_genome()    — string.Template FastAPI rendering
{path: content}
  │
  ▼ pack()             — stdlib zipfile
ZIP bytes

The genome is the key: your PRD becomes an ArchiMate 3.2 architecture document before any code is generated. That's what makes the output traceable and maintainable — not just scaffolded.

As a library

from archiet_microcodegen import microcodegen, parse_prd, manifest_to_genome, render_genome

# Full pipeline
zip_bytes = microcodegen(open("prd.md").read())

# Or stage by stage
manifest = parse_prd(prd_text)
genome   = manifest_to_genome(manifest)
files    = render_genome(genome)   # dict[str, str]
# inspect files["ARCHITECTURE.md"] to see the ArchiMate element map

Example PRD

# Task Manager

## Entities
- Task: title (string, required), description (text), status (string), due_date (date)
- Project: name (string, required), description (text)

## User Stories
As a user, I want to create tasks so I can track my work.
As a user, I want to assign tasks to projects so I can organise them.

## Integrations
- Stripe for billing

Run it: archiet-microcodegen prd.md --out ./taskapp/ — you'll get 23 files including a fully wired FastAPI app with Task and Project CRUD, auth, migrations, tests, and an ARCHITECTURE.md with ArchiMate 3.2 notation.

Why no LLMs

LLMs are great at understanding messy PRDs. They're unnecessary for the generation step — once you have a clean manifest, code emission is deterministic. This file handles the deterministic half. The full platform at archiet.com handles the LLM-powered extraction, 14 stacks, frontend, mobile, and delivery gates.

If a bug doesn't reproduce with microcodegen, it's in an efficiency layer, not the algorithm.

What's NOT here

  • No LLM extraction (full platform handles messy natural-language PRDs)
  • No frontend, no mobile, no Stripe wiring, no rate limiting, no audit logging
  • No multi-stack (FastAPI only here — for Flask, Django, NestJS, Go, Java see archiet.com)

License

MIT. See LICENSE.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

archiet_microcodegen-0.2.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

archiet_microcodegen-0.2.1-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file archiet_microcodegen-0.2.1.tar.gz.

File metadata

  • Download URL: archiet_microcodegen-0.2.1.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for archiet_microcodegen-0.2.1.tar.gz
Algorithm Hash digest
SHA256 01e43aca78cceb44c5699b6d846c931d3d258d4c3eae520d63f9adf743f20553
MD5 683218f30b5034920c7b8a2c17875af0
BLAKE2b-256 f21f82dc69a1e935d6da13656a47470dfe00f9d41ba6dc9d87a02485978fc93e

See more details on using hashes here.

File details

Details for the file archiet_microcodegen-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for archiet_microcodegen-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e1f4e7edb3e7752abb78a2881aa91d51c41523189d20bd66c805f2f8755f0108
MD5 7e44625e984c023b7868691bbe6929c5
BLAKE2b-256 d8f71113d47cb642613ebb9bf19bb5409e85c13bf6b017d99cdd95a9682180bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page