Python stacks supported
Flask + Next.js The most battle-tested Python web stack for SaaS applications. SQLAlchemy ORM with Alembic migrations, Blueprint-based route organisation, JWT auth in httpOnly cookies, Celery + Redis for async tasks.
FastAPI + React Type-annotated Python with Pydantic schemas and async SQLAlchemy. Auto-generated interactive docs, dependency injection, background tasks. Best for API-first products and teams who want native Python type safety end to end.
Django + Next.js Django ORM with native migrations, class-based views, Django REST Framework serializers, built-in admin panel. Best when you need the full Django ecosystem and a team that already knows it.
What gets generated for Python backends
Models and database
- SQLAlchemy ORM models (Flask/FastAPI) or Django ORM models — never raw SQL
- Migration script for every model field, using Alembic (Flask/FastAPI) or Django's built-in migration system
- Foreign key indexes on every FK column
- Organization-scoped query filters on every multi-tenant entity — no
Query.all()without tenant context
API routes
- RESTful endpoints matching the generated OpenAPI 3.1 spec
- Pydantic schemas for request validation (FastAPI) or Marshmallow (Flask)
- Consistent error responses:
{"error": "snake_case_code", "message": "Human readable description."} - HTTP 201 for creation, 422 for validation errors, 403 for auth, 404 for not found
Authentication
- JWT issued as httpOnly, Secure, SameSite=Lax cookies — never localStorage
- Bcrypt password hashing via
passlib @login_requireddecorator /Depends(get_current_user)on every protected route- Password reset flow, email verification, token expiry and refresh
Infrastructure
- Multi-stage Dockerfile (Python base → install deps → copy app → production image)
docker-compose.ymlwith app + PostgreSQL + Redis (when Celery is included)requirements.txtwith pinned versionspytesttest suite: auth tests, model tests, route tests, tenant isolation tests- GitHub Actions CI/CD: lint (ruff/pylint) → test → build → deploy
Code quality
- Type annotations on all public functions (Python typing)
- Pylint score ≥ 9.0
- No
TODO,FIXME, orpass # implementin delivered code - No hardcoded secrets — all from
os.getenv()
Example: what a Flask + Next.js generation looks like
A typical B2B SaaS generation in Flask produces:
app/
├── blueprints/
│ ├── auth_bp.py # login, register, logout, password reset, email verify
│ ├── user_bp.py # user profile, settings
│ ├── billing_bp.py # Stripe subscription management
│ └── {entity}_bp.py # one blueprint per entity in your PRD
├── models/
│ ├── user.py # User, Role, Workspace models
│ └── {entity}.py # one model file per entity
├── services/
│ ├── auth_service.py
│ ├── email_service.py # SendGrid wiring
│ └── {entity}_service.py
├── schemas/ # Marshmallow request/response schemas
└── config.py # reads all config from os.getenv()
alembic/
└── versions/ # one migration file per model change
tests/
├── test_auth.py
├── test_models.py
└── test_{entity}.py
docker-compose.yml
Dockerfile
requirements.txt
openapi.yaml # authoritative API spec
Quality gate for Python output
The delivered Python code passes the Archiverify scanner before you download:
- Import coherence: every
from app.X import Yis resolvable in the generated file tree - Tenant filter check: flags any
Query.all()without a.filter_by(organization_id=...)or.filter_by(workspace_id=...) - Secret scan: flags any hardcoded string that matches known secret patterns
- SBT (Software Boot Test): boots the Flask application in a sandboxed environment, runs
alembic upgrade head, asserts the app starts without errors
The cert tier on the quality report tells you the result: certified (booted + migrations passed), verified (static checks passed), or flagged (defects found).
vs AI Python code generators that write snippets
Tools like GitHub Copilot, Cursor, and ChatGPT write excellent Python code if you know what to ask for. They're your daily driver for feature work once you have a codebase.
The difference with Archiet is the starting point. Instead of asking an AI to write each piece — the auth blueprint, then the user model, then the migration, then the tests — you provide requirements and get the entire application: all pieces consistent, all imports resolved, all tests passing.
CTA
Generate a Flask or FastAPI application from your requirements — free plan, no credit card.
Typical generation: 45–90 seconds from requirements to a quality-scored, downloadable codebase.
Start free at archiet.com.