Feature 01 · Study guide
Learn how one schema.tpy file becomes a full FastAPI stack — and how to run that workflow yourself.
In a normal FastAPI project you write models, Pydantic schemas, SQL, repositories, services, controllers, and routes by hand — for every entity. tamilPY flips that: you describe the domain once in schema.tpy, then generators produce a consistent layered app.
That gives clients a predictable project shape, faster MVPs, and fewer copy-paste bugs.
pip install tamilPY (Python 3.12+).tpy new myapp then cd myapp.schema.tpy and define your models.tpy build (DB wizard + generate) or tpy build --skip-db if .env already exists.tpy migrate, optionally tpy seed.tpy serve and open /docs.$ pip install tamilPY $ tpy new myapp && cd myapp $ # edit schema.tpy $ tpy build $ tpy migrate && tpy seed $ tpy serve
When you run tpy build / tpy crud:
schema.tpy into an AST (models, fields, relations).app/ and database/migrations/.database sqlite
model User {
id: uuid primary
name: string required
email: string unique required
age: int nullable
}
model Post {
id: uuid primary
title: string required index
body: string nullable
user_id: uuid references User on_delete cascade
published: bool default false
relations {
belongs_to User as author via user_id
}
}
| Layer | Path | Responsibility |
|---|---|---|
| Model | app/models/ | Field shape |
| Migration | database/migrations/ | Create/alter tables |
| Schema | app/schemas/ | Create / Update / Response DTOs |
| Repository | app/repositories/ | DB access + query() |
| Service | app/services/ | Business use-cases |
| Controller | app/controllers/ | HTTP → service |
| Route | app/routes/ | FastAPI router |
schema.tpy.tpy crud (or tpy watch in another terminal).tpy migrate if tables/columns changed.tpy serve --reload.tpy crud — put durable logic in services carefully.tpy migrate after adding fields.