
Capstone Project: Designing an AI-Powered Task Platform
Put it all together. Design a production-grade, distributed system that combines everything you've learned—from WebSockets to AI streaming.
Capstone Project: Designing an AI-Powered Task Platform
Congratulations! You have covered the vast landscape of modern API development with FastAPI. In this final module, we don't learn "New" features. Instead, we learn how to Architect a complex system using everything we've mastered.
Your mission: Design a Smart Todo List that automatically summarizes tasks and provides real-time updates when an AI is finished processing them.
1. The Requirements
Our API must:
- Auth: Use OAuth2 and JWT for secure login (Module 9).
- Database: Store tasks and users in a PostgreSQL database using SQLModel (Module 10).
- Background Work: Send the task content to an AI for summarization in the background using a Task Queue (Module 11).
- Real-Time: Notify the user via WebSockets when the summary is ready (Module 12).
- Documentation: Have a polished, example-rich Swagger UI (Module 13).
- Reliability: Be fully tested with Pytest (Module 14).
2. The System Architecture
This isn't just a Python script; it's a Distributed System.
graph TD
User["User (Browser)"] -- "REST API" --> App["FastAPI App"]
App -- "SQLModel" --> DB["PostgreSQL"]
App -- "Produce Task" --> Redis["Redis Queue"]
Redis -- "Consume" --> Worker["Celery Worker"]
Worker -- "Summarize" --> LLM["Google Gemini / OpenAI"]
Worker -- "Update Task" --> DB
Worker -- "Notify" --> App
App -- "WebSocket" --> User
3. Implementation Checklist
Step A: The Schema
Define your User and Task models. Ensure the Task has a status field (e.g., "Pending", "Processing", "Completed").
Step B: The Dependency Matrix
Create your get_current_user and get_db dependencies. Use these in every route to ensure security and data integrity.
Step C: The Async Flow
When a user adds a task:
- Save to DB.
- Trigger the Celery worker.
- Return
201 Createdimmediately.
4. Final Review: The "Quality" Checklist
Before you ship your capstone, check:
- Security: Are you hashing passwords? Are you checking IDOR ownership?
- Logging: Does a failed AI call produce an
ERRORlog with a traceback? - Documentation: Do your models have
examples? - Scale: Are you using
async deffor the WebSocket and AI components?
Summary
This project is the culmination of your journey. By building this, you prove that you can handle the complexity of modern, production-grade systems.
In the next lesson, we wrap up the course with Next Steps and Graduation.