archiet-microcodegen-django
PRD text → working Django REST Framework app → ZIP, in <1400 LOC, pure stdlib, zero LLM calls. Inspired by Karpathy's micrograd: this file is the complete algorithm.
Install
pip install archiet-microcodegen-django
Use
# Write ZIP to stdout
archiet-microcodegen-django path/to/prd.md > app.zip
# Extract directly to a directory
archiet-microcodegen-django path/to/prd.md --out ./out/
As a library:
from archiet_microcodegen_django import microcodegen_django
prd_text = open("prd.md").read()
zip_bytes = microcodegen_django(prd_text)
open("app.zip", "wb").write(zip_bytes)
What you get
The generated ZIP is a working Django 5 + PostgreSQL app with:
| File | Purpose |
|---|---|
manage.py |
Standard Django management entry point |
<project>/settings.py |
DATABASES, INSTALLED_APPS, REST_FRAMEWORK, SIMPLE_JWT |
<project>/urls.py |
DefaultRouter + auth endpoints wired |
<project>/wsgi.py |
Gunicorn-compatible WSGI application |
apps/accounts/models.py |
Custom User model (UUID PK, email login) |
apps/accounts/authentication.py |
JWTCookieAuthentication — reads httpOnly cookie |
apps/accounts/views.py |
register / login / logout / me / health |
apps/<entity>/models.py |
Django Model with user = ForeignKey(User) for tenant isolation |
apps/<entity>/serializers.py |
ModelSerializer with all fields |
apps/<entity>/views.py |
ModelViewSet with get_queryset filtered by request.user |
apps/<entity>/urls.py |
DefaultRouter registration |
requirements.txt |
Django, DRF, simplejwt, psycopg2-binary, gunicorn, PyJWT, django-cors-headers |
Dockerfile |
Python 3.12-slim, gunicorn production server |
docker-compose.yml |
Postgres 16 with healthcheck-gated startup |
.env.example |
Pre-populated with generated secrets |
ARCHITECTURE.md |
ArchiMate 3.2 element map |
openapi.yaml |
OpenAPI 3.1 spec — importable into Postman / Swagger UI |
GENOME.json |
The intermediate representation that drove rendering |
Auth design (non-negotiable)
JWT is set as an httpOnly, SameSite=Lax cookie — never in the response body, never in localStorage. This prevents XSS token theft without requiring a custom Authorization header.
POST /api/auth/register→ sets cookie, returns{user: {id, email}}POST /api/auth/login→ sets cookie, returns{user: {id, email}}POST /api/auth/logout→ deletes cookieGET /api/auth/me→ returns current user (cookie required)
The four stages
parse_prd(text) → manifest— regex extraction of entities, fields, user stories, integrations (verbatim fromscripts/microcodegen.py)manifest_to_genome(manifest) → genome— maps to the canonical ArchiMate 3.2-typed IR (verbatim fromscripts/microcodegen.py)render_genome(genome) → {path: content}— Django DRF rendering (this package's contribution)pack(files) → bytes— stdlibzipfile(verbatim fromscripts/microcodegen.py)
Per-tenant data isolation
Every generated Model has a user = ForeignKey(User, on_delete=CASCADE) field. Every ViewSet overrides get_queryset to filter by request.user. Cross-user data access is structurally impossible via the generated API.
Quick start (generated app)
cp .env.example .env
docker compose up
curl http://localhost:8000/health/
# Register
curl -c cookies.txt -X POST http://localhost:8000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com","password":"hunter22hunter"}'
# Create an entity
curl -b cookies.txt -X POST http://localhost:8000/api/items/ \
-H "Content-Type: application/json" \
-d '{"name":"My first item"}'
Why this exists
Spec-driven architecture before vibecoding. The genome is an ArchiMate 3.2 intermediate representation — your PRD becomes an architecture document, not just a prompt.
The full Archiet platform adds:
- LLM-powered PRD extraction (chunked, overlap+dedup)
- 12+ stack renderers (FastAPI, Django, NestJS, Go, Java, Rails, .NET, Tauri+Rust, Salesforce, SAP CAP, Dynamics, Laravel)
- Frontend (Next.js / Expo), quality scoring, delivery gates, formal ArchiMate 3.2 models
But none of that changes the core algorithm. If a bug doesn't reproduce here, it's in an efficiency layer.
License
MIT.
Metadata
Release files for archiet-microcodegen-django 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| archiet_microcodegen_django-0.1.0.tar.gz | 15.4 kB | Without provenance | Details for archiet_microcodegen_django-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| archiet_microcodegen_django-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for archiet_microcodegen_django-0.1.0-py3-none-any.whl |
Total release size: 35.9 kB
Release files / archiet_microcodegen_django-0.1.0.tar.gz
| Download URL | archiet_microcodegen_django-0.1.0.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c728743e4f510a91a4a02690265a966ba5343a5249abe73b1fa1797cd4dc78e6
|
|
BLAKE2b-256 checksum How to use checksums |
6f21643c2d8091c1bd5d3d663d8983f85e9785603c654ff2bde5b115c4359dd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / archiet_microcodegen_django-0.1.0-py3-none-any.whl
| Download URL | archiet_microcodegen_django-0.1.0-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96087efc3ffc9830f713469d884eb3f4f21445d16f693cf78d67e2bd8f1af6dc
|
|
BLAKE2b-256 checksum How to use checksums |
d22f358c49c4fc10ab4ee68cd8bfb3ef748303559b33b5e9872fb41ce49ccffb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for archiet-microcodegen-django 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.