Explaining APIs 🚀 #
Before getting started with FastAPI, a refresher on the understanding of APIs is important.
An API (Application Programming Interface) is a set of protocols, routines, and tools used to build software applications. APIs enable communication between different software systems, allowing developers to easily integrate features and data from one application into another.
Think of an API as a waiter at a restaurant.
- The waiter takes your order, sends it to the kitchen, and then delivers your food to your table.
- You don’t need to know how the kitchen works or how the food is prepared; you just need to know what you want to order.
- Similarly, with an API, you don’t need to know how the underlying system works.
- You just need to know what data you want to access or what actions you want to perform.
Why learn FastAPI ❓ #
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.
It provides a simple and intuitive way to build APIs, making it an excellent choice for both beginners and experienced developers.
It is easy to learn, fast to code, ready for production, and it offers automatic interactive documentation. 🤩
FastAPI is a good fit for building modern, scalable web applications due to its high performance and asynchronous capabilities.
🎓 Take Away Skills #
After completing this learning path you will be knowledgeable in:
Understanding of what an API is and how it works
Ability to build a basic API with FastAPI
Conceptual Knowledge: #
- Path and Query Parameters
- Pydantic Base Model
- Handling Forms
- Async Databases
- Swagger UI for API documentation
- Test a FastAPI
- Deploy a FastAPI application
🛠️ Prerequisites #
To get started with FastAPI, you should have some basic programming knowledge and be familiar with Python 3.7+ 🐍. Additionally, it’s recommended to have an understanding of HTTP and RESTful API principles.
📲 Installation and Setup #
To install FastAPI, you can use pip, Python’s package manager. Run the following command in your terminal:
pip install fastapi
Unlike the Flask framework, FastAPI doesn’t contain any built-in development server. Hence, you will have the need to install Uvicorn, a lightning-fast ASGI server, to run the FastAPI application.
pip install uvicorn[standard]
💡 Learning Session #
Basic call on FastAPI #
- Understanding API architecture and how it works - Creating a simple API and using interactive API docs - Path and Query Parameters - Forms and Files - Jinja2 Templates and Async Databases - Testing with FastAPI
Video Tutorials #
Note: Both the series provide a structured walkthrough of all the concepts listed.
- Create a simple API using FastAPI and use the interactive API docs to test it.
🔖 Resource Pool #
- Coding Nomads - FastAPI Tutorial
- RealPython - FastAPI Tutorial
- Awesome FastAPI