0% found this document useful (0 votes)
2 views4 pages

U03 02.TodoAPI ImplementAPI

The document outlines the implementation of a TODO API using FastAPI and Async SQLAlchemy, with a focus on creating a Dockerized Postgres setup. It details the project structure, tasks for setup, acceptance criteria, and deliverables including source code and documentation. The rubric for evaluation includes criteria for database setup, model correctness, CRUD functionality, and documentation quality.

Uploaded by

mactuong105
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

U03 02.TodoAPI ImplementAPI

The document outlines the implementation of a TODO API using FastAPI and Async SQLAlchemy, with a focus on creating a Dockerized Postgres setup. It details the project structure, tasks for setup, acceptance criteria, and deliverables including source code and documentation. The rubric for evaluation includes criteria for database setup, model correctness, CRUD functionality, and documentation quality.

Uploaded by

mactuong105
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

[Link]-ImplementAPI.

md

al
rn
HoHai
te
Mar-2026
In
RECORD OF CHANGES

No Effective Change Descrip- Reason Reviewer Approver


Date tion
1 Mar-2026 Initial Version. Create new HoHai

al
rn
te
In
FSA - FPT Software (Internal Use) [Link]

Exercise: FastAPI + Async SQLAlchemy + Basic TODO CRUD


Goal
Build an API-only TODO service using FastAPI + SQLAlchemy 2.x async (asyncpg) connected to the Dock-
erized Postgres.

Suggested Project Structure


app/
core/[Link]
db/[Link]
db/[Link]
db/[Link]
api/routes/[Link]
[Link]
alembic/ (created in Lab 4)

al
[Link] (later adds app service)
Dockerfile

Tasks
1. Dependencies

2. Async SQLAlchemy setup


rn
pip install fastapi uvicorn sqlalchemy asyncpg pydantic pydantic-settings

• Depend on your implementation


3. Model
• Todo model has some fields: id, title, description, completed, created_at, updated_at
te
4. Schema (Pydantic)
• Create schema models: TodoCreate, TodoRead with require validation
5. FastAPI App
• Consider to use router (APIRouter - fastapi)
6. Run
In

uvicorn [Link]:app --reload


# Test in /docs (Swagger) and with curl
curl -X POST [Link] -H "Content-Type: application/json" -d '{"title":"Read paper"

Acceptance Criteria
• API responds with 201 on create, returns JSON aligned with schema.
• GET, PATCH toggle, DELETE behave as defined.
• /docs loads correctly with generated OpenAPI.

Deliverables
• Source code.
• A short README with run instructions and sample curl or test script calls.

Author: HoHai Page 3 / 4 Mar-2026


FSA - FPT Software (Internal Use) [Link]

Rubric (40 pts)


• Async DB setup
• Model + schema correctness
• CRUD endpoints working
• README & API docs

al
rn
te
In

Author: HoHai Page 4 / 4 Mar-2026

You might also like