What the generated FastAPI app contains
Application structure
app/
├── main.py # FastAPI app + lifespan + middleware
├── database.py # Async SQLAlchemy engine + session factory
├── dependencies.py # get_db(), get_current_user() FastAPI deps
├── config.py # Settings via pydantic-settings + os.getenv()
├── models/
│ ├── user.py # User, Role, Workspace (with relationships)
│ └── {entity}.py # SQLAlchemy model per entity in your PRD
├── schemas/
│ ├── user.py # Pydantic request/response schemas
│ └── {entity}.py # Pydantic schemas per entity
├── routers/
│ ├── auth.py # login, register, refresh, logout
│ └── {entity}.py # CRUD router per entity
└── services/
├── auth_service.py
└── {entity}_service.py # business logic per entity
Async SQLAlchemy + Alembic
AsyncSessionwithcreate_async_engine(asyncpg driver)- Alembic migration for every model and field change — async-aware env.py
- All foreign key columns indexed
- Multi-tenant filter on every query:
.where(Entity.workspace_id == workspace_id) - Relationship loading via
selectinload— no N+1 queries - PostgreSQL — never SQLite
Auth with FastAPI dependencies
get_current_user: Annotated[User, Depends(get_current_user_dep)]on every protected route- JWT in httpOnly, Secure, SameSite=Lax cookies — never in response body for storage
python-josefor JWT operations;passlib[bcrypt]for password hashing- Refresh token rotation with Redis (when caching is in the genome)
- OAuth2PasswordBearer for Swagger UI testing (dev only)
Pydantic schemas and validation
- Input schemas inherit from
BaseModelwithmodel_config = ConfigDict(from_attributes=True) model_validatorfor cross-field validation- Response schemas separate from request schemas — no accidental field exposure
422 Unprocessable Entityreturned automatically by FastAPI when validation fails
Auto-generated OpenAPI documentation
- Swagger UI at
/docs— interactive API explorer - ReDoc at
/redoc— readable API reference - Every endpoint: summary, description, request/response schemas, error responses
- The generated
openapi.yamlin the repo root is the authoritative spec
Tests
pytest-asynciotest suite with async fixturesAsyncClient(httpx) for route tests against test app- Factory functions for entity fixtures
- Auth tests: register → login → protected route → logout → 401
- Multi-tenant isolation tests: workspace A cannot read workspace B's data
Infrastructure
- Multi-stage Dockerfile (Python slim → production)
docker-compose.yml: FastAPI app + PostgreSQL + Redispyproject.tomlwith Ruff + pylint configuration- GitHub Actions: ruff lint → pylint → pytest → build → deploy
FastAPI vs Flask — the key differences in generated code
| Aspect | FastAPI | Flask | |--------|---------|-------| | Async | Native async/await throughout | Synchronous (or gevent/eventlet) | | Validation | Pydantic built-in | Marshmallow / manual | | OpenAPI docs | Auto-generated, always current | Manual maintenance | | Type safety | Full type hints throughout | Optional | | Performance | High throughput via async | Good for standard web apps | | Learning curve | Requires async Python knowledge | Lower entry bar |
Both are generated by Archiet. Pick the right one for your team and requirements.
vs fastapi-fullstack, fastapi-boilerplate GitHub repos
Popular GitHub FastAPI boilerplates (fastapi-fullstack, tiangolo's full-stack template, FastAPI-boilerplate) wire up the framework plumbing correctly. What they contain is a todo app or a user management demo — not your product.
Archiet generates the product layer: your entities, your business logic, your routes, your tests, based on your requirements document. The framework plumbing is included; so is your app.
CTA
Generate a complete FastAPI + Next.js application from your requirements — free plan, no credit card.
Describe your product or upload a PRD, pick FastAPI + Next.js, download a production-ready async Python codebase in 90 seconds.
Start free at archiet.com.