Getting started with FastApi
Minimum price
Suggested price

Getting started with FastApi

Here continue your roadmap in the development of web applications in Python with FastApi

About the Book

FastAPI is a great web framework for creating web APIs with Python; It offers us multiple features with which it is possible to create modular, well-structured, scalable APIs with many options such as validations, formats, typing, among others.

When you install FastAPI, two very important modules are installed:

  • Pydantic that allows the creation of models for data validation.
  • Starlette, which is a lightweight ASGI tooltip, used to create asynchronous (or synchronous) web services in Python.

With these packages, we have the basics to create APIs, but we can easily extend a FastAPI project with other modules to provide the application with more features, such as the database, template engines, among others.

FastAPI is a high-performance, easy-to-learn, start-up framework; It is ideal for creating all kinds of sites that not only consist of APIs, but we can install a template manager to return complete web pages.

This book is mostly practical, we will learn the basics of FastAPI, knowing its main features based on a small application that we will extend chapter after chapter and whose content you can see below:

  1. Chapter 1: We present some essential commands to develop in FastApi , we will prepare the environment and we will give an introduction to the framework .
  2. Chapter 2: One of the main factors in FastApi is the creation of resources for the API through functions, in this section we will deal with the basics of this, introducing routing between multiple files as well as the different options for the arguments and parameters of these routes.
  3. Chapter 3: In this section, learn how to handle HTTP status codes from API methods and also handle errors/exceptions from API methods.
  4. Chapter 4: In this section we will see how to create sample data to use from the automatic documentation that FastAPI offers for each of the API methods.
  5. Chapter 5: In this chapter we will see how to implement the upload of files, knowing the different existing variants in FastAPI.
  6. Chapter 6: In this chapter we will see how to connect a FastAPI application to a relational database such as MySQL.
  7. Chapter 7: In this chapter we will see installing and using a template engine in Python, specifically Jinja, with which we can return responses in HTML format.
  8. Chapter 8: In this chapter we will see installing and using a template engine in Python, specifically Jinja, with which we can return responses in HTML format.
  9. Chapter 9: In this chapter we will learn how to use dependencies.
  10. Chapter 10: In this chapter we will see how to use middleware to intercept requests to API methods and execute some procedure before the request or after generating the response.
  11. Chapter 11: In this chapter we will see how to create a user module, to register users, login, generate access tokens and logout.
  12. Chapter 12: In this chapter we will learn about some particularities and functionalities of FastAPI such as the use of annotations and the Ellipsis operator.
  13. Chapter 13: In this chapter we will see how to implement unit tests.
  14. Chapter 14: In this chapter we will know some general aspects applied to FastAPI.

This book is a translation into English of Primeros pasos con FastApi which was originally written in Spanish.

About the Author


Andrés Cruz Yoris, Licenciado en Computación, con más de 10 años de experiencia en el desarrollo de aplicaciones web en general; trabajo con PHP, Python y tecnologías del lado del cliente como HTML, JavaScript, CSS, Vue entre otras; y del lado del servidor como Laravel, Flask, Django y Codeigniter. También desarrollo con Android Studio, xCode y Flutter para la creación de aplicaciones nativas para Android e IOS.

Pongo a tú disposición parte de mi aprendizaje, reflejado en cada una de las palabras que componen mis libros sobre el desarrollo de aplicaciones en general.

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub