Protecting Endpoints with Slowapi Step by Step in FastAPI

Protecting Endpoints with Slowapi Step by Step in FastAPI

Tiempo de lectura: < 1 minutoWe can implement Rate Limit for our calls using slowapi, which is the equivalent of Flask-Limiter but for FastAPI: bash pip install slowapi python # main.py from slowapi import Limiter, _rate_limit_exceeded_handler from slowapi.util import get_remote_address from slowapi.errors import RateLimitExceeded limiter = Limiter(key_func=get_remote_address) app.state.limiter = limiter app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler) python # app/routers/users.py from slowapi import Limiter from … Read more

Adding Redis to FastAPI with Docker and Optimizing with Cache

Adding Redis to FastAPI with Docker and Optimizing with Cache

Tiempo de lectura: 2 minutosStack: FastAPI · Docker Compose · fastapi-cache2 · Redis 7 No caching, each request goes to the database even if the data has not changed. With Redis, the first call checks the DB and stores the result. The subsequent requests return Redis directly, without touching the DB. Scenario No Redis With Redis GET /books (First … Read more

Optimizing FastAPI for Quick and Effective Performance

Tiempo de lectura: 2 minutosThese 4 optimizations improve performance, concurrency and response speed of a FastAPI API in production with Docker. Gunicorn acts as a process manager above Uvicorn. Launches multiple workers (independent processes) to allow the API to handle several requests in parallel, not sequentially. Main Impact: Improved concurrency under load. With 4 workers, you can handle 4 … Read more

Understanding CRUD in Programming (2026): The Real Deal and its Practical Applications

Understanding CRUD in Programming (2026): The Real Deal and its Practical Applications

Tiempo de lectura: 2 minutosIf you understand what is a CRUD, you can build 80% of existing applications today. In this tutorial, I will explain CRUD from scratch, with practical mindset, real-world examples and modern approach. CRUD means: Possible it may sound simple… but here is the reality: Instagram, Amazon, Spotify, Netflix, WhatsApp → Everything is CRUD. Posts, users, … Read more

How to create real-time applications with Python and FastAPI in 2026: A Complete Step-by-Step Guide

How to create real-time applications with Python and FastAPI in 2026: A Complete Step-by-Step Guide

Tiempo de lectura: 2 minutosBy 2026, FastAPI has become the fastest-growing framework within the Python ecosystem. Its combination of performance, modern typing, and ease of use make it the preferred tool for creating APIs, microservices, and real-time applications with WebSockets. This guide teaches you what is FastAPI, how to use it with WebSockets and how to build your first … Read more

What are workers in FastAPI and how to increase them?

What are workers in FastAPI and how to increase them?

Tiempo de lectura: 2 minutosA worker (worker) is a server process that handles incoming HTTP requests to your FastAPI application. Think of it as a person at a customer service counter: the more workers you have, the more customers you can serve at the same time. Imagine you have an API that processes requests like: @app.get(“/procesar”) def procesar(): time.sleep(2) … Read more

Creating a WebSocket with FastAPI

Creating a WebSocket with FastAPI

Tiempo de lectura: < 1 minutoToday we are going to learn how we can quickly and easily generate a websocket with FastAPI. Step 1: Environment Setup, if you already have FastAPI installed, you can skip these steps. Make sure you have Python installed on your system. Then, install FastAPI and Uvicorn using pip: pip install fastapi uvicorn Step 2: Create … Read more

Creating a websocket with FastAPI

Creating a websocket with FastAPI

Tiempo de lectura: 2 minutosToday we are going to learn how we can quickly and easily generate a websocket with FastAPI. Step 1: Environment Setup, if you already have FastAPI installed, you can skip these steps. Make sure you have Python installed on your system. Then, install FastAPI and Uvicorn using pip: pip install fastapi uvicorn Step 2: Create … Read more

Encrypt a file and get it decrypted using FAST-API

Encrypt a file and get it decrypted using FAST-API

Tiempo de lectura: 2 minutosToday we are going to learn how to store an encrypted file and how to decrypt it to return it in a response. We will use the Fernet library. pip install cryptography First, let’s create an encryption key with Fernet. def generate_key(): key = Fernet.generate_key() return key.decode(‘utf-8’) With this function, we can obtain a random … Read more

How to Handle Errors and Send Emails in Case of Exceptions in FastAPI

How to Handle Errors and Send Emails in Case of Exceptions in FastAPI

Tiempo de lectura: 2 minutosIn FastAPI development with Python, proper error handling is crucial to ensure smooth operation. In this tutorial, we will learn to implement an exception handling system that will automatically send an email to the administrator when an error occurs in our API. Step 1: Setting up the handler.py File Firstly, we will create a file … Read more