Tagged articles

fastapi

161 articles · Page 2 of 2
DeWu Technology
DeWu Technology
May 26, 2025 · Backend Development

Integrating FastAPI with MCP for AI‑Driven Test Data Generation

This article explains how to transform a FastAPI service into an MCP‑compatible tool, enabling AI agents to automatically orchestrate multi‑step test data creation, covering installation, project structure, code annotations, tool configuration, and practical integration with the Cursor platform.

AIAutomationMCP
0 likes · 19 min read
Integrating FastAPI with MCP for AI‑Driven Test Data Generation
Code Mala Tang
Code Mala Tang
May 21, 2025 · Backend Development

Master FastAPI Responses: JSON, HTML, Files, Streaming & Custom Classes

Learn how FastAPI handles various response types—including default JSON, custom status codes and headers, HTMLResponse, FileResponse, StreamingResponse, and user‑defined response classes—while covering best practices, common pitfalls, and code examples for building robust APIs.

API responsesFile HandlingPython
0 likes · 8 min read
Master FastAPI Responses: JSON, HTML, Files, Streaming & Custom Classes
Code Mala Tang
Code Mala Tang
May 20, 2025 · Backend Development

Master FastAPI’s Application Lifecycle: From Startup to Shutdown

This guide explains FastAPI’s full application lifecycle—including startup initialization, middleware handling, request processing steps, background tasks, and graceful shutdown—so developers can design, debug, and deploy robust asynchronous APIs efficiently.

APIApplication LifecyclePython
0 likes · 7 min read
Master FastAPI’s Application Lifecycle: From Startup to Shutdown
Code Mala Tang
Code Mala Tang
May 19, 2025 · Backend Development

How to Implement Server‑Sent Events (SSE) in FastAPI for Real‑Time Apps

Server‑Sent Events (SSE) provide a simple, one‑way server push mechanism over HTTP, ideal for real‑time updates such as dashboards, notifications, and data streams; this guide explains SSE fundamentals, compares alternatives, and walks through integrating SSE into FastAPI using the sse‑starlette library with full code examples.

PythonReal-time UpdatesSSE
0 likes · 9 min read
How to Implement Server‑Sent Events (SSE) in FastAPI for Real‑Time Apps
Fun with Large Models
Fun with Large Models
May 19, 2025 · Backend Development

Build a Streamable HTTP MCP Server from Scratch: Theory, Protocol Deep‑Dive and Full Python Implementation

This article explains the limitations of the original Stdio and HTTP SSE communication modes for MCP, introduces the Streamable HTTP protocol that resolves those issues, and provides a step‑by‑step Python implementation of both a Streamable HTTP MCP server and a matching client, complete with environment setup, FastAPI code, JSON‑RPC handling, and tool‑calling examples.

JSON-RPCMCP protocolPython
0 likes · 28 min read
Build a Streamable HTTP MCP Server from Scratch: Theory, Protocol Deep‑Dive and Full Python Implementation
Code Mala Tang
Code Mala Tang
May 16, 2025 · Backend Development

How to Run Non-Blocking Background Tasks in FastAPI with BackgroundTasks

FastAPI’s BackgroundTasks feature lets you register functions that run after a response is sent, enabling non‑blocking operations such as sending emails, logging, or cleaning resources, with simple code examples, parameter details, and insights into its Starlette‑based implementation and limitations.

AsynchronousBackgroundTasksPython
0 likes · 6 min read
How to Run Non-Blocking Background Tasks in FastAPI with BackgroundTasks
MaGe Linux Operations
MaGe Linux Operations
May 16, 2025 · Artificial Intelligence

Deploying Massive AI Models with Docker: A Complete From‑Zero‑to‑Production Guide

Learn how to efficiently package, build, and run large AI models in Docker containers—from preparing the model and API code, creating Dockerfiles, building and testing images, to scaling in production with Kubernetes and GPU support—complete with step‑by‑step commands and best‑practice tips.

AI Model DeploymentDockerKubernetes
0 likes · 10 min read
Deploying Massive AI Models with Docker: A Complete From‑Zero‑to‑Production Guide
Code Mala Tang
Code Mala Tang
May 13, 2025 · Backend Development

Master FastAPI Testing: Unit & Integration Tests with Pytest & HTTPX

This guide walks you through setting up a FastAPI testing environment, creating a project structure, writing both unit and integration tests using pytest, httpx, and FastAPI's TestClient, and running the tests to ensure reliable, maintainable applications.

backendfastapihttpx
0 likes · 6 min read
Master FastAPI Testing: Unit & Integration Tests with Pytest & HTTPX
Code Mala Tang
Code Mala Tang
May 12, 2025 · Backend Development

