How packtpublishing/fastapi-cookbook works
This repository is a cookbook of separate FastAPI examples, not one integrated application. The recurring workflow is an HTTP client calling a chapter-specific app, which routes requests to domain logic and, in some examples, persistence or integrations. The graph highlights representative examples and documented capabilities—authentication, ticketing, streaming/search, middleware, trips, chat, and AI/GraphQL/gRPC—rather than suggesting they share a runtime. Some subsystems are represented from the tree and README only; their internal call relationships are therefore omitted.
Main entry points: saas_app/main.py SaaS API · app/main.py Streaming API · app/main.py Ticketing API · app/main.py Trip API
Components 26
API examples
- Task API
Chapter03/task_manager_app/main.py - Task operations
Chapter03/task_manager_app/operations.py - SaaS API
Chapter04/saas_app/main.py - Auth and access
Chapter04/saas_app/security.py - User operations
Chapter04/saas_app/operations.py - Ticketing API
Chapter06/ticketing_system/app/main.py - Streaming API
Chapter07/streaming_platform/app/main.py
Data-backed apps
- SaaS database
Chapter04/saas_app/db_connection.py - Ticket operations
Chapter06/ticketing_system/app/operations.py - Ticket models
Chapter06/ticketing_system/app/database.py - Song search
Chapter07/streaming_platform/app/main_search.py - MongoDB access
Chapter07/streaming_platform/app/database.py - Search and cache
Chapter07/streaming_platform/app/db_connection.py
Advanced capabilities
- Trip API
Chapter08/trip_platform/app/main.py - Query dependencies
Chapter08/trip_platform/app/dependencies.py - Trip middleware and limits
Chapter08/trip_platform/app/middleware.py - Chat platform
Chapter09/chat_platform/app/main.py - WebSocket manager
Chapter09/chat_platform/app/ws_manager.py - Middleware example
Chapter11/middleware_project/main.py - Request and webhook middleware
Chapter11/middleware_project/middleware/webhook.py
AI and protocols
- RAG application
Chapter10/ecotech_RAG/main.py - Document handling
Chapter10/ecotech_RAG/documents.py - Model integration
Chapter10/ecotech_RAG/model.py - GraphQL example
Chapter10/graphql/main.py - gRPC gateway
Chapter10/grpc_gateway/app/main.py
Other components
- HTTP client
Connections 28
- HTTP client → Task API: sends requests
- Task API → Task operations: calls operations
Chapter03/task_manager_app/main.py - HTTP client → SaaS API: sends requests
- SaaS API → Auth and access: registers router
Chapter04/saas_app/main.py - SaaS API → User operations: creates users
Chapter04/saas_app/main.py - SaaS API → SaaS database: initializes schema
Chapter04/saas_app/main.py - SaaS API → Auth and access: resolves login token
Chapter04/saas_app/main.py - Auth and access → User operations: authenticates users
Chapter04/saas_app/security.py - HTTP client → Ticketing API: sends requests
- Ticketing API → Ticket operations: calls operations
Chapter06/ticketing_system/app/main.py - Ticketing API → Ticket models: creates schema
Chapter06/ticketing_system/app/main.py - Ticket operations → Ticket models: uses models
Chapter06/ticketing_system/app/operations.py - HTTP client → Streaming API: sends requests
- Streaming API → MongoDB access: reads and writes
Chapter07/streaming_platform/app/main.py - Streaming API → Song search: includes router
Chapter07/streaming_platform/app/main.py - Streaming API → Search and cache: initializes services
Chapter07/streaming_platform/app/main.py - HTTP client → Trip API: sends requests
- Trip API → Query dependencies: uses dependencies
Chapter08/trip_platform/app/main.py - Trip API → Trip middleware and limits: adds middleware
Chapter08/trip_platform/app/main.py - HTTP client → Chat platform: opens chat
- Chat platform → WebSocket manager: uses manager
Chapter09/chat_platform/app/main.py - HTTP client → Middleware example: sends requests
- Middleware example → Request and webhook middleware: registers webhook middleware
Chapter11/middleware_project/main.py - HTTP client → RAG application: sends prompts
- RAG application → Document handling: loads documents
Chapter10/ecotech_RAG/main.py - RAG application → Model integration: uses model
Chapter10/ecotech_RAG/main.py - HTTP client → GraphQL example: sends queries
- HTTP client → gRPC gateway: sends requests