Posts

Showing posts from August, 2025

Core Packages for Fast API

Core Packages for Fast API Core Packages for Fast API Exploring more powerful and common packages and their use cases beyond the core built-in features. 1. Configuration ⚙️ Use Case: Managing application settings, secrets, and environment variables. Using Pydantic's Settings (from pydantic-settings ) and python-dotenv is the standard for creating a robust and type-safe configuration. It allows you to define settings in a class and automatically load values from environment variables, a .env file, or other sources. Python # .env file # This file is not checked into version control DATABASE_URL="postgresql://user:password@host:port/dbname" SECRET_KEY="your-secret-key-for-jwt" # config.py (a new file) from pydantic_settings import BaseSettings class Settings(BaseSettings): database...

Fast API Built In Features

Fast API Built In Features Fast API Built In Features A look at the key components that make FastAPI so powerful. Core Framework (Starlette) This forms the fundamental structure of your application. Applications, Routing, Endpoints, Middleware, Responses, WebSockets, Exceptions: All of these are core functionalities inherited from Starlette. Use Cases: Routing: Define how your application responds to different URL paths (`@app.get("/items/{item_id}")`). Middleware: Perform actions on every request and response, such as adding custom headers, handling CORS, or logging request details. WebSockets: Build real-time applications like a live chat or a stock ticker that pushes data to the client as it becomes a...