How to Build a FastAPI Service with RabbitMQ Consumer & Publisher

This guide walks through creating a FastAPI application that both publishes and consumes messages via RabbitMQ, detailing the setup of a Pika client, asynchronous consumer, message handling, API routes, and deployment with uvicorn, complete with code snippets and testing instructions.

PikaPythonasync
0 likes · 7 min read
How to Build a FastAPI Service with RabbitMQ Consumer & Publisher
Data STUDIO
Data STUDIO
May 12, 2025 · Fundamentals

Why Pydantic Is a Must‑Know Python Library for Data Validation

This article introduces Pydantic (v2), explains its core validation, parsing, and serialization features, compares it with plain dataclasses, demonstrates basic to advanced usage—including optional fields, default factories, nested models, custom validators, and alias handling—while warning about version differences and AI‑generated code pitfalls.

Custom ValidationModelPydantic
0 likes · 16 min read
Why Pydantic Is a Must‑Know Python Library for Data Validation
Code Mala Tang
Code Mala Tang
May 10, 2025 · Backend Development

Master FastAPI Request Body Validation with Pydantic Models

This guide explains how FastAPI uses Pydantic models to define, validate, and parse JSON and form request bodies, set default values and custom rules, handle nested structures, and return response models, providing a type‑safe, efficient way to build backend APIs.

PydanticPythonbackend development
0 likes · 8 min read
Master FastAPI Request Body Validation with Pydantic Models
Code Mala Tang
Code Mala Tang
May 9, 2025 · Backend Development

How to Render HTML with FastAPI and Jinja2: A Step‑by‑Step Guide

This tutorial walks you through installing FastAPI, setting up a project structure, creating routes that serve Jinja2‑rendered HTML pages, adding static files, building forms, and mastering essential Jinja2 syntax such as variables, conditionals, loops, template inheritance, filters, macros, and security considerations.

HTML renderingJinja2Python
0 likes · 7 min read
How to Render HTML with FastAPI and Jinja2: A Step‑by‑Step Guide
Code Mala Tang
Code Mala Tang
May 8, 2025 · Backend Development

Mastering Exception Handling in FastAPI: Strategies, Patterns, and Code

Learn how to design robust exception handling for FastAPI applications by combining Look‑Before‑You‑Leap and EAFP strategies, creating custom exception classes, organizing handlers, and integrating them into your API to improve maintainability, clarity, and error response consistency.

Exception HandlingPythonbackend development
0 likes · 19 min read
Mastering Exception Handling in FastAPI: Strategies, Patterns, and Code
Code Mala Tang
Code Mala Tang
May 4, 2025 · Backend Development

Mastering Environment Variables in FastAPI: Secure, Scalable Configurations

This guide explains why environment variables are essential for FastAPI projects and provides step‑by‑step instructions for both a simple .env + python‑dotenv setup and a modern pydantic‑settings approach, including Docker integration and security best practices.

Dockerbackend configurationfastapi
0 likes · 6 min read
Mastering Environment Variables in FastAPI: Secure, Scalable Configurations
Code Mala Tang
Code Mala Tang
May 1, 2025 · Backend Development

Master Advanced FastAPI Routing: Modular APIs, Versioning, and RBAC

This tutorial explains how to build scalable, maintainable FastAPI APIs by modularizing routers, implementing path‑based version control, centralizing dependency injection, applying role‑based access control, using custom middleware, and nesting routers for complex applications.

API designRBACVersioning
0 likes · 10 min read
Master Advanced FastAPI Routing: Modular APIs, Versioning, and RBAC
Code Mala Tang
Code Mala Tang
Apr 24, 2025 · Backend Development

Mastering Dependency Injection in FastAPI: From Basics to Advanced Use

This article explains how FastAPI leverages Dependency Injection to improve code reusability, modularity, and testability, covering basic examples, sub‑dependency handling, database session management with SQLAlchemy, and building a full‑featured user management API with authentication.

PythonWeb APIbackend development
0 likes · 9 min read
Mastering Dependency Injection in FastAPI: From Basics to Advanced Use
Code Mala Tang
Code Mala Tang
Apr 3, 2025 · Backend Development

Build an Anthropic MCP Server with FastAPI in Minutes

This guide explains why the Anthropic MCP protocol is essential for AI‑agent integration and walks you through building a FastAPI server, adding the fastapi‑mcp extension, and configuring the MCP endpoint so your application can communicate seamlessly with AI agents.

