Chapter 2. Getting Started with FastAPI
By the end of this chapter, you should feel comfortable using the FastAPI web framework, setting up FastAPI projects, and articulating your tech stack decisions for building GenAI services.
Introduction to FastAPI
FastAPI is an asynchronous gateway interface (ASGI) web framework that enables you to build lean APIs and backend web servers. Being an ASGI framework means that it can leverage concurrency to process web requests. It is fast comparable to modern frameworks but also ships with strong Swagger/OpenAPI integrations for auto-documentation, alongside built-in data validation and serialization features via Pydantic.1 Effectively, FastAPI is a wrapper over the Starlette framework, built by Encode, the same people who built the Django REST framework. It is light-weight and has a similar development experience.
Before we discuss FastAPI in more detail, let’s set up your development environment with a running FastAPI application.
Setting Up Your Development Environment
Throughout the rest of this chapter, I will guide you through the installation process of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access