Week 2 — Deployment & APIs
Now that you have a solid development environment, it is time to build APIs and deploy them. This week covers the full lifecycle: writing a FastAPI application, containerizing it with Docker, and deploying to cloud platforms. You will also learn about cross-origin requests, authentication, and HuggingFace Spaces.
Overview
In this week, you will build a REST API with FastAPI, package it in a Docker container, and deploy it to multiple cloud platforms. You will understand how web applications communicate, handle authentication, and serve ML models to end users.
Pages
| # | Page | Topic |
|---|---|---|
| 1 | FastAPI | Routes, params, middleware, OpenAPI docs |
| 2 | Docker | Dockerfiles, multi-stage builds, compose |
| 3 | Vercel & Render | Serverless deployments |
| 4 | HuggingFace | Spaces, Gradio apps |
| 5 | CORS & REST | Cross-origin requests, HTTP status codes |
| 6 | Google Auth | OAuth2, service accounts |
Learning Outcomes
By the end of this week, you will be able to:
- Build REST APIs with FastAPI including path parameters, query parameters, and request bodies
- Write Dockerfiles with multi-stage builds for optimized production images
- Deploy applications to Vercel (serverless) and Render (containerized)
- Create interactive ML demos on HuggingFace Spaces with Gradio
- Understand and configure CORS for cross-origin API access
- Implement Google OAuth2 authentication and use service accounts for API access
Time estimate
Expect to spend 7-9 hours on this week's material: ~2 hours reading, ~3 hours on walkthroughs, and ~3 hours on the lab.