AI agentsMCPPython
0 likes · 5 min read
Build an Anthropic MCP Server with FastAPI in Minutes
Code Mala Tang
Code Mala Tang
Mar 26, 2025 · Backend Development

Boost FastAPI Performance: 9 Proven Techniques with Code Samples

Learn how to dramatically improve FastAPI application speed by implementing asynchronous endpoints, database connection pooling, Redis caching, query optimization, Gzip compression, background tasks, performance monitoring, CDN static file serving, and faster JSON serialization with ujson, each illustrated with practical code examples.

Databaseasyncbackground tasks
0 likes · 7 min read
Boost FastAPI Performance: 9 Proven Techniques with Code Samples
Code Mala Tang
Code Mala Tang
Mar 22, 2025 · Backend Development

Pydantic & FastAPI: Optional Fields, Nested Models, and Advanced Validation

Learn how to leverage Pydantic in FastAPI to handle optional fields, validate nested data structures, enforce complex business rules with model validators, forbid extra fields, work with polymorphic models, and validate query and path parameters, all illustrated with clear Python code examples.

API designPydanticPython
0 likes · 10 min read
Pydantic & FastAPI: Optional Fields, Nested Models, and Advanced Validation
Code Mala Tang
Code Mala Tang
Mar 21, 2025 · Backend Development

How to Implement Rate Limiting in FastAPI with SlowAPI

This tutorial explains how to add request rate limiting to a FastAPI application using the SlowAPI library, covering both IP‑based limits and custom token‑based strategies, with installation steps, code examples, and best‑practice recommendations.

PythonSlowAPIbackend
0 likes · 5 min read
How to Implement Rate Limiting in FastAPI with SlowAPI
Code Mala Tang
Code Mala Tang
Mar 20, 2025 · Backend Development

How to Design Scalable FastAPI Project Structures: File‑Based vs Module‑Based

This article compares two primary FastAPI project structure strategies—file‑type based and module‑function based—explaining why a well‑organized architecture improves scalability, maintainability, and team collaboration, and provides concrete directory layouts and best‑practice guidelines for building robust backend applications.

Project StructurePythonbackend development
0 likes · 9 min read
How to Design Scalable FastAPI Project Structures: File‑Based vs Module‑Based
21CTO
21CTO
Feb 16, 2025 · Artificial Intelligence

How to Deploy Your Own DeepSeek LLM Locally: Step-by-Step Guide

This guide walks you through setting up a local DeepSeek large language model, covering environment preparation, model acquisition, dependency installation, FastAPI service creation, Docker containerization, optional front‑end interface, performance tuning, and common troubleshooting steps.

AI modelDeepSeekDocker
0 likes · 7 min read
How to Deploy Your Own DeepSeek LLM Locally: Step-by-Step Guide
System Architect Go
System Architect Go
Nov 24, 2024 · Artificial Intelligence

Building a Web Voice Chatbot with Whisper, llama.cpp, and LLM

This article demonstrates how to build a web‑based voice chatbot by integrating Whisper speech‑to‑text, llama.cpp LLM inference, and WebSocket communication, detailing both the frontend JavaScript implementation and the Python FastAPI backend, along with Docker deployment and example code.

JavaScriptLLMPython
0 likes · 10 min read
Building a Web Voice Chatbot with Whisper, llama.cpp, and LLM
JavaEdge
JavaEdge
Oct 15, 2024 · Artificial Intelligence

Build a Real‑Time Search & Bazi AI Agent with LangChain & FastAPI

This tutorial walks through creating a LangChain tool‑calling agent that combines a real‑time web search tool, a Qdrant vector store for local knowledge retrieval, and a custom Bazi fortune‑telling service, all wrapped in a FastAPI application for interactive use.

AI AgentLangChainQdrant
0 likes · 15 min read
Build a Real‑Time Search & Bazi AI Agent with LangChain & FastAPI
JavaEdge
JavaEdge
Oct 14, 2024 · Artificial Intelligence

Deploying LLMs with LangServe: A Complete Guide from Setup to Client Calls

This article introduces LangServe, explains its key features for LLM deployment, walks through environment setup, shows how to build a FastAPI‑based REST API with code examples, demonstrates testing via Postman and remote client calls, and summarizes its benefits for AI model serving.

AI model servingLLM deploymentLangServe
0 likes · 9 min read
Deploying LLMs with LangServe: A Complete Guide from Setup to Client Calls
Python Programming Learning Circle
Python Programming Learning Circle
Aug 23, 2024 · Artificial Intelligence

Getting Started with Python Generative AI: Six Practical Projects Using Llama 2, LangChain, Streamlit, Gradio, FastAPI and SQL

