All projects
Project case study
Task Management API
A FastAPI task service with Argon2 password hashing, seven-day JWTs, SQLAlchemy user-task relationships, owner-scoped CRUD, and offset/limit pagination.
FastAPISQLAlchemySQLiteJWTArgon2
Open source repositoryThe problem
Let authenticated users manage their own tasks while keeping each query scoped to the current account.
Request flow
- 01Bearer token
- 02current-user dependency
- 03owner-scoped SQLAlchemy query
- 04task response
Example route: GET /tasks/?skip=0&limit=10
Implementation decisions
- Connect users and tasks with a SQLAlchemy relationship and owner ID.
- Hash account passwords with Argon2 and issue seven-day JWTs.
- Use offset/limit pagination and update only fields supplied in the request.
Validation and failure handling
- Read, update, and delete queries include both task ID and owner ID.
- Missing or foreign-owned tasks return 404.