<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>FastAPI on AI VOID</title><link>https://ai-blog.noorshomelab.dev/tags/fastapi/</link><description>Recent content in FastAPI on AI VOID</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 26 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://ai-blog.noorshomelab.dev/tags/fastapi/index.xml" rel="self" type="application/rss+xml"/><item><title>Launch Your First FastAPI App: Hello World &amp;amp; Beyond</title><link>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/launch-your-first-fastapi-app-hello-world--beyond/</link><pubDate>Sat, 25 Oct 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/launch-your-first-fastapi-app-hello-world--beyond/</guid><description>&lt;h1 id="launch-your-first-fastapi-app-hello-world--beyond"&gt;Launch Your First FastAPI App: Hello World &amp;amp; Beyond&lt;/h1&gt;
&lt;h3 id="what-youll-learn"&gt;What You&amp;rsquo;ll Learn&lt;/h3&gt;
&lt;p&gt;In this foundational chapter, you&amp;rsquo;ll take your very first steps into the world of FastAPI. By the end, you will be able to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up a clean Python development environment using virtual environments.&lt;/li&gt;
&lt;li&gt;Install FastAPI and Uvicorn, the server that runs your FastAPI applications.&lt;/li&gt;
&lt;li&gt;Create your first &amp;ldquo;Hello World&amp;rdquo; FastAPI application.&lt;/li&gt;
&lt;li&gt;Run your FastAPI application locally and access it from your web browser.&lt;/li&gt;
&lt;li&gt;Understand the basics of FastAPI path operations and how to define simple GET request endpoints.&lt;/li&gt;
&lt;li&gt;Return various basic responses, including strings and JSON objects.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="core-concepts"&gt;Core Concepts&lt;/h3&gt;
&lt;p&gt;Welcome to building web applications with FastAPI! We&amp;rsquo;re going to start from scratch, ensuring you have a solid foundation.&lt;/p&gt;</description></item><item><title>Dynamic Routes &amp;amp; Data: Master Path and Query Parameters</title><link>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/dynamic-routes--data-master-path-and-query-parameters/</link><pubDate>Sat, 25 Oct 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/dynamic-routes--data-master-path-and-query-parameters/</guid><description>&lt;h2 id="chapter-title-dynamic-routes--data-master-path-and-query-parameters-covering-extracting-data-with-path-parameters-dynamic-urls-type-hinting-and-automatic-validation-for-path-parameters-query-parameters-filtering-and-optional-data"&gt;Chapter Title: Dynamic Routes &amp;amp; Data: Master Path and Query Parameters (covering: Extracting Data with Path Parameters: Dynamic URLs, Type Hinting and Automatic Validation for Path Parameters, Query Parameters: Filtering and Optional Data)&lt;/h2&gt;
&lt;h3 id="what-youll-learn"&gt;What You&amp;rsquo;ll Learn&lt;/h3&gt;
&lt;p&gt;In this chapter, you&amp;rsquo;ll gain the skills to build more flexible and powerful APIs by learning how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create dynamic URLs that can accept variable data, known as &lt;strong&gt;path parameters&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Extract and use data from these path parameters within your FastAPI application.&lt;/li&gt;
&lt;li&gt;Leverage Python&amp;rsquo;s &lt;strong&gt;type hinting&lt;/strong&gt; for automatic data validation and conversion of path parameters, making your API more robust.&lt;/li&gt;
&lt;li&gt;Define and utilize &lt;strong&gt;query parameters&lt;/strong&gt; to enable filtering, pagination, and provide optional data to your API endpoints.&lt;/li&gt;
&lt;li&gt;Understand how to make query parameters optional and assign default values, enhancing API usability.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="core-concepts"&gt;Core Concepts&lt;/h3&gt;
&lt;p&gt;FastAPI allows you to define routes that are not fixed but can adapt based on parts of the URL. This dynamic behavior is crucial for building real-world APIs, enabling you to retrieve specific resources or filter collections of data.&lt;/p&gt;</description></item><item><title>Handle Data Input: Pydantic Models &amp;amp; Request Bodies</title><link>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/handle-data-input-pydantic-models--request-bodies/</link><pubDate>Sat, 25 Oct 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/handle-data-input-pydantic-models--request-bodies/</guid><description>&lt;h2 id="chapter-title-handle-data-input-pydantic-models--request-bodies"&gt;Chapter Title: Handle Data Input: Pydantic Models &amp;amp; Request Bodies&lt;/h2&gt;
&lt;h3 id="what-youll-learn"&gt;What You&amp;rsquo;ll Learn&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;How to receive data sent by clients using HTTP POST requests.&lt;/li&gt;
&lt;li&gt;Understanding the concept of a &amp;ldquo;request body&amp;rdquo; in API communication.&lt;/li&gt;
&lt;li&gt;How to define structured data schemas for incoming data using Pydantic&amp;rsquo;s &lt;code&gt;BaseModel&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Leveraging FastAPI&amp;rsquo;s integration with Pydantic for automatic data validation.&lt;/li&gt;
&lt;li&gt;How Pydantic automatically serializes incoming JSON data into Python objects for easy use.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="core-concepts"&gt;Core Concepts&lt;/h3&gt;
&lt;h4 id="receiving-data-with-post-requests-and-request-bodies"&gt;Receiving Data with POST Requests and Request Bodies&lt;/h4&gt;
&lt;p&gt;When clients (like a web browser, mobile app, or another server) want to send data to your API to create a new resource (e.g., a new user, a new product) or submit information, they typically use an HTTP POST request. Unlike GET requests, where data is appended to the URL as query parameters, POST requests send data in the &lt;strong&gt;request body&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Build Robust APIs: Dependencies, Errors &amp;amp; Background Tasks</title><link>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/build-robust-apis-dependencies-errors--background-tasks/</link><pubDate>Sat, 25 Oct 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/build-robust-apis-dependencies-errors--background-tasks/</guid><description>&lt;h1 id="build-robust-apis-dependencies-errors--background-tasks"&gt;Build Robust APIs: Dependencies, Errors &amp;amp; Background Tasks&lt;/h1&gt;
&lt;h3 id="what-youll-learn"&gt;What You&amp;rsquo;ll Learn&lt;/h3&gt;
&lt;p&gt;In this chapter, you&amp;rsquo;ll gain essential skills to build more robust and maintainable FastAPI applications. You will learn:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How to leverage FastAPI&amp;rsquo;s &lt;strong&gt;Dependency Injection&lt;/strong&gt; system to write reusable logic and manage shared resources.&lt;/li&gt;
&lt;li&gt;Practical applications of dependencies, such as handling &lt;strong&gt;database sessions&lt;/strong&gt; and conceptually implementing &lt;strong&gt;authentication&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;How to effectively use &lt;strong&gt;Custom HTTP Exceptions&lt;/strong&gt; to provide clear and graceful error messages in your API.&lt;/li&gt;
&lt;li&gt;How to implement &lt;strong&gt;Background Tasks&lt;/strong&gt; for performing non-blocking operations after a response has been sent.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="core-concepts"&gt;Core Concepts&lt;/h3&gt;
&lt;h4 id="dependency-injection-reusable-logic-and-shared-resources"&gt;Dependency Injection: Reusable Logic and Shared Resources&lt;/h4&gt;
&lt;p&gt;Imagine you have several API endpoints that all need to perform the same initial check, like validating an API key, getting a database connection, or fetching a specific user from a database. Copying and pasting this code into every endpoint would be tedious and error-prone. This is where &lt;strong&gt;Dependency Injection (DI)&lt;/strong&gt; comes in.&lt;/p&gt;</description></item><item><title>Your First Full CRUD API: Items Manager Project</title><link>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/your-first-full-crud-api-items-manager-project/</link><pubDate>Sat, 25 Oct 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/your-first-full-crud-api-items-manager-project/</guid><description>&lt;h2 id="your-first-full-crud-api-items-manager-project-covering-project-setup-structuring-your-fastapi-application-implement-create-post-operations-for-items-implement-read-get-operations-all-and-by-id"&gt;Your First Full CRUD API: Items Manager Project (covering: Project Setup: Structuring Your FastAPI Application, Implement CREATE (POST) Operations for Items, Implement READ (GET) Operations: All and By ID)&lt;/h2&gt;
&lt;h3 id="what-youll-learn"&gt;What You&amp;rsquo;ll Learn&lt;/h3&gt;
&lt;p&gt;In this chapter, you&amp;rsquo;ll embark on building your very first complete set of API operations for managing &amp;ldquo;items.&amp;rdquo; By the end, you will be able to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Structure a basic FastAPI project&lt;/strong&gt;: Organize your code into logical files for better maintainability.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Define data models with Pydantic&lt;/strong&gt;: Learn how to use Pydantic &lt;code&gt;BaseModel&lt;/code&gt; to validate incoming request data and define outgoing response data.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Implement &lt;code&gt;CREATE&lt;/code&gt; (POST) operations&lt;/strong&gt;: Create an endpoint that allows clients to add new items to your application.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Implement &lt;code&gt;READ&lt;/code&gt; (GET) operations&lt;/strong&gt;: Build endpoints to retrieve all items and to fetch a specific item by its unique identifier.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Handle in-memory data storage&lt;/strong&gt;: Understand how to simulate a database using simple Python data structures for learning purposes.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="core-concepts"&gt;Core Concepts&lt;/h3&gt;
&lt;h4 id="project-setup-structuring-your-fastapi-application"&gt;Project Setup: Structuring Your FastAPI Application&lt;/h4&gt;
&lt;p&gt;As your FastAPI application grows, putting everything into a single &lt;code&gt;main.py&lt;/code&gt; file can become unwieldy. A good practice is to separate concerns. For our &lt;code&gt;Items Manager&lt;/code&gt; project, we&amp;rsquo;ll start with a simple structure:&lt;/p&gt;</description></item><item><title>Beyond The Basics: Testing, Deployment &amp;amp; Next Steps</title><link>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/beyond-the-basics-testing-deployment--next-steps/</link><pubDate>Sat, 25 Oct 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/fastapi_beginner_course_20251025_173235/beyond-the-basics-testing-deployment--next-steps/</guid><description>&lt;h2 id="beyond-the-basics-testing-deployment--next-steps"&gt;Beyond The Basics: Testing, Deployment &amp;amp; Next Steps&lt;/h2&gt;
&lt;h3 id="what-youll-learn"&gt;What You&amp;rsquo;ll Learn&lt;/h3&gt;
&lt;p&gt;In this chapter, you&amp;rsquo;ll move beyond simply building API endpoints and learn how to make your applications robust and ready for the real world. You will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Understand &lt;em&gt;why&lt;/em&gt; API testing is a crucial part of the development process.&lt;/li&gt;
&lt;li&gt;Learn to write basic unit and integration tests for your FastAPI applications using FastAPI&amp;rsquo;s built-in &lt;code&gt;TestClient&lt;/code&gt; and the &lt;code&gt;pytest&lt;/code&gt; framework.&lt;/li&gt;
&lt;li&gt;Grasp the fundamental concepts of containerization and how Docker helps package and deploy FastAPI applications consistently.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="core-concepts"&gt;Core Concepts&lt;/h3&gt;
&lt;p&gt;As your FastAPI applications grow, ensuring they work as expected becomes vital. This chapter introduces you to testing and a conceptual overview of deployment, two cornerstones of professional software development.&lt;/p&gt;</description></item><item><title>Chapter 7: Web Frameworks (Django, Flask, FastAPI)</title><link>https://ai-blog.noorshomelab.dev/python-interview-2026/web-frameworks-django-flask-fastapi/</link><pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/python-interview-2026/web-frameworks-django-flask-fastapi/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Python&amp;rsquo;s versatility extends powerfully into web development, largely thanks to its robust ecosystem of web frameworks. This chapter delves into the intricacies of the three most prominent Python web frameworks: Django, Flask, and FastAPI. Understanding these frameworks is crucial for any Python developer aiming for roles in backend development, API design, or full-stack engineering.&lt;/p&gt;
&lt;p&gt;This guide provides a comprehensive set of interview questions, ranging from fundamental concepts suitable for entry-level candidates to advanced architectural considerations for senior and expert-level professionals. We will explore theoretical knowledge, practical application scenarios, and system design implications related to building scalable and maintainable web applications with Python. As of January 2026, proficiency in these frameworks, alongside knowledge of Python 3.12/3.13 features, modern deployment practices, and API design principles, is highly valued by top tech companies.&lt;/p&gt;</description></item><item><title>Deploying and Monitoring Your Production ADK Agent on Google Cloud</title><link>https://ai-blog.noorshomelab.dev/adk-persistent-agents-2026/deploying-monitoring-adk/</link><pubDate>Sat, 23 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/adk-persistent-agents-2026/deploying-monitoring-adk/</guid><description>&lt;p&gt;This chapter marks a critical transition: moving your sophisticated, context-aware ADK agent from a local development environment to a production-grade cloud platform. We&amp;rsquo;ll focus on deploying the containerized agent built in the previous chapter to Google Cloud Run, a fully managed serverless platform. Beyond deployment, we&amp;rsquo;ll establish essential operational capabilities, including secure secret management, robust logging, and foundational monitoring.&lt;/p&gt;
&lt;p&gt;By the end of this chapter, you will have a live, accessible ADK agent running on Google Cloud, capable of persisting its state and conversational context, ready to serve users reliably. This milestone is about making your agent resilient, scalable, and observable in a real-world environment.&lt;/p&gt;</description></item><item><title>Chapter 8: WebSockets and Server-Sent Events (SSE) with HTMX</title><link>https://ai-blog.noorshomelab.dev/htmx-mastery-2025/websockets-server-sent-events/</link><pubDate>Thu, 04 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/htmx-mastery-2025/websockets-server-sent-events/</guid><description>&lt;h2 id="introduction-bringing-your-web-apps-to-life-with-real-time-updates"&gt;Introduction: Bringing Your Web Apps to Life with Real-time Updates&lt;/h2&gt;
&lt;p&gt;Welcome back, future HTMX wizard! In our journey so far, we&amp;rsquo;ve mastered how HTMX makes dynamic, interactive web applications feel like magic, all without writing a single line of JavaScript. We&amp;rsquo;ve handled forms, swapped content, and even orchestrated complex UI changes with simple HTML attributes. But what if your application needs to react to things happening &lt;em&gt;right now&lt;/em&gt;? What if you want to push updates from the server to your users in real-time, without them having to click a button or refresh the page?&lt;/p&gt;</description></item><item><title>Chapter 16: Deployment Strategies for Fine-Tuned LLMs</title><link>https://ai-blog.noorshomelab.dev/tunix-mastery-2026/16-deployment/</link><pubDate>Fri, 30 Jan 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/tunix-mastery-2026/16-deployment/</guid><description>&lt;h2 id="chapter-16-deployment-strategies-for-fine-tuned-llms"&gt;Chapter 16: Deployment Strategies for Fine-Tuned LLMs&lt;/h2&gt;
&lt;p&gt;Welcome back, future LLM deployment expert! So far in our Tunix journey, you&amp;rsquo;ve mastered setting up your environment, pre-training, fine-tuning, and evaluating Large Language Models (LLMs) using the power of JAX. You&amp;rsquo;ve transformed raw data into intelligent, specialized models. But what&amp;rsquo;s the point of having a brilliant model if it&amp;rsquo;s just sitting on your hard drive?&lt;/p&gt;
&lt;p&gt;This chapter is all about bringing your fine-tuned LLMs to life by deploying them for real-world use. We&amp;rsquo;ll explore the critical steps and considerations for taking your Tunix-trained models and making them accessible for inference, whether for a small internal tool or a large-scale application. We&amp;rsquo;ll cover everything from exporting your model to setting up a robust API and even containerizing it for consistent deployment. Get ready to turn your training efforts into tangible, interactive AI!&lt;/p&gt;</description></item><item><title>Chapter 20: Deployment and Scaling HTMX Applications</title><link>https://ai-blog.noorshomelab.dev/htmx-mastery-2025/deployment-scaling-htmx-applications/</link><pubDate>Thu, 04 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/htmx-mastery-2025/deployment-scaling-htmx-applications/</guid><description>&lt;h2 id="chapter-20-deployment-and-scaling-htmx-applications"&gt;Chapter 20: Deployment and Scaling HTMX Applications&lt;/h2&gt;
&lt;p&gt;Welcome back, fellow web adventurer! You&amp;rsquo;ve come a long way, mastering the magic of HTMX to create dynamic, engaging user interfaces with minimal JavaScript. So far, we&amp;rsquo;ve focused on building fantastic features locally. But what good is a masterpiece if it&amp;rsquo;s only admired in your workshop?&lt;/p&gt;
&lt;p&gt;In this chapter, we&amp;rsquo;re going to tackle the exciting, and sometimes daunting, world of taking your HTMX applications from your development machine to the vast, open internet. We&amp;rsquo;ll explore the core concepts behind deploying and scaling HTMX-powered web applications, ensuring they are robust, performant, and ready for real-world traffic. Get ready to think about how your server-side rendering strategy impacts everything from caching to load balancing!&lt;/p&gt;</description></item><item><title>Build a REST API with FastAPI</title><link>https://ai-blog.noorshomelab.dev/tutorials/build-rest-api-fastapi/</link><pubDate>Tue, 26 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/tutorials/build-rest-api-fastapi/</guid><description>&lt;p&gt;&lt;strong&gt;What you&amp;rsquo;ll build:&lt;/strong&gt; A functional REST API using FastAPI, demonstrating setup, route definition, data validation, dependency injection, and testing.
&lt;strong&gt;Time needed:&lt;/strong&gt; ~75 minutes
&lt;strong&gt;Prerequisites:&lt;/strong&gt; Python 3.8 or newer, Basic understanding of Python, Familiarity with REST API concepts
&lt;strong&gt;Version used:&lt;/strong&gt; 0.115.6&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;FastAPI is a modern, fast (high-performance) web framework for building APIs with Python 3.8+ based on standard Python type hints. It&amp;rsquo;s designed to be easy to use, highly performant, and automatically generate interactive API documentation. In this tutorial, we&amp;rsquo;ll walk through building a complete, yet simple, REST API from scratch, covering the core features that make FastAPI a joy to work with.&lt;/p&gt;</description></item><item><title>Building a Production-Ready Real-time Chat Application: A Zero-to-Advanced Guide</title><link>https://ai-blog.noorshomelab.dev/projects/real-time-chat-fastapi-guide/</link><pubDate>Mon, 01 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/projects/real-time-chat-fastapi-guide/</guid><description>&lt;p&gt;Welcome to the &lt;strong&gt;Zero to Production-Ready Guide&lt;/strong&gt; for building a real-time chat application using FastAPI (Python) and WebSockets with basic user authentication! In this comprehensive guide, you&amp;rsquo;ll learn how to leverage the power of modern Python web development to create a robust, scalable, and secure chat platform.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll start from the very basics, setting up your development environment, and gradually build up the application, introducing core concepts like FastAPI routing, WebSocket communication, data models, user authentication, and ultimately, preparing your application for a real-world production environment. Each step will be explained thoroughly, with clear code examples and justifications for the architectural and library choices we make.&lt;/p&gt;</description></item><item><title>Python Web Development With Fastapi - Complete Learning Guide</title><link>https://ai-blog.noorshomelab.dev/guides/fastapibeginnerintroduction-20251025_173235/</link><pubDate>Sat, 25 Oct 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/guides/fastapibeginnerintroduction-20251025_173235/</guid><description>&lt;h1 id="python-web-development-with-fastapi---build-blazing-fast-robust-apis-with-modern-python"&gt;Python Web Development With Fastapi - Build Blazing-Fast, Robust APIs with Modern Python&lt;/h1&gt;
&lt;p&gt;Step into the future of Python web development with FastAPI, the cutting-edge framework that’s revolutionizing how developers build high-performance APIs. FastAPI isn&amp;rsquo;t just another framework; it&amp;rsquo;s a game-changer built on standard Python type hints, offering unparalleled developer experience, automatic data validation with Pydantic, and stunning performance thanks to Starlette and Uvicorn. If you&amp;rsquo;re tired of boilerplate code, slow development cycles, or grappling with outdated API documentation, FastAPI is your answer.&lt;/p&gt;</description></item><item><title>Chapter 1: Initial Project Setup and Virtual Environment</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-1-initial-setup/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-1-initial-setup/</guid><description>&lt;p&gt;The first step in any robust software project is to set up a clean and isolated development environment. This chapter will guide you through creating a new project directory and establishing a Python virtual environment to manage dependencies effectively.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A dedicated project folder for your chat application.&lt;/li&gt;
&lt;li&gt;A Python virtual environment configured to keep project dependencies separate from your system-wide Python installation.&lt;/li&gt;
&lt;li&gt;Installed FastAPI and Uvicorn, the core components of our application.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-virtual-environments"&gt;Concepts Explained: Virtual Environments&lt;/h3&gt;
&lt;p&gt;A virtual environment is a self-contained directory tree that contains a Python installation for a particular version of Python, plus a number of additional packages.&lt;/p&gt;</description></item><item><title>Chapter 10: Securing WebSocket Communication</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-10-websocket-security/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-10-websocket-security/</guid><description>&lt;p&gt;So far, our chat application uses JWT for HTTP authentication and passes the token as a query parameter for WebSockets. While this identifies the user, the actual WebSocket data transfer is currently unencrypted (WS://). For production, all traffic, especially sensitive chat messages, &lt;strong&gt;must&lt;/strong&gt; be encrypted using WSS (WebSocket Secure), which relies on TLS/SSL certificates. This chapter focuses on enabling WSS and reinforcing WebSocket authentication.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will:&lt;/p&gt;</description></item><item><title>Chapter 11: Dockerizing Your FastAPI Chat Application</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-11-dockerization/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-11-dockerization/</guid><description>&lt;p&gt;As our application grows, ensuring a consistent development environment and simplifying deployment becomes critical. Docker provides &lt;strong&gt;containerization&lt;/strong&gt;, packaging your application and all its dependencies into a single, isolated unit called a container. This chapter will guide you through Dockerizing our FastAPI chat application.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Understand the benefits of Docker for development and deployment.&lt;/li&gt;
&lt;li&gt;Create a &lt;code&gt;Dockerfile&lt;/code&gt; to build a Docker image for our application.&lt;/li&gt;
&lt;li&gt;Use Docker Compose to run the application along with a database (optional, for real DB).&lt;/li&gt;
&lt;li&gt;Run your FastAPI chat application inside a Docker container.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-docker-and-dockerfile"&gt;Concepts Explained: Docker and Dockerfile&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Docker&lt;/strong&gt; is a platform that uses OS-level virtualization to deliver software in packages called containers. Containers are isolated from each other and bundle their own software, libraries, and configuration files; they can communicate with each other through well-defined channels.&lt;/p&gt;</description></item><item><title>Chapter 12: Deployment Strategies and Considerations</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-12-deployment/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-12-deployment/</guid><description>&lt;p&gt;You&amp;rsquo;ve built a real-time chat application, complete with authentication, rooms, message persistence, and Dockerization. Now, the final frontier is deploying it to a production environment. This chapter discusses various deployment strategies and crucial considerations for making your application scalable, reliable, and secure in the wild.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Understand the role of Gunicorn and reverse proxies in FastAPI deployments.&lt;/li&gt;
&lt;li&gt;Be familiar with essential production configurations (environment variables, logging).&lt;/li&gt;
&lt;li&gt;Learn about common deployment platforms (PaaS, VMs, Kubernetes).&lt;/li&gt;
&lt;li&gt;Grasp key security and scalability considerations for a production environment.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-production-deployment-stack"&gt;Concepts Explained: Production Deployment Stack&lt;/h3&gt;
&lt;p&gt;For local development, running &lt;code&gt;uvicorn app.main:app --reload&lt;/code&gt; is fine. However, in production, Uvicorn is typically used as a worker within a more robust ASGI server like &lt;strong&gt;Gunicorn&lt;/strong&gt;, and often fronted by a &lt;strong&gt;reverse proxy&lt;/strong&gt; like Nginx or Caddy.&lt;/p&gt;</description></item><item><title>Chapter 2: Your First FastAPI Endpoint and Project Structure</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-2-fastapi-intro/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-2-fastapi-intro/</guid><description>&lt;p&gt;With your development environment ready, it&amp;rsquo;s time to write some code! This chapter focuses on creating a minimal FastAPI application, understanding its basic components, and establishing a sensible project structure.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will be able to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Write a simple &amp;ldquo;Hello, World!&amp;rdquo; FastAPI application.&lt;/li&gt;
&lt;li&gt;Run the FastAPI application using Uvicorn.&lt;/li&gt;
&lt;li&gt;Understand basic FastAPI routing.&lt;/li&gt;
&lt;li&gt;Create a foundational project directory structure.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-fastapi-basics"&gt;Concepts Explained: FastAPI Basics&lt;/h3&gt;
&lt;p&gt;FastAPI is a modern, fast (high-performance) web framework for building APIs with Python 3.8+ based on standard Python type hints. It offers:&lt;/p&gt;</description></item><item><title>Chapter 3: Introducing WebSockets - Real-time Foundations</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-3-websockets-intro/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-3-websockets-intro/</guid><description>&lt;p&gt;The core of any real-time chat application is its ability to establish persistent, bidirectional communication channels. This is where WebSockets come in. In this chapter, we&amp;rsquo;ll integrate a basic WebSocket endpoint into our FastAPI application.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will be able to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Understand the fundamental concept of WebSockets.&lt;/li&gt;
&lt;li&gt;Implement a FastAPI WebSocket endpoint.&lt;/li&gt;
&lt;li&gt;Send and receive messages over a WebSocket connection.&lt;/li&gt;
&lt;li&gt;Test your WebSocket connection using a simple client.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-websockets"&gt;Concepts Explained: WebSockets&lt;/h3&gt;
&lt;p&gt;Traditionally, HTTP is a request-response protocol: a client sends a request, the server sends a response, and the connection closes. This isn&amp;rsquo;t ideal for real-time applications where information needs to be pushed from the server to the client instantly, and vice-versa, without constant polling.&lt;/p&gt;</description></item><item><title>Chapter 4: Basic User Authentication with JWT</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-4-basic-auth/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-4-basic-auth/</guid><description>&lt;p&gt;Before users can chat, we need to know who they are. This chapter focuses on implementing a basic user authentication system using JSON Web Tokens (JWT) in FastAPI. JWTs are a common, secure way to transmit information between parties as a JSON object, ideal for stateless authentication in APIs.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Understand what JWTs are and why they are used for authentication.&lt;/li&gt;
&lt;li&gt;Set up libraries for password hashing and JWT generation.&lt;/li&gt;
&lt;li&gt;Implement user creation and login endpoints.&lt;/li&gt;
&lt;li&gt;Create a dependency to protect FastAPI routes with JWT.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-jwt-and-hashing"&gt;Concepts Explained: JWT and Hashing&lt;/h3&gt;
&lt;h4 id="json-web-tokens-jwt"&gt;JSON Web Tokens (JWT)&lt;/h4&gt;
&lt;p&gt;A JWT is a compact, URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JSON object and are digitally signed using a secret (with HMAC algorithm) or a public/private key pair (with RSA or ECDSA).&lt;/p&gt;</description></item><item><title>Chapter 5: Managing Active WebSocket Connections</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-5-connection-manager/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-5-connection-manager/</guid><description>&lt;p&gt;Our current WebSocket endpoint only echoes messages back to the sender. A real chat application needs to handle multiple users, allowing them to join, leave, and send messages that are broadcast to all other connected users (or users in a specific room). This chapter introduces a WebSocket connection manager to address this.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Understand the need for a connection manager in a real-time application.&lt;/li&gt;
&lt;li&gt;Implement a &lt;code&gt;ConnectionManager&lt;/code&gt; class to store and manage active WebSocket connections.&lt;/li&gt;
&lt;li&gt;Modify the WebSocket endpoint to use the manager for connecting, disconnecting, and broadcasting messages.&lt;/li&gt;
&lt;li&gt;Test broadcasting functionality with multiple client connections.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-connection-management"&gt;Concepts Explained: Connection Management&lt;/h3&gt;
&lt;p&gt;When a client connects via WebSocket, the &lt;code&gt;WebSocket&lt;/code&gt; object represents that specific connection. To send a message to all active clients, or a subset of them, our server needs a way to keep track of these individual &lt;code&gt;WebSocket&lt;/code&gt; objects. A &lt;code&gt;ConnectionManager&lt;/code&gt; class typically serves this purpose.&lt;/p&gt;</description></item><item><title>Chapter 6: Storing Messages with SQLite</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-6-sqlite-messages/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-6-sqlite-messages/</guid><description>&lt;p&gt;A real chat application needs to store messages to provide chat history. This chapter will guide you through setting up a SQLite database and integrating it into our FastAPI application using SQLAlchemy, a powerful SQL toolkit and Object-Relational Mapper (ORM).&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Understand the basics of ORM and why we use SQLAlchemy.&lt;/li&gt;
&lt;li&gt;Set up a SQLite database connection.&lt;/li&gt;
&lt;li&gt;Define database models for users and chat messages.&lt;/li&gt;
&lt;li&gt;Implement methods to store new messages and retrieve chat history.&lt;/li&gt;
&lt;li&gt;Update the WebSocket endpoint to save messages.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-sqlalchemy-and-orm"&gt;Concepts Explained: SQLAlchemy and ORM&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Object-Relational Mapping (ORM)&lt;/strong&gt; is a technique that lets you query and manipulate data from a database using an object-oriented paradigm. Instead of writing raw SQL, you interact with database tables as Python classes and objects.&lt;/p&gt;</description></item><item><title>Chapter 7: Enhancing Chat Functionality: Room-based Messaging</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-7-chat-rooms/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-7-chat-rooms/</guid><description>&lt;p&gt;A single global chat channel is fun, but real-world chat applications typically feature multiple &amp;ldquo;rooms&amp;rdquo; or &amp;ldquo;channels&amp;rdquo; where users can have separate conversations. This chapter will modify our &lt;code&gt;ConnectionManager&lt;/code&gt; and WebSocket endpoint to support room-based messaging.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Modify the &lt;code&gt;ConnectionManager&lt;/code&gt; to manage connections per room.&lt;/li&gt;
&lt;li&gt;Update the WebSocket endpoint to allow clients to specify a chat room.&lt;/li&gt;
&lt;li&gt;Implement broadcasting messages only to users within the same room.&lt;/li&gt;
&lt;li&gt;Create an endpoint to list available rooms.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-room-based-messaging"&gt;Concepts Explained: Room-Based Messaging&lt;/h3&gt;
&lt;p&gt;Instead of a flat list of all active WebSocket connections, we&amp;rsquo;ll use a dictionary where keys are room names (e.g., &amp;ldquo;general&amp;rdquo;, &amp;ldquo;python-dev&amp;rdquo;, &amp;ldquo;random&amp;rdquo;) and values are lists of &lt;code&gt;WebSocket&lt;/code&gt; objects for users in that specific room.&lt;/p&gt;</description></item><item><title>Chapter 8: User Registration and Login Flow</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-8-user-auth-flow/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-8-user-auth-flow/</guid><description>&lt;p&gt;While we introduced basic user registration and login in Chapter 4, this chapter focuses on refining these critical endpoints. We&amp;rsquo;ll ensure robust data validation, provide clear error messages, and integrate the user management more tightly with our database. This is about building a solid, production-ready authentication foundation.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Have dedicated endpoints for user registration and login.&lt;/li&gt;
&lt;li&gt;Understand data validation for incoming user data.&lt;/li&gt;
&lt;li&gt;Implement proper password hashing and verification.&lt;/li&gt;
&lt;li&gt;Ensure that authenticated users are correctly identified and used throughout the application.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-data-validation--error-handling"&gt;Concepts Explained: Data Validation &amp;amp; Error Handling&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Data Validation:&lt;/strong&gt; Ensuring that incoming data (like username and password during registration) meets expected criteria. FastAPI leverages Pydantic for this, which allows you to define strict schemas for your request bodies.&lt;/p&gt;</description></item><item><title>Chapter 9: Advanced Error Handling and Logging</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-9-error-logging/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-9-error-logging/</guid><description>&lt;p&gt;As applications grow and move into production, robust error handling and comprehensive logging become indispensable. This chapter focuses on setting up structured logging, handling custom exceptions, and providing graceful error responses in our FastAPI chat application.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Configure Python&amp;rsquo;s &lt;code&gt;logging&lt;/code&gt; module for structured output.&lt;/li&gt;
&lt;li&gt;Implement custom exception handlers for specific application errors.&lt;/li&gt;
&lt;li&gt;Ensure that unhandled exceptions are caught and logged appropriately.&lt;/li&gt;
&lt;li&gt;Understand best practices for logging sensitive information.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-structured-logging--custom-exception-handling"&gt;Concepts Explained: Structured Logging &amp;amp; Custom Exception Handling&lt;/h3&gt;
&lt;h4 id="structured-logging"&gt;Structured Logging&lt;/h4&gt;
&lt;p&gt;Traditional logging often outputs plain text messages. &lt;strong&gt;Structured logging&lt;/strong&gt; outputs logs in a consistent, machine-readable format, typically JSON. This makes logs much easier to parse, filter, and analyze with log management tools (e.g., ELK Stack, Splunk, DataDog).&lt;/p&gt;</description></item><item><title>Chapters for Building a Real-time Chat Application</title><link>https://ai-blog.noorshomelab.dev/chat-guide/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/</guid><description>&lt;p&gt;This section provides a structured list of all the chapters in the &amp;ldquo;Building a Production-Ready Real-time Chat Application&amp;rdquo; guide. Each chapter builds upon the previous one, taking you through the entire process from initial setup to production deployment.&lt;/p&gt;</description></item></channel></rss>