This article presents six hands‑on Python generative‑AI projects—ranging from a Llama 2 chatbot built with Streamlit and Replicate to natural‑language‑to‑SQL conversion using LlamaIndex and SQLAlchemy—complete with environment setup, required code snippets, deployment tips and resource links for further exploration.

GradioLangChainPython
0 likes · 20 min read
Getting Started with Python Generative AI: Six Practical Projects Using Llama 2, LangChain, Streamlit, Gradio, FastAPI and SQL
21CTO
21CTO
Jul 2, 2024 · Backend Development

FastAPI vs Flask: Why FastAPI Outperforms Flask for Modern APIs

This article compares FastAPI and Flask, highlighting FastAPI's speed, developer experience, and standards support, while providing practical migration guidance, code examples, configuration tips, async handling, dependency injection, testing, deployment, and documentation differences for Python web developers.

ASGIFlaskPydantic
0 likes · 25 min read
FastAPI vs Flask: Why FastAPI Outperforms Flask for Modern APIs
JavaEdge
JavaEdge
Jun 28, 2024 · Artificial Intelligence

Designing Agent Personality and Emotion Handling with LangChain Prompt Templates

This article explains how to craft system prompts that give an AI agent a distinct personality and emotional behavior, shows how to implement an emotion‑detection chain, compares ChatPromptTemplate.from_messages with from_template, and integrates the agent into a FastAPI service with full code examples.

AI AgentEmotion DetectionLangChain
0 likes · 13 min read
Designing Agent Personality and Emotion Handling with LangChain Prompt Templates
JavaEdge
JavaEdge
Jun 27, 2024 · Backend Development

Build a FastAPI Chatbot with LangChain and WebSocket – Step‑by‑Step Guide

This tutorial walks through installing FastAPI and related packages, creating a basic FastAPI app, adding chat, PDF, and text endpoints, integrating LangChain tools for AI responses, implementing a WebSocket echo service, and running the server with uvicorn, all illustrated with code snippets and screenshots.

APILangChainPython
0 likes · 8 min read
Build a FastAPI Chatbot with LangChain and WebSocket – Step‑by‑Step Guide
Python Programming Learning Circle
Python Programming Learning Circle
Apr 26, 2024 · Artificial Intelligence

Five Essential Python Libraries for Machine Learning Engineers

This article introduces five essential Python libraries—MLflow, Streamlit, FastAPI, XGBoost, and ELI5—that every junior or intermediate machine‑learning engineer and data scientist should master to streamline experiment tracking, build interactive web apps, deploy models efficiently, achieve fast accurate predictions, and improve model interpretability.

ELI5MLflowPython
0 likes · 8 min read
Five Essential Python Libraries for Machine Learning Engineers
Liangxu Linux
Liangxu Linux
Mar 25, 2024 · Information Security

How to Use Gzip Compression to Overload Web Crawlers (Gzip Bomb Tutorial)

This guide shows how to create a tiny gzip‑compressed file, serve it with FastAPI, and exploit automatic decompression in Python's requests library to force a crawler to consume massive memory, effectively turning compression into a denial‑of‑service weapon.

Denial of Servicecompressionfastapi
0 likes · 7 min read
How to Use Gzip Compression to Overload Web Crawlers (Gzip Bomb Tutorial)
DaTaobao Tech
DaTaobao Tech
Dec 27, 2023 · Artificial Intelligence

Deploying a Private LLM Knowledge Base on a MacBook

The guide walks through installing and quantizing the open‑source ChatGLM3‑6B model and the m3e‑base embedder on a MacBook, wrapping them with a FastAPI OpenAI‑compatible service, routing requests through a One‑API gateway, storing metadata in MongoDB and vectors in PostgreSQL pgvector, deploying FastGPT for RAG, ingesting data, and demonstrating 5‑7 second response times, while outlining future improvements.

ChatGLM3Knowledge BaseLLM
0 likes · 23 min read
Deploying a Private LLM Knowledge Base on a MacBook
phodal
phodal
Aug 20, 2023 · Artificial Intelligence

How to Extend AutoDev with Custom LLMs and Prompt Actions

The article explains how to enhance the open‑source AutoDev coding assistant by configuring your own large language model, customizing IDE behavior, defining custom prompts and actions, and adjusting request/response handling via FastAPI, offering step‑by‑step JSON examples and guidance for advanced developers.

AutoDevIDE integrationLLM customization
0 likes · 7 min read
How to Extend AutoDev with Custom LLMs and Prompt Actions
Python Programming Learning Circle
Python Programming Learning Circle
Aug 16, 2023 · Backend Development

