Chapter 30: Capstone Project - Building Your Production API

1. Capstone project

This is the book's capstone. Three phases (core implementation, AWS production deployment, an extension of your choice) build a portfolio-grade API that exercises every pattern from the previous 29 chapters. The chapter walks the news-aggregator project end to end, but the same scaffolding works for any API-shaped idea you bring instead.

What you'll learn
  • Scoping a production API project: pick a problem, decide the data model, draw the request flow, write down the deployment target
  • Phase 1 (core implementation): FastAPI app, SQLAlchemy models, external API integrations, auth, validation, tests
  • Phase 2 (production deployment): Docker Compose locally, then ECR + ECS + RDS + ALB + ACM on AWS, with CloudWatch monitoring and a GitHub Actions CI/CD pipeline
  • Phase 3 (extension): pick one advanced feature (sentiment analysis, full-text search, webhooks, GraphQL, async fan-out) and ship it well
  • How to document a portfolio project so a hiring manager can run it themselves and understand the architectural decisions
  • How to self-evaluate against a rubric and ship when "good enough to send a link" is true
What you'll build
  • A complete REST API with PostgreSQL persistence, API key auth, rate limiting, and FastAPI's auto-generated docs at /docs
  • The same API containerised with Docker, orchestrated locally with Compose, then deployed to AWS via ECR + ECS Fargate + RDS + ALB + ACM (HTTPS)
  • One chosen extension shipped end-to-end (the chapter walks through sentiment analysis as a worked example; other options listed)
  • A portfolio-grade README, an architecture diagram, a short demo video, and a written reflection that surfaces the design tradeoffs you made
  • A self-evaluation against the rubric so the submission is honest about what's strong and what's intentionally deferred

What this chapter is, and what it isn't

The chapter is a scaffolded project. It tells you what to build but not what each line of code should be. Every previous chapter went deep on one technique; this chapter trusts you to compose them. The walked example is a news aggregator (extending the Chapter 11 sync version and the Chapter 26 FastAPI version), but the same three-phase shape works for a recipe finder, a fitness tracker, a course catalogue, or anything else API-shaped.

What it isn't: a tutorial you can complete by copying. The code blocks are skeletons and worked examples for the parts most readers get stuck on; the rest of the build is yours. If you've worked through the previous 29 chapters, you have the pieces. The capstone is about composing them under real-project constraints (scope, time, polish for a portfolio audience), not about learning new syntax.

The three phases, and what success looks like

  • Phase 1 (core implementation). The API runs locally end-to-end. Models persist to PostgreSQL via SQLAlchemy. At least one external API (NewsAPI, Guardian, Reddit, or your domain's equivalent) is integrated with proper error handling. API key authentication protects mutating endpoints. Pydantic validates every request body. There's at least a thin pytest suite covering the happy paths and one failure case per endpoint.
  • Phase 2 (production deployment). The API is containerised, the Compose stack runs locally, and the production deploy lives on AWS with a public HTTPS URL. CloudWatch dashboards expose latency and error rate. A GitHub Actions workflow deploys on every push to main. The deployment is reproducible from the committed config.
  • Phase 3 (extension). One advanced feature, scoped tight, shipped well. Sentiment analysis (walked in the chapter), full-text search, a webhook receiver, a GraphQL endpoint, or async fan-out for multi-source aggregation are all viable. "Done" means the feature works end-to-end, has at least one test, and is documented in the README.

How the chapter is laid out

Next, in section 2, we plan the system architecture before any code: data model, endpoint shape, auth strategy, deployment target. Decisions made here cascade through every later phase.