Skip to content

Commit 1c0bd5e

Browse files
committed
Add milestone project 099: Capstone full-stack application
1 parent 8e1c691 commit 1c0bd5e

18 files changed

Lines changed: 1350 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Module 099: Capstone Project: Full-Stack Application (FastAPI + DB + Data Pipeline)
2+
3+
- **Phase:** 11. Capstone
4+
- **Duration:** 6 hours
5+
- **Milestone:** Yes
6+
7+
## Learning Objectives
8+
9+
- Build a complete full-stack application from scratch
10+
- Implement FastAPI backend with SQLite/SQLAlchemy
11+
- Create a data ingestion pipeline (CSV or API)
12+
- Design RESTful API endpoints
13+
- Build a Jinja2 web UI
14+
- Validate input with Pydantic models
15+
- Handle errors and log application activity
16+
17+
## Project Structure
18+
19+
```
20+
module-099-capstone-project/
21+
├── README.md
22+
├── notebook.ipynb
23+
├── exercises.md
24+
├── solutions.md
25+
├── quiz.md
26+
└── project/
27+
├── README.md
28+
├── starter_code.py
29+
└── solution/
30+
├── app.py
31+
├── models.py
32+
├── database.py
33+
├── schemas.py
34+
├── templates/
35+
│ ├── base.html
36+
│ ├── index.html
37+
│ └── tasks.html
38+
└── requirements.txt
39+
```
40+
41+
## Prerequisites
42+
43+
All modules 000-098, especially FastAPI, SQLAlchemy, Jinja2, Pydantic, and logging.
44+
45+
## Resources
46+
47+
- FastAPI: https://fastapi.tiangolo.com
48+
- SQLAlchemy: https://www.sqlalchemy.org
49+
- Jinja2: https://jinja.palletsprojects.com
50+
- Pydantic: https://docs.pydantic.dev
51+
- Bootstrap for styling (optional)
52+
53+
## Next Module
54+
55+
Module 100: Where to Go Next
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Exercises: Capstone Project: Full-Stack Application
2+
3+
## Exercise 1: Database Models
4+
Define SQLAlchemy models for `Task` (id, title, description, status, priority, created_at, updated_at, category_id) and `Category` (id, name).
5+
6+
## Exercise 2: CRUD Endpoints
7+
Create FastAPI endpoints for full CRUD operations on tasks:
8+
- `GET /tasks` - list all tasks
9+
- `GET /tasks/{id}` - get a single task
10+
- `POST /tasks` - create a task
11+
- `PUT /tasks/{id}` - update a task
12+
- `DELETE /tasks/{id}` - delete a task
13+
14+
## Exercise 3: Input Validation
15+
Use Pydantic models for request/response validation. Include validation for task status (enum: pending, in_progress, completed) and priority (1-5).
16+
17+
## Exercise 4: Data Ingestion
18+
Create a `POST /tasks/import` endpoint that accepts a CSV file upload and bulk-imports tasks into the database. Handle duplicates gracefully.
19+
20+
## Exercise 5: Web UI with Jinja2
21+
Create Jinja2 templates for:
22+
- A task list page with filtering by status
23+
- A task creation form
24+
- A task detail/edit page
25+
Use Bootstrap or simple CSS for styling.
26+
27+
## Exercise 6: Error Handling
28+
Implement global exception handlers for:
29+
- 404 Not Found
30+
- 422 Validation Error
31+
- 500 Internal Server Error
32+
Log all errors with traceback information.
33+
34+
## Challenge: Dashboard with Statistics
35+
Create a dashboard endpoint that returns:
36+
- Total tasks count
37+
- Tasks by status (pending, in_progress, completed)
38+
- Tasks by priority
39+
- Recently updated tasks (last 24 hours)
40+
Expose both as a JSON API and a Jinja2 template.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 5,
4+
"metadata": {
5+
"kernelspec": {
6+
"display_name": "Python 3",
7+
"language": "python",
8+
"name": "python3"
9+
},
10+
"language_info": {
11+
"name": "python",
12+
"version": "3.13.0"
13+
}
14+
},
15+
"cells": [
16+
{
17+
"cell_type": "markdown",
18+
"metadata": {},
19+
"source": [
20+
"# Module 099: Capstone Project: Full-Stack Application\n",
21+
"\n",
22+
"Phase 11: Capstone | Duration: 6 hours | Milestone: Yes"
23+
]
24+
},
25+
{
26+
"cell_type": "markdown",
27+
"metadata": {},
28+
"source": [
29+
"## Project Overview\n",
30+
"\n",
31+
"Build a complete full-stack \"Task Manager\" application with:\n",
32+
"- FastAPI backend\n",
33+
"- SQLite/SQLAlchemy database\n",
34+
"- Data ingestion pipeline (CSV import)\n",
35+
"- RESTful API endpoints\n",
36+
"- Jinja2 templates for web UI\n",
37+
"- Pydantic input validation\n",
38+
"- Error handling and logging\n",
39+
"- Type hints throughout"
40+
]
41+
},
42+
{
43+
"cell_type": "markdown",
44+
"metadata": {},
45+
"source": [
46+
"## Architecture\n",
47+
"\n",
48+
"```\n",
49+
"┌──────────┐ ┌──────────┐ ┌──────────┐\n",
50+
"│ Browser │────►│ FastAPI │────►│ SQLite │\n",
51+
"│ (Jinja2) │ │ (REST) │ │ (SQLAlch)│\n",
52+
"└──────────┘ └──────────┘ └──────────┘\n",
53+
"\n",
54+
"\n",
55+
" ┌──────────┐\n",
56+
" │ CSV │\n",
57+
" │ Ingestion│\n",
58+
" └──────────┘\n",
59+
"```\n",
60+
"\n",
61+
"### Key Components\n",
62+
"\n",
63+
"1. **Database Models**: Task, Category, User\n",
64+
"2. **API Endpoints**: CRUD for tasks, CSV upload, statistics\n",
65+
"3. **Web UI**: Task list, add/edit forms, dashboard\n",
66+
"4. **Data Pipeline**: Parse CSV, validate, bulk import\n",
67+
"5. **Error Handling**: HTTP exceptions, validation errors\n",
68+
"6. **Logging**: Request/response logging, error tracking"
69+
]
70+
},
71+
{
72+
"cell_type": "markdown",
73+
"metadata": {},
74+
"source": [
75+
"## Setup Instructions\n",
76+
"\n",
77+
"```bash\n",
78+
"# Clone the project directory\n",
79+
"cd project/\n",
80+
"\n",
81+
"# Install dependencies\n",
82+
"pip install -r requirements.txt\n",
83+
"\n",
84+
"# Run the application\n",
85+
"python -m app\n",
86+
"\n",
87+
"# Open in browser\n",
88+
"# http://localhost:8000\n",
89+
"# API docs at http://localhost:8000/docs\n",
90+
"```\n",
91+
"\n",
92+
"See `project/README.md` for detailed instructions."
93+
]
94+
}
95+
]
96+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Capstone Project: Task Manager (Full-Stack Application)
2+
3+
Build a complete Task Manager application with a FastAPI backend, SQLite database, data ingestion pipeline, and a Jinja2 web UI.
4+
5+
## Functional Requirements
6+
7+
### Phase 1: Database & Models
8+
- Create SQLAlchemy models: `Task` (id, title, description, status, priority, created_at, updated_at, category_id) and `Category` (id, name)
9+
- Use SQLite as the database engine
10+
- Auto-create tables on startup
11+
12+
### Phase 2: API Endpoints
13+
- `GET /tasks` - list all tasks (supports filtering by status, priority, category)
14+
- `GET /tasks/{id}` - get a single task
15+
- `POST /tasks` - create a task
16+
- `PUT /tasks/{id}` - update a task
17+
- `DELETE /tasks/{id}` - delete a task
18+
- `POST /tasks/import` - bulk import tasks from CSV
19+
- `GET /categories` - list all categories
20+
- `GET /dashboard` - statistics endpoint
21+
22+
### Phase 3: Data Ingestion
23+
- Accept CSV upload with columns: title, description, status, priority, category
24+
- Validate each row before inserting
25+
- Skip duplicates (same title)
26+
- Return summary of imported/skipped rows
27+
28+
### Phase 4: Web UI (Jinja2 Templates)
29+
- Task list page with search and filter controls
30+
- Add/edit task form with dropdown for categories
31+
- Task detail view
32+
- Dashboard page with statistics (total tasks, by status, by priority)
33+
- Responsive design with basic CSS styling
34+
35+
### Phase 5: Error Handling & Logging
36+
- 404 handler for missing tasks
37+
- 422 handler for validation errors
38+
- 500 handler for unexpected errors
39+
- Log all API requests and errors to `app.log`
40+
41+
## Stretch Goals
42+
43+
1. Add user authentication (simple token-based)
44+
2. Add pagination to task listing
45+
3. Add task due dates and overdue highlighting
46+
4. Add export to CSV endpoint
47+
5. Add unit tests with pytest
48+
6. Dockerize the application
49+
50+
## Setup
51+
52+
```bash
53+
pip install -r requirements.txt
54+
python -m app
55+
```
56+
57+
Open http://localhost:8000 in your browser.
58+
API docs are at http://localhost:8000/docs.
59+
60+
## Project Structure
61+
62+
```
63+
project/
64+
├── README.md
65+
├── starter_code.py
66+
├── requirements.txt
67+
└── solution/
68+
├── app.py
69+
├── models.py
70+
├── database.py
71+
├── schemas.py
72+
└── templates/
73+
├── base.html
74+
├── index.html
75+
└── tasks.html
76+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fastapi>=0.104.0
2+
uvicorn>=0.24.0
3+
sqlalchemy>=2.0.0
4+
jinja2>=3.1.0
5+
python-multipart>=0.0.6
6+
pydantic>=2.0.0
7+
pydantic-settings>=2.0.0
8+
aiofiles>=23.0.0

0 commit comments

Comments
 (0)