Comprehensive List and Comparison of Python Web Frameworks

This article presents a curated collection of Python web frameworks, explains what a web framework is, outlines their purposes, and provides a ranked overview of each framework's official site, advantages, and disadvantages to help developers choose the most suitable option for their projects.

ComparisonDjangoFlask
0 likes · 23 min read
Comprehensive List and Comparison of Python Web Frameworks
MaGe Linux Operations
MaGe Linux Operations
Jul 17, 2023 · Backend Development

What Frameworks Shaped FastAPI? Lessons from Django, Flask, and More

This article explores the various Python frameworks and tools—Django, Django REST Framework, Flask, Requests, Swagger/OpenAPI, Marshmallow, Pydantic, Starlette, and Uvicorn—that inspired FastAPI, highlighting the features each contributed such as automatic documentation, micro‑framework flexibility, type‑hinted validation, and high‑performance async support.

APIOpenAPIWeb Frameworks
0 likes · 10 min read
What Frameworks Shaped FastAPI? Lessons from Django, Flask, and More
Python Programming Learning Circle
Python Programming Learning Circle
Jul 27, 2022 · Backend Development

Comprehensive Overview of Python Web Frameworks

This article presents a detailed survey of over thirty Python web frameworks, describing their official sites, main features, advantages, and drawbacks, and offers guidance on selecting popular options such as Django, Flask, FastAPI, and many others for various development needs.

DjangoFlaskPython
0 likes · 20 min read
Comprehensive Overview of Python Web Frameworks
MaGe Linux Operations
MaGe Linux Operations
May 15, 2022 · Backend Development

Top 37 Python Web Frameworks: Features, Pros & Cons Explained

After two weeks of research, this guide presents a ranked list of 37 Python web frameworks—detailing their official sites, strengths, weaknesses, and visual overviews—to help developers choose the most supported and suitable framework for their projects.

DjangoFlaskPython
0 likes · 27 min read
Top 37 Python Web Frameworks: Features, Pros & Cons Explained
Programmer DD
Programmer DD
Jan 20, 2022 · Backend Development

Why FastAPI Is the Fastest Way to Build High‑Performance Python APIs

FastAPI is a high‑performance, easy‑to‑learn Python web framework that lets you build robust APIs quickly, offering features like speed, concise code, automatic validation, and OpenAPI compatibility, with simple installation via pip and interactive documentation out of the box.

ASGIInstallationPython
0 likes · 4 min read
Why FastAPI Is the Fastest Way to Build High‑Performance Python APIs
dbaplus Community
dbaplus Community
Jan 8, 2022 · Artificial Intelligence

How Ctrip Streamlined ML Model Development and Deployment with MLOps

This article explains how Ctrip tackled the long, costly ML model development‑to‑deployment pipeline by adopting and extending MLflow for full lifecycle management, covering model persistence, tracking, serving, custom pyfunc models, Dockerized deployment, scaling, and performance monitoring.

DockerMLOpsMLflow
0 likes · 14 min read
How Ctrip Streamlined ML Model Development and Deployment with MLOps
21CTO
21CTO
Feb 5, 2021 · Frontend Development

Boost Front‑End Prototyping with FakeAPI: Instant Mock Data Generation

This article introduces FakeAPI, a FastAPI‑based mock data service that lets front‑end developers quickly generate realistic JSON payloads, explains its endpoints, payload formats, repeat feature, and shows how to deploy it locally using Docker.

API mockDockerFake Data
0 likes · 4 min read
Boost Front‑End Prototyping with FakeAPI: Instant Mock Data Generation
Python Crawling & Data Mining
Python Crawling & Data Mining
Dec 25, 2020 · Backend Development

Mastering Python Rate Limiting: From ratelimiter to SlowAPI

This article explains how to control request frequency in Python using the ratelimiter library for synchronous and asynchronous code, and introduces SlowAPI as a flexible solution for FastAPI and Flask, helping backend developers reduce server load and protect APIs from abuse.

Pythonasynciobackend development
0 likes · 6 min read
Mastering Python Rate Limiting: From ratelimiter to SlowAPI
Python Crawling & Data Mining
Python Crawling & Data Mining
Mar 26, 2020 · Backend Development

Master FastAPI: Build High‑Performance Python APIs Quickly

This article introduces FastAPI, a modern high‑performance Python web framework, walks through installation, basic routing, async handling, query and path parameters, data modeling with Pydantic, template rendering with Jinja2, and compares its speed to Flask, providing complete code examples and screenshots.

APIPydanticPython
0 likes · 10 min read
Master FastAPI: Build High‑Performance Python APIs Quickly