Metadata-Version: 2.4
Name: archiet-microcodegen-flask
Version: 0.1.0
Summary: PRD text → working Flask + SQLAlchemy app ZIP. Pure stdlib, zero dependencies, zero LLM calls.
Project-URL: Homepage, https://archiet.com?utm_source=pypi&utm_medium=package&utm_campaign=microcodegen-flask
Project-URL: Source, https://github.com/aniekanasuquookono-web/archiet
Author-email: Aniekan Okono <founder@archiet.com>
License: MIT License
        
        Copyright (c) 2026 Archiet (Aniekan Okono)
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: api-generator,archiet,codegen,flask,microcodegen,prd,scaffolding,sqlalchemy
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# archiet-microcodegen-flask

> PRD text → working Flask + SQLAlchemy app → ZIP, in <1400 LOC, pure stdlib, zero LLM calls.
> Inspired by Karpathy's micrograd: this file is the complete algorithm.

Built on [Archiet](https://archiet.com?utm_source=pypi&utm_medium=package&utm_campaign=microcodegen-flask) — AI-native architecture-to-code platform.

## Install

```bash
pip install archiet-microcodegen-flask
```

## Use

```bash
# Write ZIP to disk
archiet-microcodegen-flask path/to/prd.md --out ./out/

# Pipe ZIP to stdout
archiet-microcodegen-flask path/to/prd.md > app.zip
```

As a library:

```python
from archiet_microcodegen_flask import microcodegen_flask

prd_text = open("prd.md").read()
zip_bytes = microcodegen_flask(prd_text)
```

## What you get

The generated output is a working Flask + PostgreSQL app:

```
app/__init__.py          Flask app factory — create_app()
app/extensions.py        db, jwt, migrate singletons
app/auth/routes.py       register / login / logout / me
app/models/user.py       User model
app/models/<entity>.py   One SQLAlchemy model per entity
app/routes/<entity>.py   One Blueprint per entity (full CRUD)
config.py                JWT_TOKEN_LOCATION=["cookies"], JWT_COOKIE_HTTPONLY=True
manage.py                Flask CLI entrypoint
requirements.txt         flask, flask-sqlalchemy, flask-jwt-extended, flask-migrate, psycopg2-binary
docker-compose.yml       Postgres 16 with healthcheck-gated startup
Dockerfile               python:3.12-slim, port 5000
.env.example             DATABASE_URL, JWT_SECRET_KEY, SECRET_KEY
tests/test_app.py        pytest smoke tests (register, login, health)
ARCHITECTURE.md          ArchiMate 3.2 element map
openapi.yaml             OpenAPI 3.1 spec
GENOME.json              Intermediate representation (for debugging/regeneration)
README.md                Quick-start for the generated app
```

## The four stages

1. **`parse_prd(text) → manifest`** — regex extraction of entities, fields, user stories, integrations
2. **`manifest_to_genome(manifest) → genome`** — maps to canonical IR with ArchiMate 3.2 element typing
3. **`render_genome(genome) → {path: content}`** — `string.Template`-based Flask rendering
4. **`pack(files) → bytes`** — stdlib `zipfile`

## Auth — httpOnly cookies, non-negotiable

- `JWT_TOKEN_LOCATION = ["cookies"]`
- `JWT_COOKIE_HTTPONLY = True`
- `JWT_COOKIE_SAMESITE = "Lax"`
- Register → sets cookie. Login → sets cookie. Logout → clears cookie.
- NEVER localStorage. NEVER Authorization header in response body.

## 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](https://archiet.com?utm_source=pypi&utm_medium=package&utm_campaign=microcodegen-flask) platform adds:

- LLM-powered PRD extraction (chunked, overlap+dedup, handles natural language)
- 12+ stack renderers (FastAPI, Flask, Django, NestJS, Laravel, Go, Java, Rails, .NET, Tauri+Rust, Salesforce, SAP CAP)
- Capability emission, frontend (Next.js / Expo), stub-filling, quality scoring, delivery gates
- Cross-stack parity enforcement and verification

But none of that changes the **core algorithm**. If a bug doesn't reproduce here, it's in an efficiency layer.

## What's NOT included

- No LLM calls (deterministic zone by design)
- No frontend, no mobile, no payment integration, no rate limiting, no audit logging
- No multi-stack output (Flask only; see `archiet-microcodegen` for the FastAPI variant)

## License

MIT. See [LICENSE](https://github.com/aniekanasuquookono-web/archiet/blob/main/LICENSE).

## Links

- Source: [github.com/aniekanasuquookono-web/archiet](https://github.com/aniekanasuquookono-web/archiet)
- FastAPI variant: [archiet-microcodegen](https://pypi.org/project/archiet-microcodegen/)
- Full platform: [archiet.com](https://archiet.com?utm_source=pypi&utm_medium=package&utm_campaign=microcodegen-flask)
