<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mastering Backend</title>
    <description>The latest articles on Forem by Mastering Backend (@masteringbackend).</description>
    <link>https://forem.com/masteringbackend</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F10451%2F2821d44b-ec7b-49c1-9051-514948d5ffe8.png</url>
      <title>Forem: Mastering Backend</title>
      <link>https://forem.com/masteringbackend</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/masteringbackend"/>
    <language>en</language>
    <item>
      <title>How to Become an AI Engineer from a Java Developer Using Spring AI</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Wed, 06 May 2026 10:00:30 +0000</pubDate>
      <link>https://forem.com/masteringbackend/how-to-become-an-ai-engineer-from-a-java-developer-using-spring-ai-3go7</link>
      <guid>https://forem.com/masteringbackend/how-to-become-an-ai-engineer-from-a-java-developer-using-spring-ai-3go7</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstrapi-images-aws-s3.s3.us-west-2.amazonaws.com%2FNewlatter_image_size_1_46a709ef2b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstrapi-images-aws-s3.s3.us-west-2.amazonaws.com%2FNewlatter_image_size_1_46a709ef2b.png" alt="title" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
The world is quickly moving towards Artificial Intelligence, and many Java developers are now thinking about how they can transition into AI engineering. The good news is you don’t need to start from scratch. If you already know Java and Spring Boot, you already have a strong foundation. With tools like Spring AI, the journey becomes much easier and practical.&lt;/p&gt;

&lt;p&gt;Let’s understand this step by step in a simple and realistic way.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start with the Right Mindset
&lt;/h3&gt;

&lt;p&gt;Before jumping into tools and code, you need to understand one thing: AI engineering is not only about machine learning models. It is also about building real-world applications that use AI.&lt;/p&gt;

&lt;p&gt;As a Java developer, you already know how to build scalable systems, APIs, and backend logic. Now you just need to learn how to integrate AI into those systems.&lt;/p&gt;

&lt;p&gt;Think like this:&lt;/p&gt;

&lt;p&gt;Earlier → You were building APIs&lt;/p&gt;

&lt;p&gt;Now → You will build intelligent APIs&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn Basic AI Concepts (No Deep Math Required)
&lt;/h3&gt;

&lt;p&gt;You don’t need to become a data scientist. Just focus on understanding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is AI and Machine Learning&lt;/li&gt;
&lt;li&gt;What is a Large Language Model (LLM)&lt;/li&gt;
&lt;li&gt;What is Prompt Engineering&lt;/li&gt;
&lt;li&gt;Basics of embeddings and vector databases&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;

&lt;p&gt;If a user asks, “Suggest me a good laptop under 50k,” an AI system can understand the intent and generate a helpful answer. You don’t need to train the model; you just need to use it correctly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understand How APIs Work with AI
&lt;/h3&gt;

&lt;p&gt;Most modern AI systems, like GPT models, are accessed using APIs. This is where your Java experience helps a lot.&lt;/p&gt;

&lt;p&gt;You already know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;REST APIs&lt;/li&gt;
&lt;li&gt;JSON handling&lt;/li&gt;
&lt;li&gt;HTTP calls&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now you just need to call AI APIs and process responses.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;

&lt;p&gt;Imagine you are building a customer support system. Instead of writing static responses, you can call an AI API to generate dynamic replies based on user queries.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn Spring AI
&lt;/h3&gt;

&lt;p&gt;Spring AI is designed to make AI integration easy for Java developers. It works just like Spring Boot, so you will feel comfortable.&lt;/p&gt;

&lt;p&gt;With Spring AI, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connect to AI models (like OpenAI)&lt;/li&gt;
&lt;li&gt;Build chat-based applications&lt;/li&gt;
&lt;li&gt;Handle prompts easily&lt;/li&gt;
&lt;li&gt;Integrate embeddings and vector search&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;

&lt;p&gt;You can build a chatbot in your existing Spring Boot app that answers user questions about your product.&lt;/p&gt;

&lt;p&gt;Simple use case:&lt;/p&gt;

&lt;p&gt;A user types: “How do I reset my password?”&lt;/p&gt;

&lt;p&gt;Your system sends this query to an AI model using Spring AI and returns a clean, human-like response.&lt;/p&gt;

&lt;h3&gt;
  
  
  Build Small Projects (Very Important)
&lt;/h3&gt;

&lt;p&gt;Learning the theory aspect is not enough. You must build real applications.&lt;/p&gt;

&lt;p&gt;Start with simple projects like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI Chatbot for FAQs&lt;/li&gt;
&lt;li&gt;Resume Analyzer using AI&lt;/li&gt;
&lt;li&gt;Email reply generator&lt;/li&gt;
&lt;li&gt;Blog writing assistant&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;

&lt;p&gt;Supposing you’re running an e-commerce platform. You can build an AI feature where users ask:&lt;/p&gt;

&lt;p&gt;“Suggest me shoes for running under ₹3000.”&lt;/p&gt;

&lt;p&gt;And your system generates smart recommendations.&lt;/p&gt;

&lt;p&gt;This is exactly what companies are doing today.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn Prompt Engineering
&lt;/h3&gt;

&lt;p&gt;Prompt engineering means writing better inputs to get better outputs from AI.&lt;/p&gt;

&lt;p&gt;Bad prompt:&lt;/p&gt;

&lt;p&gt;“Tell me about Java.”&lt;/p&gt;

&lt;p&gt;Good prompt:&lt;/p&gt;

&lt;p&gt;“Explain Java in simple terms for beginners with real-world examples in 100 words.”&lt;/p&gt;

&lt;p&gt;You will see a huge difference in output quality. As a Java developer, think of prompts like function inputs. Better input = better output.&lt;/p&gt;

&lt;h3&gt;
  
  
  Work with Data (Basic Level)
&lt;/h3&gt;

&lt;p&gt;You don’t need deep data science knowledge, but you should know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to store and retrieve data&lt;/li&gt;
&lt;li&gt;How to use vector databases&lt;/li&gt;
&lt;li&gt;How embeddings work&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;

&lt;p&gt;If you build a document search system, you can store documents as embeddings and allow users to search using natural language.&lt;/p&gt;

&lt;p&gt;User asks:&lt;/p&gt;

&lt;p&gt;“Show me policies related to refunds.”&lt;/p&gt;

&lt;p&gt;AI finds the most relevant content even if exact words don’t match.&lt;/p&gt;

&lt;h3&gt;
  
  
  Combine AI with Your Existing Skills
&lt;/h3&gt;

&lt;p&gt;This is your biggest advantage.&lt;/p&gt;

&lt;p&gt;You already know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spring Boot&lt;/li&gt;
&lt;li&gt;Microservices&lt;/li&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;li&gt;Database handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now combine them with AI.&lt;/p&gt;

&lt;p&gt;Example: In a banking app:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use AI to detect fraud patterns&lt;/li&gt;
&lt;li&gt;Generate automated customer responses&lt;/li&gt;
&lt;li&gt;Summarize transaction history&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You are not replacing your skills; you’re simply upgrading them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn by Building Real Use Cases
&lt;/h3&gt;

&lt;p&gt;Companies don’t hire AI engineers just for knowledge; they want problem solvers who focus on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Solving real business problems&lt;/li&gt;
&lt;li&gt;Building usable features&lt;/li&gt;
&lt;li&gt;Creating end-to-end applications&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;

&lt;p&gt;Instead of just saying “I know AI,” build a project like:&lt;/p&gt;

&lt;p&gt;“AI-powered ticket resolution system using Spring AI”&lt;/p&gt;

&lt;p&gt;That’s what makes you stand out.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep It Simple and Consistent
&lt;/h3&gt;

&lt;p&gt;Don’t try to learn everything at once.&lt;/p&gt;

&lt;p&gt;Follow this path by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Learning the basics of AI&lt;/li&gt;
&lt;li&gt;Understanding APIs&lt;/li&gt;
&lt;li&gt;Using Spring AI&lt;/li&gt;
&lt;li&gt;Building projects&lt;/li&gt;
&lt;li&gt;Improving step by step&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consistency matters more than speed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Started with Spring AI: A Simple Guide for Java Developers
&lt;/h3&gt;

&lt;p&gt;Artificial Intelligence is becoming an important part of modern applications, but integrating AI into backend systems can feel complex. Different AI providers have different APIs, formats, and configurations, which makes development harder. This is where Spring AI helps Java developers.&lt;/p&gt;

&lt;p&gt;Spring AI is a project from the Spring ecosystem that makes it easy to integrate AI into Java applications. It follows the same philosophy as Spring Boot. Instead of worrying about multiple AI APIs, Spring AI provides a consistent way to work with them. ( &lt;a href="https://codefarm0.medium.com/getting-started-with-spring-ai-a-comprehensive-guide-for-beginners-34013e8d4a39?utm_source=chatgpt.com" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;)&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Spring AI?
&lt;/h3&gt;

&lt;p&gt;Spring AI is an extension of the Spring Framework designed to simplify working with AI models like chat models, embeddings, and image generation tools. It provides abstraction layers so that you don’t need to handle provider-specific complexity. ( &lt;a href="https://codefarm0.medium.com/getting-started-with-spring-ai-a-comprehensive-guide-for-beginners-34013e8d4a39?utm_source=chatgpt.com" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;It allows you to connect your Java application with AI models easily, just like you connect a database using Spring.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Spring AI is Important
&lt;/h3&gt;

&lt;p&gt;Before Spring AI, developers had to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write custom code for each AI provider&lt;/li&gt;
&lt;li&gt;Handle different API formats&lt;/li&gt;
&lt;li&gt;Manage complex integrations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Spring AI solves this by giving a unified API layer. You can switch between providers like OpenAI or others without changing much code. ( &lt;a href="https://spring.io/projects/spring-ai?utm_source=chatgpt.com" rel="noopener noreferrer"&gt;Home&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;It also focuses on connecting your business data and APIs with AI models, which is the real need in modern applications. ( &lt;a href="https://docs.spring.io/spring-ai/reference/?utm_source=chatgpt.com" rel="noopener noreferrer"&gt;Home&lt;/a&gt;)&lt;/p&gt;

&lt;h3&gt;
  
  
  Core Components of Spring AI
&lt;/h3&gt;

&lt;p&gt;Spring AI provides several important components that make development easy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ChatClient: Which is used to build chatbots or conversational features&lt;/li&gt;
&lt;li&gt;EmbeddingClient: Helps to convert text into vectors for search and recommendations&lt;/li&gt;
&lt;li&gt;VectorStore: Stores embeddings for semantic search&lt;/li&gt;
&lt;li&gt;PromptTemplate: Helps create dynamic and reusable prompts&lt;/li&gt;
&lt;li&gt;Function Calling: Allows AI to call Java methods directly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These components provide a consistent programming model, regardless of which AI provider you use.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Spring AI Works (Simple Flow)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;User sends a request (Example: “Explain Java basics”)&lt;/li&gt;
&lt;li&gt;Spring Boot controller receives the request&lt;/li&gt;
&lt;li&gt;Spring AI processes it using prompts&lt;/li&gt;
&lt;li&gt;It calls an AI model (like OpenAI)&lt;/li&gt;
&lt;li&gt;The response is returned to the user&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This flow is very similar to how you already build REST APIs, which makes it easy for Java developers to adopt.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Get Started
&lt;/h3&gt;

&lt;p&gt;Starting with Spring AI is simple if you already know Spring Boot.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Create a Spring Boot project
&lt;/h3&gt;

&lt;p&gt;Go to Spring Initializr and add dependencies for Spring AI.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Add dependencies
&lt;/h3&gt;

&lt;p&gt;You can add Spring AI dependencies using Maven or Gradle. It is available in Maven Central, so setup is straightforward.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Configure API keys
&lt;/h3&gt;

&lt;p&gt;Add your AI provider API key (like OpenAI) in &lt;a href="http://application.properties" rel="noopener noreferrer"&gt;application.properties&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Write a simple AI service
&lt;/h3&gt;

&lt;p&gt;Use ChatClient to send prompts and get responses.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;

&lt;p&gt;Create an endpoint like:&lt;/p&gt;

&lt;p&gt;GET /ask?question=What is Spring Boot?&lt;/p&gt;

&lt;p&gt;Your backend will send this to an AI model and return a clean response.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-World Use Cases
&lt;/h3&gt;

&lt;p&gt;Spring AI is not just for demos. It is used in real applications:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Customer Support Chatbots&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Automate responses for user queries in applications.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Document Q&amp;amp;A Systems&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Users can ask questions about company policies or documents.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Smart Search Systems&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Instead of keyword search, users can search in natural language.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Content Generation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Generate emails, reports, or product descriptions automatically.&lt;/p&gt;

&lt;p&gt;An e-commerce app can use Spring AI to suggest products because the system understands intent and gives smart recommendations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advanced Features
&lt;/h3&gt;

&lt;p&gt;Spring AI also supports advanced capabilities like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retrieval Augmented Generation (RAG) for using your own data&lt;/li&gt;
&lt;li&gt;Chat memory for conversation-based apps&lt;/li&gt;
&lt;li&gt;Multi-model support (text, image, audio)&lt;/li&gt;
&lt;li&gt;Tool calling for executing backend logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These features help build production-level AI systems, not just simple demos. ( &lt;a href="https://spring.io/ai?utm_source=chatgpt.com" rel="noopener noreferrer"&gt;Home&lt;/a&gt;)&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;Spring AI makes AI development simple for Java developers by removing unnecessary complexity. If you already know Spring Boot, you can start building AI-powered applications without learning a completely new ecosystem, and instead of switching to Python or learning heavy machine learning concepts, you can stay in Java and still build powerful AI features.&lt;/p&gt;

&lt;p&gt;Start small, build a chatbot or a smart API, and then slowly move towards advanced use cases. That’s the best way to grow in AI with Spring AI.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Have a great one!!!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Author: &lt;a href="https://blog.masteringbackend.com/authors/ayush" rel="noopener noreferrer"&gt;Ayush Shrivastava&lt;/a&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Thank you for being a part of the community
&lt;/h3&gt;




&lt;p&gt;Before you go:&lt;/p&gt;

&lt;h3&gt;
  
  
  Whenever you’re ready
&lt;/h3&gt;

&lt;p&gt;There are 4 ways we can help you become a great backend engineer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Platform:&lt;/strong&gt;&lt;/a&gt; Join thousands of backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learning and set schedules, and solve backend engineering tasks, exercises, and challenges.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/academy?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Academy:&lt;/strong&gt;&lt;/a&gt; The “MB Academy” is a 6-month intensive Advanced Backend Engineering Boot Camp to produce great backend engineers.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://backendweeky.dev/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Join Backend Weekly:&lt;/strong&gt;&lt;/a&gt; If you like posts like this, you will absolutely enjoy our exclusive weekly newsletter, sharing exclusive backend engineering resources to help you become a great Backend Engineer.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://getbackendjobs.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Get Backend Jobs:&lt;/strong&gt;&lt;/a&gt; Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://blog.masteringbackend.com/how-to-become-an-ai-engineer-from-a-java-developer-using-spring-ai" rel="noopener noreferrer"&gt;&lt;em&gt;https://blog.masteringbackend.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>backenddevelopment</category>
      <category>javadeveloper</category>
      <category>ai</category>
      <category>springai</category>
    </item>
    <item>
      <title>Mastering @RequestHeader in Spring Boot</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Thu, 30 Apr 2026 10:00:30 +0000</pubDate>
      <link>https://forem.com/masteringbackend/mastering-requestheader-in-spring-boot-55oj</link>
      <guid>https://forem.com/masteringbackend/mastering-requestheader-in-spring-boot-55oj</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxqv0zlh3bbl1qn22805b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxqv0zlh3bbl1qn22805b.png" alt="title" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Learn how to use &lt;strong&gt;&lt;em&gt;@RequestHeader&lt;/em&gt;&lt;/strong&gt; in Spring Boot to handle HTTP headers for authentication, metadata, and client information with practical real-world examples.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is @RequestHeader
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;@RequestHeader&lt;/em&gt;&lt;/strong&gt; is a Spring Boot annotation used to bind HTTP header values to method parameters in a controller. It is mainly used to handle metadata rather than core business data. For example, headers like &lt;strong&gt;&lt;em&gt;Authorization,&lt;/em&gt;&lt;/strong&gt;  &lt;strong&gt;&lt;em&gt;Content-Type, or&lt;/em&gt;&lt;/strong&gt;  &lt;strong&gt;&lt;em&gt;User-Agent&lt;/em&gt;&lt;/strong&gt; provide additional context about the request.&lt;/p&gt;

&lt;p&gt;In real-world systems, it is commonly used for authentication (JWT tokens), request tracing (request IDs), and API versioning. It supports required, optional, and default values, making it flexible for different use cases. Proper use of headers improves API security, traceability, and communication between distributed systems.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;@RequestHeader i&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;s used in Spring Boot to extract values from HTTP request headers and bind them to method parameters, commonly for metadata like authentication tokens or client information in REST APIs.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In Spring Boot, &lt;strong&gt;&lt;em&gt;@RequestHeader&lt;/em&gt;&lt;/strong&gt; is used to extract values from HTTP request headers and bind them to method parameters. Headers usually contain metadata such as authentication tokens, content types, or client details.&lt;/p&gt;

&lt;p&gt;Let’s start with a simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/api/data"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;getData&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@RequestHeader&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"User-Agent"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;userAgent&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Client: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;userAgent&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a request is made, Spring extracts the &lt;strong&gt;&lt;em&gt;User-Agent&lt;/em&gt;&lt;/strong&gt; header value and passes it to the method.&lt;/p&gt;

&lt;p&gt;Now consider a real-world scenario where you need to validate an authentication token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/api/secure"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;secureApi&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@RequestHeader&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Authorization"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Token: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In production systems, this token is usually validated before processing the request.&lt;/p&gt;

&lt;p&gt;You can also make headers optional:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/api/info"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;getInfo&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
    &lt;span class="nd"&gt;@RequestHeader&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"X-Request-Id"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;required&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;requestId&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Request ID: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;requestId&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or provide default values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/api/version"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;getVersion&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
    &lt;span class="nd"&gt;@RequestHeader&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"version"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;defaultValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"v1"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"API Version: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For multiple headers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/api/headers"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;getHeaders&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@RequestHeader&lt;/span&gt; &lt;span class="nc"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toString&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Spring Boot, while &lt;strong&gt;&lt;em&gt;@RequestHeader&lt;/em&gt;&lt;/strong&gt; is commonly used to extract individual header values, you can also use &lt;strong&gt;&lt;em&gt;HttpHeaders&lt;/em&gt;&lt;/strong&gt; to handle multiple headers in a more flexible and scalable way. Let's look at a basic example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/headers/http-headers"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;readHeaders&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@RequestHeader&lt;/span&gt; &lt;span class="nc"&gt;HttpHeaders&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"User-Agent: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"User-Agent"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the entire request header is mapped into a &lt;strong&gt;&lt;em&gt;HttpHeaders&lt;/em&gt;&lt;/strong&gt; object, allowing you to access any header dynamically. Now consider a real-world scenario where you want to track client information and location:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/headers/http-headers"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;readRequestHeadersWithHttpHeaders&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
        &lt;span class="nd"&gt;@RequestHeader&lt;/span&gt; &lt;span class="nc"&gt;HttpHeaders&lt;/span&gt; &lt;span class="n"&gt;requestHeaders&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Received: "&lt;/span&gt; 
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;requestHeaders&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"User-Agent"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; 
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" "&lt;/span&gt; 
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;requestHeaders&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"User-Location"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example request headers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;User-Agent: Chrome&lt;/em&gt;&lt;/strong&gt;  &lt;strong&gt;&lt;em&gt;User-Location: India&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This approach is very useful in production systems like microservices, where multiple headers such as &lt;strong&gt;&lt;em&gt;Authorization,&lt;/em&gt;&lt;/strong&gt;  &lt;strong&gt;&lt;em&gt;X-Request-Id,&lt;/em&gt;&lt;/strong&gt;  &lt;strong&gt;&lt;em&gt;User-Agent,&lt;/em&gt;&lt;/strong&gt; and custom headers are passed in every request.&lt;/p&gt;

&lt;p&gt;In real-world applications like microservices or CRM systems, &lt;strong&gt;&lt;em&gt;@RequestHeader&lt;/em&gt;&lt;/strong&gt; is widely used for passing JWT tokens, tracking request IDs, handling API versioning, and managing client-specific data.&lt;/p&gt;

&lt;p&gt;Best practices include validating sensitive headers like Authorization, avoiding overuse of headers for business data, and keeping header usage consistent across APIs.&lt;/p&gt;

&lt;p&gt;Using &lt;strong&gt;&lt;em&gt;@RequestHeader&lt;/em&gt;&lt;/strong&gt; properly ensures secure, scalable, and well-structured APIs in production environments.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Have a great one!!!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Author: &lt;a href="https://blog.masteringbackend.com/authors/ayush" rel="noopener noreferrer"&gt;Ayush Shrivastava&lt;/a&gt;
&lt;/h3&gt;




&lt;h3&gt;
  
  
  Thank you for being a part of the community
&lt;/h3&gt;

&lt;p&gt;Before you go:&lt;/p&gt;

&lt;h3&gt;
  
  
  Whenever you’re ready
&lt;/h3&gt;

&lt;p&gt;There are 4 ways we can help you become a great backend engineer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Platform:&lt;/strong&gt;&lt;/a&gt; Join thousands of backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learning and set schedules, and solve backend engineering tasks, exercises, and challenges.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/academy?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Academy:&lt;/strong&gt;&lt;/a&gt; The “MB Academy” is a 6-month intensive Advanced Backend Engineering Boot Camp to produce great backend engineers.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://backendweeky.dev/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Join Backend Weekly:&lt;/strong&gt;&lt;/a&gt; If you like posts like this, you will absolutely enjoy our exclusive weekly newsletter, sharing exclusive backend engineering resources to help you become a great Backend Engineer.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://getbackendjobs.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Get Backend Jobs:&lt;/strong&gt;&lt;/a&gt; Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://blog.masteringbackend.com/mastering-request-header-in-spring-boot" rel="noopener noreferrer"&gt;&lt;em&gt;https://blog.masteringbackend.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>backenddevelopment</category>
      <category>springboot</category>
      <category>jwttoken</category>
      <category>authentication</category>
    </item>
    <item>
      <title>Implementing Rate Limiting for AI APIs</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Wed, 29 Apr 2026 10:00:30 +0000</pubDate>
      <link>https://forem.com/masteringbackend/implementing-rate-limiting-for-ai-apis-2lbb</link>
      <guid>https://forem.com/masteringbackend/implementing-rate-limiting-for-ai-apis-2lbb</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnlv3u4y6yebnn5qb7vp2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnlv3u4y6yebnn5qb7vp2.png" alt="title" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Rate limiting is what keeps your APIs stable under pressure. It helps to control how many requests a user or system can make, especially when working with heavy AI models.&lt;/p&gt;

&lt;p&gt;This guide walks through how API rate limiting works and how you can implement it in real-world systems. Exploring common strategies and learning how to handle the rate limit and errors helps you across different stacks.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Implement Rate Limiting in an API (Step by Step)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Step 1: Define what you want to limit
&lt;/h4&gt;

&lt;p&gt;Start by selecting the key used to track requests. Which are usually:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IP address (simple, but less accurate)&lt;/li&gt;
&lt;li&gt;User ID (better for authenticated systems)&lt;/li&gt;
&lt;li&gt;API key (common for AI APIs)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For an AI system, API keys or user IDs give more control and fairness.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: Set a clear rate limit policy
&lt;/h4&gt;

&lt;p&gt;Decide the number of requests you want within a particular time.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;100 requests per minute per user&lt;/li&gt;
&lt;li&gt;1,000 requests per hour per API key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep the limits realistic. Most AI endpoints are often resource-heavy, so be sure to reduce the limits where necessary.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3: Choose a rate-limiting algorithm
&lt;/h4&gt;

&lt;p&gt;Make sure you pick a strategy based on your use case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fixed window: it’s simple, but can cause bursts at window edges&lt;/li&gt;
&lt;li&gt;Sliding window: it gives smoother control over traffic&lt;/li&gt;
&lt;li&gt;Token bucket: very flexible, and allows short bursts while enforcing limits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For most AI APIs, a token bucket or a sliding window works best.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4: Save request counts efficiently
&lt;/h4&gt;

&lt;p&gt;You need a fast storage layer that can help you track requests in real time.&lt;/p&gt;

&lt;p&gt;Here are some common options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In-memory store (Redis is widely used)&lt;/li&gt;
&lt;li&gt;Application memory (only for single-instance apps)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example Redis key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rate_limit:user_123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 5: Intercept requests with middleware
&lt;/h4&gt;

&lt;p&gt;Rate limiting should run before your main logic. In some frameworks, this is done using middleware, which helps to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Extracts the identifier (IP, user ID, or API key)&lt;/li&gt;
&lt;li&gt;Check the current request count&lt;/li&gt;
&lt;li&gt;Decides whether to allow or reject a request&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Step 6: Enforce the limit
&lt;/h4&gt;

&lt;p&gt;If a request exceeds its limit, block it immediately by returning a standard HTTP response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;429&lt;/span&gt; &lt;span class="ne"&gt;Too Many Requests&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Include helpful headers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 60
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This helps clients understand when they can retry.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 7: Handle allowed requests
&lt;/h4&gt;

&lt;p&gt;If the request is within limits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Increase the counter&lt;/li&gt;
&lt;li&gt;Forward the request to the API handler&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep this step fast. Rate limiting should not introduce noticeable latency.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 8: Add retry and backoff guidance
&lt;/h4&gt;

&lt;p&gt;Clients should not retry immediately after hitting limits, encouraging exponential backoff helps to reduce pressure on your API during spikes.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 9: Log and monitor rate limit activity
&lt;/h4&gt;

&lt;p&gt;Be sure to track:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The number of blocked requests&lt;/li&gt;
&lt;li&gt;The most active users or API keys&lt;/li&gt;
&lt;li&gt;The patterns of abuse&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This will help to fine-tune limits and detect misuse early.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 10: Test under load
&lt;/h4&gt;

&lt;p&gt;Simulate high traffic before deploying, and be sure to check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whether limits are enforced correctly&lt;/li&gt;
&lt;li&gt;If legitimate users are blocked too early&lt;/li&gt;
&lt;li&gt;How the system behaves under burst traffic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Rate limiting should protect your API without breaking normal usage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Implementing Rate Limiting in C-Based APIs
&lt;/h3&gt;

&lt;p&gt;C-based APIs mostly run on high-performance environments where efficiency matters. For this, rate limiting needs to be fast, memory-conscious, and thread-safe by making sure to choose a lightweight tracking mechanism.&lt;/p&gt;

&lt;p&gt;In C, this is usually done with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;in-memory hash tables&lt;/li&gt;
&lt;li&gt;shared memory (for multi-process setups)&lt;/li&gt;
&lt;li&gt;external stores like Redis (for distributed systems)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Defining a rate limit structure
&lt;/h4&gt;

&lt;p&gt;Create a struct to track request counts and timing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="k"&gt;typedef&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;request_count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;time_t&lt;/span&gt; &lt;span class="n"&gt;window_start&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;RateLimit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Map the key as an IP address or API key.&lt;/p&gt;

&lt;p&gt;Use a hash table for fast lookups, and each incoming request should:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Extract the identifier (IP or API key)&lt;/li&gt;
&lt;li&gt;Look up its rate limit record&lt;/li&gt;
&lt;li&gt;Update or reset the counter&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example using pseudo-hash map logic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="n"&gt;RateLimit&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;rl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;get_rate_limit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;current_time&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;rl&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;window_start&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;WINDOW_SIZE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;rl&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;request_count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;rl&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;window_start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current_time&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;rl&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;request_count&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the count before processing the request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rl&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;request_count&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;MAX_REQUESTS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;429&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Too Many Requests&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Avoid heavy operations in this path.&lt;/p&gt;

&lt;p&gt;C-based APIs often run in multi-threaded or multi-process environments, and the race conditions can break rate-limiting logic.&lt;/p&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mutex locks (for threads)&lt;/li&gt;
&lt;li&gt;atomic operations (for counters)&lt;/li&gt;
&lt;li&gt;shared memory locks (for multi-process systems)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example with a mutex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="n"&gt;pthread_mutex_lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="cm"&gt;/* update rate limit */&lt;/span&gt;
&lt;span class="n"&gt;pthread_mutex_unlock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep lock duration short to avoid performance bottlenecks.&lt;/p&gt;

&lt;p&gt;Each active user or IP consumes memory, and without cleanup, the memory usage grows over time.&lt;/p&gt;

&lt;p&gt;Implement expiration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;remove entries after inactivity&lt;/li&gt;
&lt;li&gt;periodically clean old records&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This prevents memory leaks in long-running services.&lt;/p&gt;

&lt;h4&gt;
  
  
  Use Redis for distributed rate limiting
&lt;/h4&gt;

&lt;p&gt;If your C API runs across multiple servers, in-memory tracking is not going to be enough.&lt;/p&gt;

&lt;p&gt;Use Redis with atomic operations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;INCR&lt;/span&gt; &lt;span class="n"&gt;rate_limit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;user_123&lt;/span&gt;
&lt;span class="n"&gt;EXPIRE&lt;/span&gt; &lt;span class="n"&gt;rate_limit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;user_123&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures consistent limits across all instances.&lt;/p&gt;

&lt;p&gt;In C environments, simplicity often wins.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fixed window: easiest to implement&lt;/li&gt;
&lt;li&gt;Token bucket: better for handling bursts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A token bucket can be implemented with a counter that refills over time.&lt;/p&gt;

&lt;h4&gt;
  
  
  Return proper HTTP responses
&lt;/h4&gt;

&lt;p&gt;Even in C-based servers, follow standard responses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;429&lt;/span&gt; &lt;span class="ne"&gt;Too Many Requests&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Be sure to include headers for better client handling&lt;/p&gt;

&lt;p&gt;C systems are often used for high-throughput APIs to help simulate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;burst traffic&lt;/li&gt;
&lt;li&gt;concurrent requests&lt;/li&gt;
&lt;li&gt;edge cases around time windows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Efficient rate limiting in C rests on tight control rather than memory, concurrency, and execution time. If implemented correctly, it protects your API without slowing it down.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding Rate Limiting to Python and FastAPI Services
&lt;/h3&gt;

&lt;p&gt;Rate limiting in Python APIs is normally implemented at the middleware or dependency level. For FastAPI, this approach keeps the logic centralized and easy to reuse across routes.&lt;/p&gt;

&lt;p&gt;For most AI APIs, API keys or user IDs give better control than IP-based limits.&lt;/p&gt;

&lt;p&gt;Instead of trying to build everything from scratch, use proven tools like &lt;strong&gt;&lt;em&gt;slowapi or&lt;/em&gt;&lt;/strong&gt;  &lt;strong&gt;&lt;em&gt;fastapi-limiter, and&lt;/em&gt;&lt;/strong&gt; integrate them directly with FastAPI and reduce implementation complexity.&lt;/p&gt;

&lt;p&gt;Example using &lt;strong&gt;&lt;em&gt;fastapi-limiter&lt;/em&gt;&lt;/strong&gt; with Redis:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Request&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi.responses&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;JSONResponse&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi_limiter&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastAPILimiter&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi_limiter.depends&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RateLimiter&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;aioredis&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nd"&gt;@app.on_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;startup&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;startup&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;redis&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;aioredis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;redis://localhost&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;FastAPILimiter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/chat&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dependencies&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Depends&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;RateLimiter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;times&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;seconds&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;))])&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;chat_endpoint&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Request allowed&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This limits requests to 5 per minute per client and each request:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extracts a unique identifier&lt;/li&gt;
&lt;li&gt;Stores or increments a counter in Redis&lt;/li&gt;
&lt;li&gt;Checks if the limit is exceeded&lt;/li&gt;
&lt;li&gt;Blocks or allows the request&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Redis is mostly used because it supports atomic operations and works well in distributed systems.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/inference&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dependencies&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Depends&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;RateLimiter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;times&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;seconds&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;))])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps resource-heavy endpoints protected.&lt;/p&gt;

&lt;p&gt;When a limit has been exceeded, FastAPI automatically returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;429 Too Many Requests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can customize the response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.exception_handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;429&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;rate_limit_handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exc&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;JSONResponse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;status_code&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;429&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;detail&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Rate limit exceeded. Try again later.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want a global limit across all routes, applying middleware instead of per-route dependencies works, and it ensures every request passes through the same rate-limiting logic.&lt;/p&gt;

&lt;p&gt;In production, most FastAPI apps often run with multiple workers, which may stop in-memory counters from syncing across instances.&lt;/p&gt;

&lt;p&gt;Always use a shared store like Redis for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;consistent limits&lt;/li&gt;
&lt;li&gt;distributed deployments&lt;/li&gt;
&lt;li&gt;horizontal scaling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;FastAPI makes rate limiting straightforward when combined with Redis and middleware patterns. The most important part is keeping it efficient, consistent, and aligned with how your API is being used.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Have a great one!!!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Author: &lt;a href="https://blog.masteringbackend.com/authors/Toluwanimi" rel="noopener noreferrer"&gt;Toluwanimi Fawole&lt;/a&gt;
&lt;/h3&gt;




&lt;h3&gt;
  
  
  Thank you for being a part of the community
&lt;/h3&gt;

&lt;p&gt;Before you go:&lt;/p&gt;

&lt;h3&gt;
  
  
  Whenever you’re ready
&lt;/h3&gt;

&lt;p&gt;There are 4 ways we can help you become a great backend engineer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Platform:&lt;/strong&gt;&lt;/a&gt; Join thousands of backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learning and set schedules, and solve backend engineering tasks, exercises, and challenges.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/academy?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Academy:&lt;/strong&gt;&lt;/a&gt; The “MB Academy” is a 6-month intensive Advanced Backend Engineering Boot Camp to produce great backend engineers.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://backendweeky.dev/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Join Backend Weekly:&lt;/strong&gt;&lt;/a&gt; If you like posts like this, you will absolutely enjoy our exclusive weekly newsletter, sharing exclusive backend engineering resources to help you become a great Backend Engineer.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://getbackendjobs.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Get Backend Jobs:&lt;/strong&gt;&lt;/a&gt; Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://blog.masteringbackend.com/implementing-rate-limiting-for-ai-ap-is" rel="noopener noreferrer"&gt;&lt;em&gt;https://blog.masteringbackend.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>redis</category>
      <category>ratelimiting</category>
      <category>ai</category>
      <category>api</category>
    </item>
    <item>
      <title>Mastering @RequestParam in Spring Boot</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Tue, 21 Apr 2026 09:00:00 +0000</pubDate>
      <link>https://forem.com/masteringbackend/mastering-requestparam-in-spring-boot-2m17</link>
      <guid>https://forem.com/masteringbackend/mastering-requestparam-in-spring-boot-2m17</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo9h918qt9h8my7xr0hct.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo9h918qt9h8my7xr0hct.png" alt="Mastering @RequestParam in Spring Boot" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Learn how to use  &lt;code&gt;@RequestParam&lt;/code&gt;  in Spring Boot to handle query parameters effectively with practical examples from real-world scenarios like search, filtering, and pagination.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is  &lt;code&gt;@RequestParam&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;@RequestParam&lt;/code&gt;  is a Spring Boot annotation used to bind query parameters from the URL to method parameters in a controller. Unlike  &lt;code&gt;@PathVariable&lt;/code&gt;, which is used for identifying resources,  &lt;code&gt;@RequestParam&lt;/code&gt;  is mainly used for filtering, searching, and optional data inputs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;@RequestParam&lt;/code&gt; &lt;strong&gt;is used in Spring Boot to extract query parameters from the URL and bind them to method parameters for filtering, searching, or optional inputs in REST APIs.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example,  &lt;code&gt;/products?category=books&amp;amp;price=500&lt;/code&gt; uses query parameters to filter results. It is widely used in real-world applications like e-commerce for search functionality, pagination, and sorting. It also supports optional values, default values, and multiple inputs. This makes APIs more flexible without changing the endpoint structure, improving usability and scalability in production systems.&lt;/p&gt;

&lt;p&gt;In Spring Boot,  &lt;code&gt;@RequestParam&lt;/code&gt; is used to extract values from query parameters in the URL. It is commonly used when you want to pass optional or filtering data to your APIs without changing the URL structure.&lt;/p&gt;

&lt;p&gt;Let’s start with a simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@GetMapping("/users")
public String getUserById(@RequestParam Long userId) {
    return "User ID: " + userId;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a request like  &lt;code&gt;/users?userId=101&lt;/code&gt; is made, Spring maps  &lt;code&gt;101&lt;/code&gt; to the  &lt;code&gt;userId&lt;/code&gt; parameter.&lt;/p&gt;

&lt;p&gt;Now consider a real-world e-commerce scenario where users search for products:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@GetMapping("/products")
public String searchProducts(@RequestParam String category,
                             @RequestParam String sortBy) {
    return "Category: " + category + ", Sort By: " + sortBy;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example request:  &lt;code&gt;/products?category=electronics&amp;amp;sortBy=price&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can also make parameters optional:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@GetMapping("/products")
public String getProducts(@RequestParam(required = false) String category) {
    return "Category: " + category;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or provide default values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@GetMapping("/products")
public String getProducts(
    @RequestParam(defaultValue = "all") String category) {
    return "Category: " + category;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For multiple values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@GetMapping("/products/filter")
public String filterProducts(@RequestParam List&amp;lt;String&amp;gt; tags) {
    return "Tags: " + tags;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In real-world systems like CRM or booking platforms,  &lt;code&gt;@RequestParam&lt;/code&gt; is used for filtering data such as date ranges, status, pagination  &lt;code&gt;(page,&lt;/code&gt;  &lt;code&gt;size)&lt;/code&gt;, or sorting options.&lt;/p&gt;

&lt;p&gt;Best practices include keeping query parameters meaningful, using default values for better UX, validating inputs, and avoiding too many parameters in a single API.&lt;/p&gt;

&lt;p&gt;Using  &lt;code&gt;@RequestParam&lt;/code&gt; properly helps build flexible, scalable, and user-friendly APIs aligned with REST standards.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Have a great one!!!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Author:  &lt;a href="https://blog.masteringbackend.com/authors/ayush" rel="noopener noreferrer"&gt;Ayush Shrivastava&lt;/a&gt;
&lt;/h3&gt;




&lt;h2&gt;
  
  
  Thank you for being a part of the community
&lt;/h2&gt;

&lt;p&gt;Before you go:&lt;/p&gt;

&lt;h2&gt;
  
  
  Whenever you’re ready
&lt;/h2&gt;

&lt;p&gt;There are 4 ways we can help you become a great backend engineer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://masteringbackend.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Platform:&lt;/strong&gt;&lt;/a&gt;  Join thousands of backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learning and set schedules, and solve backend engineering tasks, exercises, and challenges.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://masteringbackend.com/academy?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Academy:&lt;/strong&gt;&lt;/a&gt;  The “MB Academy” is a 6-month intensive Advanced Backend Engineering Boot Camp to produce great backend engineers.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://backendweeky.dev/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Join Backend Weekly:&lt;/strong&gt;&lt;/a&gt;  If you like posts like this, you will absolutely enjoy our exclusive weekly newsletter, sharing exclusive backend engineering resources to help you become a great Backend Engineer.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://getbackendjobs.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Get Backend Jobs:&lt;/strong&gt;&lt;/a&gt;  Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>springboot</category>
      <category>reactquery</category>
      <category>backenddevelopment</category>
      <category>restapi</category>
    </item>
    <item>
      <title>Difference Between OpenAI API Key and Azure OpenAI API Key</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Mon, 20 Apr 2026 09:00:00 +0000</pubDate>
      <link>https://forem.com/masteringbackend/difference-between-openai-api-key-and-azure-openai-api-key-3j2b</link>
      <guid>https://forem.com/masteringbackend/difference-between-openai-api-key-and-azure-openai-api-key-3j2b</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5w0okmxbae99wgte7u4g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5w0okmxbae99wgte7u4g.png" alt="Difference Between OpenAI API Key and Azure OpenAI API Key" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Developers can access AI models using two main platforms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;OpenAI&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Azure OpenAI&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both provide access to similar AI models, but the way authentication and deployment work is different.&lt;/p&gt;

&lt;p&gt;In this article, we will understand the difference between OpenAI API keys and Azure OpenAI API keys.&lt;/p&gt;

&lt;h3&gt;
  
  
  OpenAI API Key
&lt;/h3&gt;

&lt;p&gt;OpenAI provides direct access to AI models through its own platform.&lt;/p&gt;

&lt;p&gt;Developers can sign up on the OpenAI website and generate an API key.&lt;/p&gt;

&lt;p&gt;Example platform:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://platform.openai.com/" rel="noopener noreferrer"&gt;https://platform.openai.com&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Steps to Get OpenAI API Key
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Login to OpenAI platform.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to  &lt;strong&gt;API Keys&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click  &lt;strong&gt;Create New Secret Key&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sk-xxxxxxxxxxxxxxxxxxxxxxxx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This key can be used directly with OpenAI APIs.&lt;/p&gt;

&lt;p&gt;Example endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://api.openai.com/v1/chat/completions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Azure OpenAI API Key
&lt;/h3&gt;

&lt;p&gt;Azure OpenAI provides OpenAI models through Microsoft Azure infrastructure.&lt;/p&gt;

&lt;p&gt;Instead of using OpenAI servers directly, the requests go through Azure services.&lt;/p&gt;

&lt;p&gt;Azure OpenAI requires:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Azure resource&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Model deployment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Endpoint&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;API key&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example API Key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xxxxxxxxxxxxxxxxxxxxxxxx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example Endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://openai-demo.openai.azure.com/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Differences
&lt;/h3&gt;

&lt;p&gt;OpenAI API&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Hosted by OpenAI&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Direct API usage&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Simple setup&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Single endpoint&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Azure OpenAI&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Hosted on Microsoft Azure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Requires resource creation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Requires model deployment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Uses Azure endpoint&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  When to Use OpenAI
&lt;/h3&gt;

&lt;p&gt;Use OpenAI when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You want quick setup&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You are building prototypes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You want direct API access&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  When to Use Azure OpenAI
&lt;/h3&gt;

&lt;p&gt;Use Azure OpenAI when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You need enterprise security&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You want Azure integration&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your organization already uses Azure cloud&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You need regional deployment&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Both OpenAI and Azure OpenAI provide access to powerful AI models.&lt;/p&gt;

&lt;p&gt;OpenAI is easier for quick development, while Azure OpenAI is better suited for enterprise applications that require scalability, security, and integration with other Azure services.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Have a great one!!!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Author: &lt;a href="https://blog.masteringbackend.com/authors/ayush" rel="noopener noreferrer"&gt;Ayush Shrivastava&lt;/a&gt;
&lt;/h3&gt;




&lt;h3&gt;
  
  
  Thank you for being a part of the community
&lt;/h3&gt;

&lt;p&gt;Before you go:&lt;/p&gt;

&lt;h3&gt;
  
  
  Whenever you’re ready
&lt;/h3&gt;

&lt;p&gt;There are 4 ways we can help you become a great backend engineer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://masteringbackend.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Platform:&lt;/strong&gt;&lt;/a&gt; Join thousands of backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learning and set schedules, and solve backend engineering tasks, exercises, and challenges.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://masteringbackend.com/academy?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Academy:&lt;/strong&gt;&lt;/a&gt; The “MB Academy” is a 6-month intensive Advanced Backend Engineering Boot Camp to produce great backend engineers.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://backendweeky.dev/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Join Backend Weekly:&lt;/strong&gt;&lt;/a&gt; If you like posts like this, you will absolutely enjoy our exclusive weekly newsletter, sharing exclusive backend engineering resources to help you become a great Backend Engineer.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://getbackendjobs.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Get Backend Jobs:&lt;/strong&gt;&lt;/a&gt; Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>openai</category>
      <category>api</category>
      <category>backenddevelopment</category>
      <category>azure</category>
    </item>
    <item>
      <title>How to Create an Azure OpenAI Resource and Deploy Your First Model.</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Fri, 17 Apr 2026 09:00:00 +0000</pubDate>
      <link>https://forem.com/masteringbackend/how-to-create-an-azure-openai-resource-and-deploy-your-first-model-5hij</link>
      <guid>https://forem.com/masteringbackend/how-to-create-an-azure-openai-resource-and-deploy-your-first-model-5hij</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm99yta2rwatuq28ga1t0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm99yta2rwatuq28ga1t0.png" alt="How to Create an Azure OpenAI Resource and Deploy Your First Model" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Azure OpenAI allows developers to use powerful AI models such as GPT-4, GPT-4o, and GPT-3.5 directly from the Azure cloud. These models can be used to build chatbots, AI assistants, content generators, and many intelligent applications.&lt;/p&gt;

&lt;p&gt;In this article, you will learn how to create an Azure OpenAI resource, deploy a model, and get the API key required to use the service in your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before starting, make sure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An Azure account&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access to the Azure Portal&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Azure OpenAI service is enabled for your subscription&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you do not have an Azure account, you can create one from the Azure website.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Create Azure OpenAI Resource
&lt;/h3&gt;

&lt;p&gt;First, you need to create an Azure OpenAI resource.&lt;/p&gt;

&lt;p&gt;Open the Azure Portal:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://portal.azure.com/" rel="noopener noreferrer"&gt;https://portal.azure.com&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Steps
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Login to the Azure Portal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the search bar, type  &lt;strong&gt;Azure OpenAI&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click  &lt;strong&gt;Create&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now fill the required fields.&lt;/p&gt;

&lt;h4&gt;
  
  
  Configuration
&lt;/h4&gt;

&lt;p&gt;Resource Group&lt;/p&gt;

&lt;p&gt;Create a new resource group or select an existing one.&lt;/p&gt;

&lt;p&gt;Region&lt;/p&gt;

&lt;p&gt;Choose a supported region such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;East US&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sweden Central&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Name&lt;/p&gt;

&lt;p&gt;Enter a unique resource name.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openai-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pricing Tier&lt;/p&gt;

&lt;p&gt;Select  &lt;strong&gt;Standard&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After filling the details:&lt;/p&gt;

&lt;p&gt;Click  &lt;strong&gt;Review + Create&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Then click  &lt;strong&gt;Create&lt;/strong&gt;  to deploy the resource.&lt;/p&gt;

&lt;p&gt;Deployment usually takes around one to two minutes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Deploy a Model
&lt;/h3&gt;

&lt;p&gt;Once the resource is created, you need to deploy a model.&lt;/p&gt;

&lt;h4&gt;
  
  
  Steps
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open the Azure OpenAI resource you created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the left menu, click  &lt;strong&gt;Model Deployments&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click  &lt;strong&gt;Deploy Model&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now select a model.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recommended Models
&lt;/h3&gt;

&lt;p&gt;For most applications, these models work well:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;gpt-4o-mini&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fast and cost efficient model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;gpt-35-turbo&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Popular chat model.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deployment Configuration
&lt;/h3&gt;

&lt;p&gt;Model&lt;/p&gt;

&lt;p&gt;Select the model you want.&lt;/p&gt;

&lt;p&gt;Deployment Name&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gpt-4o-mini
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click  &lt;strong&gt;Deploy&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Azure will now create the model deployment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Get API Credentials
&lt;/h3&gt;

&lt;p&gt;To call the Azure OpenAI API from your application, you need an API key and endpoint.&lt;/p&gt;

&lt;h4&gt;
  
  
  Steps
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open the Azure OpenAI resource.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click  &lt;strong&gt;Keys and Endpoint&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You will see the following information.&lt;/p&gt;

&lt;p&gt;API Key 1&lt;/p&gt;

&lt;p&gt;API Key 2&lt;/p&gt;

&lt;p&gt;Endpoint&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;API KEY
xxxxxxxxxxxxxxxxxxxxxxxx

ENDPOINT
https://openai-demo.openai.azure.com/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can use either  &lt;strong&gt;Key 1 or Key 2&lt;/strong&gt;  in your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example API Endpoint
&lt;/h3&gt;

&lt;p&gt;Your application will send requests to the endpoint.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://openai-demo.openai.azure.com/openai/deployments/gpt-4o-mini/chat/completions?api-version=2024-02-15-preview
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your request must include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;API Key&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Endpoint&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deployment Name&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Azure OpenAI makes it easy to use powerful AI models in enterprise applications. The basic process involves three steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create an Azure OpenAI resource&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deploy a model such as gpt-4o-mini&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get API credentials and endpoint&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once these steps are completed, you can start building AI-powered applications using Azure OpenAI.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Have a great one!!!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Author: &lt;a href="https://blog.masteringbackend.com/authors/ayush" rel="noopener noreferrer"&gt;Ayush Shrivastava&lt;/a&gt;
&lt;/h3&gt;




&lt;h3&gt;
  
  
  Thank you for being a part of the community
&lt;/h3&gt;

&lt;p&gt;Before you go:&lt;/p&gt;

&lt;h3&gt;
  
  
  Whenever you’re ready
&lt;/h3&gt;

&lt;p&gt;There are 4 ways we can help you become a great backend engineer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://masteringbackend.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Platform:&lt;/strong&gt;&lt;/a&gt; Join thousands of backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learning and set schedules, and solve backend engineering tasks, exercises, and challenges.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://masteringbackend.com/academy?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Academy:&lt;/strong&gt;&lt;/a&gt; The “MB Academy” is a 6-month intensive Advanced Backend Engineering Boot Camp to produce great backend engineers.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://backendweeky.dev/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Join Backend Weekly:&lt;/strong&gt;&lt;/a&gt; If you like posts like this, you will absolutely enjoy our exclusive weekly newsletter, sharing exclusive backend engineering resources to help you become a great Backend Engineer.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://getbackendjobs.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Get Backend Jobs:&lt;/strong&gt;&lt;/a&gt; Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>openai</category>
      <category>restapi</category>
      <category>backenddevelopment</category>
      <category>azure</category>
    </item>
    <item>
      <title>Mastering @PathVariable in Spring Boot</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Thu, 16 Apr 2026 10:00:30 +0000</pubDate>
      <link>https://forem.com/masteringbackend/mastering-pathvariable-in-spring-boot-9f1</link>
      <guid>https://forem.com/masteringbackend/mastering-pathvariable-in-spring-boot-9f1</guid>
      <description>&lt;p&gt;&lt;a href="https://blog.masteringbackend.com/authors/ayush" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffk5ojfvcn7yi5kp4p36k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffk5ojfvcn7yi5kp4p36k.png" alt="Mastering @PathVariable in Spring Boot" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Learn how to use  &lt;code&gt;@PathVariable&lt;/code&gt; in Spring Boot to build clean and RESTful APIs with practical examples from real-world scenarios like users, products, and orders.&lt;/p&gt;
&lt;h4&gt;
  
  
  What is  &lt;code&gt;@PathVariable&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;@PathVariable&lt;/code&gt; in Spring Boot is an annotation used to bind values from the URL directly to method parameters in a controller. It is mainly used in REST APIs where resources are identified using hierarchical URLs. For example, in  &lt;code&gt;/users/101,&lt;/code&gt;  the value  &lt;code&gt;101&lt;/code&gt; represents a specific user and is captured using  &lt;code&gt;@PathVariable.&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;@PathVariable&lt;/code&gt; is used in Spring Boot to extract values from the URL path and bind them to method parameters to identify specific resources in REST APIs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It differs from query parameters because it is part of the URL path, making APIs more readable and meaningful. In real-world systems like e-commerce or CRM, it is commonly used to fetch specific records, such as a user, product, or order, by ID. It also supports multiple values and even dynamic mapping using a Map structure when needed.&lt;/p&gt;

&lt;p&gt;In Spring Boot,  &lt;code&gt;@PathVariable&lt;/code&gt; is used to extract dynamic values from the URL. It helps in designing RESTful APIs where resources are clearly identified using URL paths instead of query parameters.&lt;/p&gt;

&lt;p&gt;Let’s start with a simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@GetMapping("/users/{userId}")
public String getUser(@PathVariable Long userId) {
    return "User ID: " + userId;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a request like  &lt;code&gt;/users/101&lt;/code&gt; is made, Spring automatically maps  &lt;code&gt;101&lt;/code&gt; to the  &lt;code&gt;userId&lt;/code&gt; variable.&lt;/p&gt;

&lt;p&gt;Now consider a real-world scenario in an e-commerce system where a user wants to view a specific product:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@GetMapping("/users/{userId}/products/{productId}")
public String getUserProduct(@PathVariable Long userId,
                             @PathVariable Long productId) {
    return "User: " + userId + ", Product: " + productId;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This makes the API intuitive and readable.&lt;/p&gt;

&lt;p&gt;You can also customize variable names:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@GetMapping("/users/{userId}/orders/{orderId}")
public String getOrder(@PathVariable(name = "userId") Long id,
                       @PathVariable Long orderId) {
    return "User: " + id + ", Order: " + orderId;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For dynamic cases, you can use a Map:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@GetMapping("/users/{userId}/address/{addressId}")
public String getAddress(@PathVariable Map&amp;lt;String, String&amp;gt; pathVars) {
    return "User: " + pathVars.get("userId") +
           ", Address: " + pathVars.get("addressId");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use our &lt;a href="https://playground.masteringbackend.com/javascript/?ref=masteringbackend&amp;amp;utm_source=masteringbackend&amp;amp;utm_medium=custom_code_editor&amp;amp;utm_campaign=blog-post" rel="noopener noreferrer"&gt;Online Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is useful when handling flexible URLs.&lt;/p&gt;

&lt;p&gt;In real-world applications like CRM or booking systems,  &lt;code&gt;@PathVariable&lt;/code&gt; is used to fetch user details, order history, or product information based on unique identifiers.&lt;/p&gt;

&lt;p&gt;Best practices include using meaningful variable names, avoiding too many path variables in one endpoint, and validating inputs properly. Also, prefer strongly typed variables over Map when possible.&lt;/p&gt;

&lt;p&gt;Using  &lt;code&gt;@PathVariable&lt;/code&gt; correctly improves API clarity, maintainability, and aligns with REST standards followed in production-grade applications.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Have a great one!!!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Author: &lt;a href="https://blog.masteringbackend.com/authors/ayush" rel="noopener noreferrer"&gt;Ayush Shrivastava&lt;/a&gt;
&lt;/h3&gt;




&lt;h3&gt;
  
  
  Thank you for being a part of the community
&lt;/h3&gt;

&lt;p&gt;Before you go:&lt;/p&gt;

&lt;h3&gt;
  
  
  Whenever you’re ready
&lt;/h3&gt;

&lt;p&gt;There are 4 ways we can help you become a great backend engineer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://masteringbackend.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Platform:&lt;/strong&gt;&lt;/a&gt; Join thousands of backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learning and set schedules, and solve backend engineering tasks, exercises, and challenges.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://masteringbackend.com/academy?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Academy:&lt;/strong&gt;&lt;/a&gt; The “MB Academy” is a 6-month intensive Advanced Backend Engineering Boot Camp to produce great backend engineers.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://backendweeky.dev/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Join Backend Weekly:&lt;/strong&gt;&lt;/a&gt; If you like posts like this, you will absolutely enjoy our exclusive weekly newsletter, sharing exclusive backend engineering resources to help you become a great Backend Engineer.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://getbackendjobs.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Get Backend Jobs:&lt;/strong&gt;&lt;/a&gt; Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>restapis</category>
      <category>backenddeveloper</category>
      <category>springboot</category>
      <category>pathvariable</category>
    </item>
    <item>
      <title>TOP 5 Books Every Backend Developer Should Read</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Fri, 10 Apr 2026 10:00:30 +0000</pubDate>
      <link>https://forem.com/masteringbackend/top-5-books-every-backend-developer-should-read-3i3g</link>
      <guid>https://forem.com/masteringbackend/top-5-books-every-backend-developer-should-read-3i3g</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fal3fbvi2vt6jwd0awm6d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fal3fbvi2vt6jwd0awm6d.png" alt="title" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The world of software development is fast-paced. If you glance away to pet your cat too long, you may miss the next big framework or tool. For instance, JavaScript, one of the most popular programming languages in the world, is notorious for pushing out new frameworks as often as a developer has a bad day , which happens more often than you may think. Because of this, many developers need to get information quickly, and the best mediums to get that information come in the form of short-form videos, quick articles, and snappy courses. While we can appreciate the roles these play in keeping us up to speed with development trends, it’s still crucial to settle in with a good book once in a while.&lt;/p&gt;

&lt;p&gt;Some development books may seem intimidating judging by volume alone, but the treasures they hold within are timeless. Usually, what separates good developers from average developers is how much time they are willing to read between the lines and understand the underlying concepts that run programs, so they can be more efficient at solving problems. If you’d like to be the best backend developer you could be, have a look at these top five books backend developers should read that’ll be sure to take you to the next level of your career.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. &lt;a href="https://www.amazon.com/Designing-Data-Intensive-Applications-Reliable-Maintainable/dp/1449373321" rel="noopener noreferrer"&gt;Designing Data-Intensive Applications by Martin Kleppmann&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlksyoxgjb6ugam7a4as.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlksyoxgjb6ugam7a4as.jpg" alt="book1" width="800" height="1050"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This book is a classic for those seeking to understand how data works and is handled by applications. It dives into ways to optimize data, so you produce programs that retrieve and use data quickly and efficiently.&lt;/p&gt;

&lt;p&gt;Here, you’ll be looking into database storage and trade-offs that exist between different data technologies. It introduces these core trade-offs in distributed systems like consistency, availability, and scalability, which shape how real-world backend systems are designed. As a backend developer, dealing with data constantly, this book is a must-have and will help you explore the fundamental principles of data systems.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. &lt;a href="https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=sr_1_1?crid=18P7O2XUMNHDT&amp;amp;dib=eyJ2IjoiMSJ9.G6SRByFrwqob6KQdRTDbl81VKTwojNrO2p3dvKOrV5HnjmLk2c5W8wrKiK5ot4A2_kKFGChl4MDAgKrAITsKGKzvb48MymC2fBPoPu8TbROhSOAWEcEpnNJj82Zz_z3QwgIRtCmp7kcsqw9EXKtNA-dx8cpIn03PBmFiiy25yHUuVQjcpOD9aOvO6sNDofGVS2vpgtb54RCXRMGK9jg6tnYcM3hKXR9ts-E3PkBS95E.sGiZdyjAsKdxOfqVdr5zVHra6sbqq_eXW4W4NupoVoU&amp;amp;dib_tag=se&amp;amp;keywords=clean+code+by+robert+c.+martin&amp;amp;qid=1774802512&amp;amp;s=books&amp;amp;sprefix=clean+code+%2Cstripbooks-intl-ship%2C355&amp;amp;sr=1-1" rel="noopener noreferrer"&gt;Clean Code by Robert C. Martin&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fese3d47xxt958kxm4vx0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fese3d47xxt958kxm4vx0.jpg" alt="book2" width="800" height="1060"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clean code is a tricky subject. After a few years in development, you realize that there are certain standards that must be upheld in your code, but you also become aware that these same standards and best practices are not set in stone and may be broken on occasion. An example is the DRY principle. You may know that repeating code is bad practice, but would you stick to this rule so much, at the expense of readable code? That’s where Clean Code by Robert C. Martin saves the day. It dives into such questions and explains what it truly means for code to be clean.&lt;/p&gt;

&lt;p&gt;Robert’s book emphasizes that writing clean code isn’t about unbending rules, but about making thoughtful decisions in matters of readability, maintainability, and practicality.&lt;/p&gt;

&lt;p&gt;You’ll learn about writing code that is &lt;a href="https://www.docuwriter.ai/posts/ultimate-guide-self-documenting-code" rel="noopener noreferrer"&gt;self-documenting&lt;/a&gt;, keeping functions focused on one thing and other such rules for maintainable, readable and modular code. Rid yourself of code smells, and get a copy.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. &lt;a href="https://www.amazon.com/Cracking-Coding-Interview-Programming-Questions/dp/0984782850/ref=sr_1_1?crid=2G5GEGENFI1FW&amp;amp;dib=eyJ2IjoiMSJ9.nj6XTCgbP7Ay4ig5zGU-o9OB8p-raRuETwl6G824MZwno93RxDTkpPMlKADkJwM_XWBpo9PWoT6eDDRBzPzJDV8VrJ_C7k4HDFz0cBvV0l3eMXG6q8dhBEhUDCiVAnx7293t3r7JngT1CFCtmu5fPuWJekgzMCwFNJQJU4NejqHFXpWeOOxteC3KorKgB7GX7waTgH_I9vdpxSRpAj2tAWZlmh_6p-JTp5nw78k-ZFc.ItkA6RSPjG5pM4lcfJEZ73W-velIx5yxE7UzfI2vGhE&amp;amp;dib_tag=se&amp;amp;keywords=cracking+the+coding+interview&amp;amp;qid=1774802584&amp;amp;s=books&amp;amp;sprefix=cracking+the+coding+inter%2Cstripbooks-intl-ship%2C360&amp;amp;sr=1-1" rel="noopener noreferrer"&gt;Cracking the Coding Interview by Gayle Laakmann McDowell&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5z1qy2ufcj5ouu7t7ju.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5z1qy2ufcj5ouu7t7ju.jpg" alt="book3" width="800" height="1143"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Coding interviews are not a walk in the park. In some cases, the questions you may face in a technical interview may seem quite abstract and sometimes a bit different from what you deal with at work in your day-to-day. If you’re thinking of taking a bold step into job searching, this book is a classic and a must-have in your preparation attempts.&lt;/p&gt;

&lt;p&gt;Beyond just practicing interview questions, it’ll help you build a problem-solving mindset. Solve over 180 coding questions and find yourself walking confidently in and out of technical interviews.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. &lt;a href="https://www.amazon.com/Fundamentals-Software-Architecture-Engineering-Approach/dp/1098175514/ref=sr_1_1?crid=380NCLIK32RC9&amp;amp;dib=eyJ2IjoiMSJ9.aPA9gmJ_iYGRhv2bX2MYcxCGcgaFxdonRx9927J4MKuqj1aiXFXWxM-RvPctQ5rN-r4h_0shcPuBilCnfjqqad8RkKN6kX-Q8XxFyN_ny21a9eyiubebjXqvMPhgh-5D2_HQyImrq1dpZ_LF5ouEqCWkEtY3XCbTo2rP9qDp_AReADqD2wP3eoNL1OKQGqTC4ibWTsQ6PSkM0ja7hYHMv0Yw70GCyJ6FdaVdywxhcQw.MjkjR-jDh0dylF462_ViUwEqr3By-t9CSszYcx0fa0E&amp;amp;dib_tag=se&amp;amp;keywords=fundamentals+of+software+architecture&amp;amp;qid=1774802663&amp;amp;s=books&amp;amp;sprefix=fundamentals+of+software+architecture%2Cstripbooks-intl-ship%2C348&amp;amp;sr=1-1" rel="noopener noreferrer"&gt;Fundamentals of Software Architecture by Richard and Ford&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F04fjy9ylel10my79bfd4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F04fjy9ylel10my79bfd4.jpg" alt="book 4" width="800" height="1050"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This book is a haven for those seeking a good introduction to Software Architecture fundamentals. It discusses eight architectural styles, each with detailed explanations. It explains how different architectural styles impact system performance, scalability, and maintainability, which are key concerns in backend development. It could serve as a great handbook and source material for all things architecture-related.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. &lt;a href="https://www.amazon.com/Grokking-Algorithms-Second-Aditya-Bhargava/dp/1633438538/ref=sr_1_1?crid=1BO6JSEA1BHQN&amp;amp;dib=eyJ2IjoiMSJ9.udKCRwfqvqqXcW7DFKotFoK3jLzxS09orNAGvMOeslxdic8UqaMG0HL2Hy-C2vNtl9v6Fm1-Jf10NAQ1w1gsqa5xeX0T_xVbgL_eIy7iB9ud6rMrCFOmNz1qz_1HV-rWlcn9mkvHCsQ-L6UnhbLTrJeRq3sqpYB0UC-9REhTLwuOpexpo6aFFwOSlueTAyP05Joj4QTIqfzPgdURRQ7Vj46kWhxLAN1kotW90zwBynw.mv7FuyR3UUpezSTpXwGIVBjeA7agZeG_Zhpdg__Oolo&amp;amp;dib_tag=se&amp;amp;keywords=grokking+algorithms&amp;amp;qid=1774802724&amp;amp;s=books&amp;amp;sprefix=grokking+alg%2Cstripbooks-intl-ship%2C690&amp;amp;sr=1-1" rel="noopener noreferrer"&gt;Grokking Algorithms by Aditya Bhargava&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqd2c79rhk8ifmyrsabat.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqd2c79rhk8ifmyrsabat.jpg" alt="book5" width="800" height="1002"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This book is a delight. It makes algorithms easier to follow and visual learners would benefit greatly from the illustrations. In it, Aditya simplifies concepts like &lt;a href="https://dev.to/gr8soln/mastering-time-and-space-complexity-a-beginners-guide-to-big-o-notation-33ae"&gt;Big O Notation&lt;/a&gt;, recursion and dynamic programming.&lt;/p&gt;

&lt;p&gt;On reading this book, you’ll realize soon enough that it makes complex algorithmic concepts intuitive, helping developers understand not just how solutions work, but why they work. The author makes these rather abstract concepts easier to mentally navigate with his witty and brilliant writing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The above are just a few of many interesting and amazing books that will keep you deeply engaged. While some of the books on this list aren’t specifically targeted at backend developers, they are great to have in your library as they concern general coding best practices and critical thinking.&lt;/p&gt;

&lt;p&gt;Why not pick up a book today? Perhaps lose yourself in the whimsical world of Grokking Algorithms, be amazed by how Martin Kleppman explains the secret recipes needed in designing data-intensive applications, or carefully observe and craft your methods after reading Robert C. Martin’s Clean Code.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Have a great one!!!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Author: &lt;a href="https://blog.masteringbackend.com/authors/lonercode" rel="noopener noreferrer"&gt;Amanda Ene Adoyi&lt;/a&gt;
&lt;/h3&gt;




&lt;h3&gt;
  
  
  Thank you for being a part of the community
&lt;/h3&gt;

&lt;p&gt;Before you go:&lt;/p&gt;

&lt;h3&gt;
  
  
  Whenever you’re ready
&lt;/h3&gt;

&lt;p&gt;There are 4 ways we can help you become a great backend engineer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Platform:&lt;/strong&gt;&lt;/a&gt; Join thousands of backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learning and set schedules, and solve backend engineering tasks, exercises, and challenges.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/academy?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Academy:&lt;/strong&gt;&lt;/a&gt; The “MB Academy” is a 6-month intensive Advanced Backend Engineering Boot Camp to produce great backend engineers.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://backendweeky.dev/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Join Backend Weekly:&lt;/strong&gt;&lt;/a&gt; If you like posts like this, you will absolutely enjoy our exclusive weekly newsletter, sharing exclusive backend engineering resources to help you become a great Backend Engineer.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://getbackendjobs.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Get Backend Jobs:&lt;/strong&gt;&lt;/a&gt; Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://blog.masteringbackend.com/top-5-books-every-backend-developer-should-read" rel="noopener noreferrer"&gt;&lt;em&gt;https://blog.masteringbackend.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>reading</category>
      <category>backenddeveloper</category>
      <category>backend</category>
      <category>booksrecommendation</category>
    </item>
    <item>
      <title>Persistent Chat History with Database Design (Practical Example)</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Thu, 09 Apr 2026 10:00:30 +0000</pubDate>
      <link>https://forem.com/masteringbackend/persistent-chat-history-with-database-design-practical-example-33da</link>
      <guid>https://forem.com/masteringbackend/persistent-chat-history-with-database-design-practical-example-33da</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8h76hv0xe9a0wudsa54d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8h76hv0xe9a0wudsa54d.png" alt="title" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Chat applications look simple on the surface when you look at them. But behind every smooth conversation, there is a system that stores, retrieves, and manages messages efficiently.&lt;/p&gt;

&lt;p&gt;What makes modern apps usable is the persistent chat history. A lot of users would expect conversations to load instantly, stay in order, and remain available across all their devices; that only works when the database design is done in the right way.&lt;/p&gt;

&lt;p&gt;This guide focuses on how persistent chat history works in a real system, and how conversations, users, and messages are structured step by step to keep your application responsive, organized, and ready for real-world use.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example Schema for a Chat Application
&lt;/h3&gt;

&lt;p&gt;To ensure you have a strong chat schema, you must begin with three main entities: users, conversations, and messages. Keeping these entities separate makes the system easier to scale, query, and maintain.&lt;/p&gt;

&lt;p&gt;At the very least, you need a users table or collection that helps store identity and basic profile data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"user_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"u123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"john_doe"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"created_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-01-01T10:00:00Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next is the conversations entity &lt;strong&gt;,&lt;/strong&gt; which represents the chat thread between two or more users. It acts as the container for messages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"conversation_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c456"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"participants"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"u123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"u789"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"created_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-01-01T10:05:00Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This structure allows group chats and one-on-one chats without changing the schema.&lt;/p&gt;

&lt;p&gt;The most important part is the messages entity. Each message belongs to a conversation and a sender, which is where most queries will happen, and it’s meant to be designed carefully.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"m001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"conversation_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c456"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"sender_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"u123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hello, how are you?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-01-01T10:06:00Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Always include a timestamp; the ordering of the message depends on it. Also, having a relational database can be translated into three tables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;users (user_id, username, created_at)&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;conversations (conversation_id, created_at)&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;messages (message_id, conversation_id, sender_id, content, timestamp)&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A joint table like &lt;strong&gt;&lt;em&gt;conversation_participants&lt;/em&gt;&lt;/strong&gt; is always needed to map users to conversations:&lt;/p&gt;

&lt;p&gt;This helps to avoid duplicating participant data and keeps relationships flexible.&lt;/p&gt;

&lt;p&gt;Create indexes on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;conversation_id i&lt;/em&gt;&lt;/strong&gt; n the messages table for fast retrieval&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;timestamp&lt;/em&gt;&lt;/strong&gt; for ordered queries&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;sender_id&lt;/em&gt;&lt;/strong&gt; for filtering user messages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Not having a proper index can lead to the chat queries slowing down quickly as soon as data grows.&lt;/p&gt;

&lt;p&gt;And for NoSQL databases like MongoDB, you can use a similar structure with collections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;users&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;conversations&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;messages&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Or you can embed messages inside conversations for smaller apps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"conversation_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c456"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"participants"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"u123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"u789"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"messages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"sender_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"u123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hello"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-01-01T10:06:00Z"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Embedding works well for smaller volume chats. For high-scale systems, you’ll need to separate message collections to improve performance.&lt;/p&gt;

&lt;p&gt;Add optional fields to support real-world features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;status&lt;/em&gt;&lt;/strong&gt; (sent, delivered, read)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;edited_at&lt;/em&gt;&lt;/strong&gt; (for message edits)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;deleted_at&lt;/em&gt;&lt;/strong&gt; (for soft deletes)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;attachments&lt;/em&gt;&lt;/strong&gt; (for media support)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keeping the schema flexible is important, but try as much as possible to avoid overloading it early. Start simple and extend only when needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sample Data Model for Conversations and Messages
&lt;/h3&gt;

&lt;p&gt;Having a good data model defines how conversations and messages relate, how they are queried, and how they scale under load.&lt;/p&gt;

&lt;p&gt;Start with a conversation-centric model. Every message belongs to a conversation, and every conversation has participants.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"conversation_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"group"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"participants"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"u1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"u2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"u3"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"last_message_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"m045"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"created_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-01-01T10:00:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"updated_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-01-01T10:10:00Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;&lt;em&gt;last_message_id&lt;/em&gt;&lt;/strong&gt; is important because it allows quick previews without scanning all the messages, and that is how chat lists load fast in real apps.&lt;/p&gt;

&lt;p&gt;Let’s now define the message model. Each message is stored independently and linked to its conversation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"m045"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"conversation_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"sender_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"u2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Let’s deploy today"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-01-01T10:09:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"delivered"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Avoid updating message content frequently; it keeps the system predictable.&lt;/p&gt;

&lt;p&gt;Add a sequence or ordering field when strict ordering is required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"sequence": 45
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Timestamps can collide in high-throughput systems, and a sequence number guarantees correct ordering, especially in distributed setups.&lt;/p&gt;

&lt;p&gt;For relational databases, the model translates into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;conversations&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;messages&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;participants&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each table has a clear role. Queries stay simple and efficient.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;messages&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;conversation_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'c001'&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="nb"&gt;timestamp&lt;/span&gt; &lt;span class="k"&gt;ASC&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In NoSQL systems, the model is somewhat similar but optimized for access patterns. Messages stay in a separate collection for scalability, and conversations store lightweight metadata only.&lt;/p&gt;

&lt;p&gt;For high-performance systems, denormalization helps to store frequently accessed data, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;last message content&lt;/li&gt;
&lt;li&gt;unread message count&lt;/li&gt;
&lt;li&gt;last active timestamp&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;directly in the conversation object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"conversation_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"last_message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Let’s deploy today"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"unread_count"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"u1"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"u3"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This avoids expensive joins or aggregations during reads.&lt;/p&gt;

&lt;p&gt;Designing for pagination from the start is very important. Offset-based pagination tends to break at scale. Use cursor-based pagination instead, typically with &lt;strong&gt;&lt;em&gt;timestamp or&lt;/em&gt;&lt;/strong&gt;  &lt;strong&gt;&lt;em&gt;message_id.&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /messages?conversation_id=c001&amp;amp;before=m045&amp;amp;limit=20
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps queries fast even with millions of messages.&lt;/p&gt;

&lt;p&gt;Also, support additional fields without breaking the model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;attachments&lt;/em&gt;&lt;/strong&gt; for media&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;reply_to&lt;/em&gt;&lt;/strong&gt; for threaded replies&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;metadata&lt;/em&gt;&lt;/strong&gt; for AI-generated context or tags&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Having a clean data model balances structure and flexibility. When conversations and messages are modeled correctly, the performance, scaling, and feature development become easier to manage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Writing and Reading Chat Messages Step by Step
&lt;/h3&gt;

&lt;p&gt;Writing and reading chat messages are meant to be simple, fast, and consistent. Every step taken must be predictable, especially when under high traffic.&lt;/p&gt;

&lt;p&gt;When a user sends a message, the system receives a request with key fields like &lt;strong&gt;&lt;em&gt;conversation_id,&lt;/em&gt;&lt;/strong&gt;  &lt;strong&gt;&lt;em&gt;sender_id, and&lt;/em&gt;&lt;/strong&gt;  &lt;strong&gt;&lt;em&gt;content.&lt;/em&gt;&lt;/strong&gt; It validates these inputs first, then rejects empty messages or invalid conversation IDs early.&lt;/p&gt;

&lt;p&gt;It also generates a unique &lt;strong&gt;&lt;em&gt;message_id&lt;/em&gt;&lt;/strong&gt;. which can be a UUID or a database-generated ID, and also attaches a &lt;strong&gt;&lt;em&gt;timestamp&lt;/em&gt;&lt;/strong&gt; and, if needed, a &lt;strong&gt;&lt;em&gt;sequence&lt;/em&gt;&lt;/strong&gt; value for strict ordering.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"m101"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"conversation_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"sender_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"u1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Message received"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-01-01T10:15:00Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then insert the message into the database.&lt;/p&gt;

&lt;p&gt;In a relational database, wrap it in a transaction if multiple tables are updated, while in NoSQL systems, ensure the write is acknowledged before proceeding. Be sure to update the conversation metadata immediately after.&lt;/p&gt;

&lt;p&gt;This typically includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;last_message_id&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;last_message&lt;/em&gt;&lt;/strong&gt; optional preview&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;updated_at&lt;/em&gt;&lt;/strong&gt; timestamp&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This ensures that the chat lists reflect the latest activity without querying the messages table.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;conversations&lt;/span&gt;
&lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;last_message_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'m101'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;updated_at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;NOW&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;conversation_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'c001'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the system supports unread counts, then the increment counters for other participants. This helps to reduce the recalculating counts during reads.&lt;/p&gt;

&lt;p&gt;The most common operation is fetching messages for a conversation. Always send a query using &lt;strong&gt;&lt;em&gt;conversation_id&lt;/em&gt;&lt;/strong&gt; and sort by &lt;strong&gt;&lt;em&gt;timestamp&lt;/em&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;em&gt;sequence.&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;messages&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;conversation_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'c001'&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="nb"&gt;timestamp&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make use of pagination and never load all messages at once.&lt;/p&gt;

&lt;p&gt;Cursor-based pagination works best at scale. Instead of offsets, be sure to use a reference point like &lt;strong&gt;&lt;em&gt;message_id or&lt;/em&gt;&lt;/strong&gt;  &lt;strong&gt;&lt;em&gt;timestamp.&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /messages?conversation_id=c001&amp;amp;before=2026-01-01T10:15:00Z&amp;amp;limit=20
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps performance stable even with a large dataset.&lt;/p&gt;

&lt;p&gt;Be sure to reverse the result set on the client if needed. Most databases tend to return recent messages first for efficiency.&lt;/p&gt;

&lt;p&gt;After writing a message, publish an event (via WebSocket or message queue). It helps to push new messages to connected clients without polling the database.&lt;/p&gt;

&lt;p&gt;Ensure that writes are visible to reads immediately or within an acceptable delay. Efficient write and read paths are the pillar of any chat system. If any of these steps are optimized, the whole messaging experience feels instant and reliable even as the data grows.&lt;/p&gt;

&lt;h3&gt;
  
  
  Optimizing Queries for Real-Time Chat Apps
&lt;/h3&gt;

&lt;p&gt;Real-time chat performance depends heavily on how the queries are written and how they are being executed. Slow queries lead to delayed messages, laggy interfaces, and poor user experience.&lt;/p&gt;

&lt;p&gt;The most important query in any chat app is fetching messages by &lt;strong&gt;&lt;em&gt;conversation_id.&lt;/em&gt;&lt;/strong&gt; Without an index, this becomes a full table or collection scan.&lt;/p&gt;

&lt;p&gt;Create indexes on:&lt;/p&gt;

&lt;p&gt;Example, in SQL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_conversation_timestamp&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;messages&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;conversation_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;timestamp&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows fast retrieval of recent messages without scanning the entire dataset.&lt;/p&gt;

&lt;p&gt;Only select the fields needed for rendering messages. Pulling large payloads (like attachments or metadata) when not required increases latency and memory usage.&lt;/p&gt;

&lt;p&gt;Smaller result sets mean faster queries.&lt;/p&gt;

&lt;p&gt;Offset queries tend to slow down as data grows because the database still scans skipped rows.&lt;/p&gt;

&lt;p&gt;Bad approach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="k"&gt;OFFSET&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Better approach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="nb"&gt;timestamp&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="s1"&gt;'2026-01-01T10:15:00Z'&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="nb"&gt;timestamp&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps the performances consistent, even with millions of messages.&lt;/p&gt;

&lt;p&gt;Chat lists and recent messages are requested often. Use in-memory stores like Redis to cache:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Last messages per conversation&lt;/li&gt;
&lt;li&gt;unread counts&lt;/li&gt;
&lt;li&gt;active conversation lists&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This reduces the database load and improves the response time.&lt;/p&gt;

&lt;p&gt;Instead of joining multiple tables for every request, store frequently needed fields directly in the conversation record, and if multiple conversations need to be loaded, fetch them in a single query instead of multiple round-trip requests.&lt;/p&gt;

&lt;p&gt;Always filter by &lt;strong&gt;&lt;em&gt;conversation_id&lt;/em&gt;&lt;/strong&gt; or user context. Unbounded queries tend to increase load and expose unnecessary data.&lt;/p&gt;

&lt;p&gt;A query that works with 1,000 messages may fail at 1 million. So be sure to simulate large datasets early to identify bottlenecks before they reach production.&lt;/p&gt;

&lt;p&gt;When queries are optimized, messages load instantly, scrolling feels smooth, and the system scales without you constantly rewriting it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Have a great one!!!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Author: &lt;a href="https://blog.masteringbackend.com/authors/Toluwanimi" rel="noopener noreferrer"&gt;Toluwanimi Fawole&lt;/a&gt;
&lt;/h3&gt;




&lt;h3&gt;
  
  
  Thank you for being a part of the community
&lt;/h3&gt;

&lt;p&gt;Before you go:&lt;/p&gt;

&lt;h3&gt;
  
  
  Whenever you’re ready
&lt;/h3&gt;

&lt;p&gt;There are 4 ways we can help you become a great backend engineer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Platform:&lt;/strong&gt;&lt;/a&gt; Join thousands of backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learning and set schedules, and solve backend engineering tasks, exercises, and challenges.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/academy?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Academy:&lt;/strong&gt;&lt;/a&gt; The “MB Academy” is a 6-month intensive Advanced Backend Engineering Boot Camp to produce great backend engineers.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://backendweeky.dev/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Join Backend Weekly:&lt;/strong&gt;&lt;/a&gt; If you like posts like this, you will absolutely enjoy our exclusive weekly newsletter, sharing exclusive backend engineering resources to help you become a great Backend Engineer.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://getbackendjobs.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Get Backend Jobs:&lt;/strong&gt;&lt;/a&gt; Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://blog.masteringbackend.com/persistent-chat-history-with-database-design-practical-example" rel="noopener noreferrer"&gt;&lt;em&gt;https://blog.masteringbackend.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>backenddevelopment</category>
      <category>database</category>
      <category>backend</category>
      <category>databasedesign</category>
    </item>
    <item>
      <title>Authentication &amp; Session Management for AI Apps</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Wed, 08 Apr 2026 10:00:30 +0000</pubDate>
      <link>https://forem.com/masteringbackend/authentication-session-management-for-ai-apps-1g68</link>
      <guid>https://forem.com/masteringbackend/authentication-session-management-for-ai-apps-1g68</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ncr8qtlz4vemy6dhsft.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ncr8qtlz4vemy6dhsft.png" alt="title" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AI applications don’t just help to process data; they interact with users, agents, and external services. This could either be a human user logging into a chatbot or an AI agent calling another service. Without having proper authentication, AI APIs become vulnerable to misuse or unauthorized access.&lt;/p&gt;

&lt;p&gt;When users log into an AI-powered product, the system needs to verify identity, manage access permissions, and maintain conversation or activity sessions, which is important for AI apps that handle chat interactions, autonomous agents, or high-volume API requests.&lt;/p&gt;

&lt;p&gt;This guide breaks down how authentication works in AI applications and how to manage sessions securely at scale.&lt;/p&gt;

&lt;h3&gt;
  
  
  API Key Authentication for AI Services
&lt;/h3&gt;

&lt;p&gt;API key authentication is one of the most common ways to secure AI services and machine learning APIs, and it works by assigning a unique key to each client, application, or developer account. Every request sent to the AI service must include the key so the server can verify access.&lt;/p&gt;

&lt;p&gt;The API key acts as a simple credential, and when a request reaches the server, the service checks the key against the stored records. If the key is valid, the request proceeds to the AI model or processing pipeline.&lt;/p&gt;

&lt;p&gt;A typical example looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;POST /v1/inference
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some APIs accept the key through a custom header:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;x-api-key: YOUR_API_KEY
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once it has been verified, the service processes the request and returns the model output.&lt;/p&gt;

&lt;p&gt;API keys are widely used in AI platforms because they are very easy to generate, distribute, and revoke. This makes them a practical option for developer-facing AI services, internal microservices, and early-stage AI products.&lt;/p&gt;

&lt;p&gt;They are mostly common in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Machine learning inference APIs&lt;/li&gt;
&lt;li&gt;AI-powered developer platforms&lt;/li&gt;
&lt;li&gt;internal AI microservices communicating with each other&lt;/li&gt;
&lt;li&gt;automation tools that interact with AI endpoints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security practices matter a lot when using API keys. Keys should never be stored in client-side code or a public repository. Exposing a key in frontend JavaScript or committing it to version control makes it easy for attackers to copy and misuse.&lt;/p&gt;

&lt;p&gt;Instead of doing that, store the keys in environment variables or secure a configuration system whereby whenever a backend service needs the key, it retrieves it from the environment rather than hardcoding it.&lt;/p&gt;

&lt;p&gt;Key rotation is very important; generating new keys and deactivating old ones reduces long-term risk if a credential leaks. And if a compromised key suddenly generates thousands of requests per minute, the system should throttle or temporarily block the activity.&lt;/p&gt;

&lt;p&gt;Despite their simplicity, API keys have limitations, and they identify the calling application but do not inherently represent a user identity or permission scope, simply because a lot of production AI platforms combine API keys with additional security layers such as usage quotas, IP restrictions, or token-based authentication.&lt;/p&gt;

&lt;p&gt;But when implemented correctly, API key authentication helps to provide an effective way to secure AI services while also keeping integration simple for developers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Token-Based Authentication Using JWT
&lt;/h3&gt;

&lt;p&gt;Token-based authentication is mostly used in modern AI APIs and applications. Instead of you sending login credentials with every request, the system issues a token after the user successfully authenticates, and one of the most common formats is a JSON Web Token (JWT).&lt;/p&gt;

&lt;p&gt;A JWT is more like a compact URL-safe token that contains encoded information about the authenticated identity. It includes user details, permissions, and an expiration timestamp. The token is digitally signed just so the server can verify its authenticity without it needing to store session data.&lt;/p&gt;

&lt;p&gt;Some typical examples of JWT authentication workflow are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When a user or service sends login credentials to an authentication endpoint.&lt;/li&gt;
&lt;li&gt;When the server verifies the credentials.&lt;/li&gt;
&lt;li&gt;When the server generates a signed JWT.&lt;/li&gt;
&lt;li&gt;When the client includes the token in future requests to protected endpoints.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Most APIs expect the token in the Authorization header:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Authorization: Bearer YOUR_JWT_TOKEN
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a request reaches the AI service, the backend verifies the token signature and checks its expiration time. If the token is valid, then the request proceeds to the AI model or application logic.&lt;/p&gt;

&lt;p&gt;JWT tokens are mostly used in AI platforms that support user accounts, dashboards, or role-based access control.&lt;/p&gt;

&lt;p&gt;JWTs consist of three parts separated by periods:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HEADER.PAYLOAD.SIGNATURE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;header&lt;/strong&gt; describes the signing algorithm&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Payload&lt;/strong&gt; contains claims such as user ID, role, and expiration time&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Signature&lt;/strong&gt; verifies that the token was issued by a trusted authority&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Simply because the token is signed, the server can verify it without storing session data in a database, which makes JWT authentication stateless, ideal for scalable AI systems and microservice architectures.&lt;/p&gt;

&lt;p&gt;Stateless authentication helps to simplify horizontal scaling when multiple AI API instances are running behind a load balancer; any instance can validate the token without needing shared session storage.&lt;/p&gt;

&lt;p&gt;JWTs typically include an exp claim that helps to define when the token becomes invalid. Short-lived tokens reduce security risk if a token is intercepted or leaked.&lt;/p&gt;

&lt;p&gt;A lot of systems also issue refresh tokens. When an access token expires, the refresh token can request a new one without forcing the user to log in again. When using JWT authentication, security best practices are important&lt;/p&gt;

&lt;p&gt;Always sign tokens using strong algorithms such as HS256 or RS256. Never trust an unsigned token or a token created on the client side.&lt;/p&gt;

&lt;p&gt;Sensitive information should not be stored inside the token payload. Even though JWTs are signed, they are not encrypted by default.&lt;/p&gt;

&lt;p&gt;For web applications, storing tokens in secure HTTP-only cookies helps reduce exposure to cross-site scripting attacks.&lt;/p&gt;

&lt;p&gt;In AI applications, JWT authentication works well for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI dashboards with authenticated users&lt;/li&gt;
&lt;li&gt;Multi-tenant AI platforms&lt;/li&gt;
&lt;li&gt;AI-powered APIs that enforce user roles&lt;/li&gt;
&lt;li&gt;Microservices communicating with each other&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When implemented correctly, JWT-based authentication provides a scalable and secure identity mechanism for modern AI applications while also keeping request handling fast and stateless.&lt;/p&gt;

&lt;h3&gt;
  
  
  OAuth and Social Login for AI Platforms
&lt;/h3&gt;

&lt;p&gt;In AI platforms, OAuth and social login simplify account management while improving security.&lt;/p&gt;

&lt;p&gt;Instead of storing passwords directly, the AI application helps by delegating authentication to an external provider. Common providers include Google and GitHub. The application receives a secure access token that verifies the user’s identity.&lt;/p&gt;

&lt;p&gt;A typical OAuth flow looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A user clicks a social login option (for example, “Sign in with Google”).&lt;/li&gt;
&lt;li&gt;The application redirects the user to the identity provider.&lt;/li&gt;
&lt;li&gt;The provider verifies the user’s identity.&lt;/li&gt;
&lt;li&gt;The provider returns an authorization token to the AI platform.&lt;/li&gt;
&lt;li&gt;The AI application creates a session or issues its own internal access token.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This approach helps to remove the need to manage passwords directly. Password storage introduces security responsibilities like hashing, credential rotation, and breach mitigation. OAuth helps to shift those responsibilities to specialized identity providers.&lt;/p&gt;

&lt;p&gt;OAuth is useful for AI platforms that target developers or teams. Take for example, an AI code assistant might allow developers to log in using GitHub accounts, and once authenticated, the platform can securely access repository metadata or integrate with development workflows.&lt;/p&gt;

&lt;p&gt;OAuth supports scopes that help define exactly what an application is allowed to access. Instead of granting full account control, a user might allow an AI app to read profile data or access specific resources.&lt;/p&gt;

&lt;p&gt;OAuth also helps to improve onboarding speed. Users can sign in with existing accounts in seconds instead of filling out registration forms, which helps to reduce friction, particularly important for consumer AI applications.&lt;/p&gt;

&lt;p&gt;When implementing OAuth, security practices still matter. Always validate authorization tokens on the backend server and never rely solely on client-side verification. It is important to store minimal identity information locally, and in most cases, the AI platform only needs a unique user ID and basic profile data from the identity provider.&lt;/p&gt;

&lt;p&gt;For AI systems that interact with external services, OAuth can also enable secure API integrations. The same goes for AI platforms with user accounts, dashboards, or collaborative tools. OAuth and social login provide a secure and scalable authentication method while also reducing the complexity of managing passwords internally.&lt;/p&gt;

&lt;h3&gt;
  
  
  Passwordless Authentication for AI Apps
&lt;/h3&gt;

&lt;p&gt;Passwordless authentication helps users to access an AI application without you creating or entering a traditional password. What it does is, the system verifies identity using alternatives such as magic links, one-time passcodes (OTP), biometric authentication, or hardware security keys.&lt;/p&gt;

&lt;p&gt;This approach is becoming very popular because passwords are now a major security weakness. Removing passwords reduces risks like credential reuse, phishing, and weak password selection.&lt;/p&gt;

&lt;p&gt;For example, a common workflow uses email magic links:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The user enters an email address.&lt;/li&gt;
&lt;li&gt;The AI application generates a temporary login link.&lt;/li&gt;
&lt;li&gt;The link is sent to the user’s email.&lt;/li&gt;
&lt;li&gt;Clicking the link verifies identity and creates a session.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Another common method used is a one-time passcode sent through email, SMS, or an authenticator app. The user enters the code within a short time window, and the system validates it before granting access.&lt;/p&gt;

&lt;p&gt;These methods work well for AI platforms that prioritize fast onboarding, removing the need to create and remember passwords, which reduces friction and can improve user adoption for consumer-facing AI tools.&lt;/p&gt;

&lt;p&gt;Passwordless authentication is useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI chat platforms&lt;/li&gt;
&lt;li&gt;AI productivity tools&lt;/li&gt;
&lt;li&gt;developer-facing AI dashboards&lt;/li&gt;
&lt;li&gt;internal AI tools used by teams&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modern passwordless systems often rely on WebAuthn or FIDO2 standards. These technologies support biometric authentication through devices such as fingerprint scanners or facial recognition built into phones and laptops. Instead of transmitting a password, the device verifies the user locally and signs a cryptographic challenge.&lt;/p&gt;

&lt;p&gt;This provides strong protection against phishing attacks because authentication is tied to the user’s device and domain.&lt;/p&gt;

&lt;p&gt;Developers building AI applications should also consider session handling after authentication succeeds. Even without passwords, the system still needs a secure session token or an access token to maintain the user’s authenticated state during API requests.&lt;/p&gt;

&lt;p&gt;Passwordless authentication offers a secure and user-friendly approach for AI applications, as it tends to reduce credential risks while keeping login flows simple for users interacting with modern AI services.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Have a great one!!!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Author: &lt;a href="https://blog.masteringbackend.com/authors/Toluwanimi" rel="noopener noreferrer"&gt;Toluwanimi Fawole&lt;/a&gt;
&lt;/h3&gt;




&lt;h3&gt;
  
  
  Thank you for being a part of the community
&lt;/h3&gt;

&lt;p&gt;Before you go:&lt;/p&gt;

&lt;h3&gt;
  
  
  Whenever you’re ready
&lt;/h3&gt;

&lt;p&gt;There are 4 ways we can help you become a great backend engineer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Platform:&lt;/strong&gt;&lt;/a&gt; Join thousands of backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learning and set schedules, and solve backend engineering tasks, exercises, and challenges.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://masteringbackend.com/academy?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Academy:&lt;/strong&gt;&lt;/a&gt; The “MB Academy” is a 6-month intensive Advanced Backend Engineering Boot Camp to produce great backend engineers.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://backendweeky.dev/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Join Backend Weekly:&lt;/strong&gt;&lt;/a&gt; If you like posts like this, you will absolutely enjoy our exclusive weekly newsletter, sharing exclusive backend engineering resources to help you become a great Backend Engineer.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://getbackendjobs.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Get Backend Jobs:&lt;/strong&gt;&lt;/a&gt; Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://blog.masteringbackend.com/authentication-and-session-management-for-ai-apps" rel="noopener noreferrer"&gt;&lt;em&gt;https://blog.masteringbackend.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>sessionmanagement</category>
      <category>backenddevelopment</category>
      <category>api</category>
      <category>authentication</category>
    </item>
    <item>
      <title>Top 5 Java Backend Development Courses (2026)</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Fri, 20 Mar 2026 10:30:00 +0000</pubDate>
      <link>https://forem.com/masteringbackend/top-5-java-backend-development-courses-2026-1j9m</link>
      <guid>https://forem.com/masteringbackend/top-5-java-backend-development-courses-2026-1j9m</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsaxtynukghvux6xmg5v9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsaxtynukghvux6xmg5v9.png" alt="Top 5 Java Backend Development Courses (2025)" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The internet is filled with lots of Java Backend Development Courses. Therefore, choosing the best Java backend development course can be a nightmare for newbies looking to start or change careers.&lt;/p&gt;

&lt;p&gt;Java is a popular programming language with a ground-breaking of millions of developers worldwide, with over  &lt;a href="https://www.cisin.com/coffee-break/cost-of-outsourcing-your-software-project-to-a-company.html?ref=top-5-backend-development-courses&amp;amp;utm_source=masteringbackend&amp;amp;utm_campaign=top-5-backend-development-courses&amp;amp;utm_medium=blog" rel="noopener noreferrer"&gt;7.1 million professionals&lt;/a&gt;  using it to build robust applications. Also, Java runs on over a billion devices according to Oracle.&lt;/p&gt;

&lt;p&gt;This groundbreaking record shows the value and relevancy of learning Java today as a backend engineer. You must choose the Best Java Course this year to achieve this goal effectively. A course that is designed to teach you the basics and also prepare you for the real challenges in your tech journey.&lt;/p&gt;

&lt;p&gt;If you’re planning to start your Java backend development journey, investing in the right Java Backend Development course could be the key to your success.&lt;/p&gt;

&lt;p&gt;To help reduce the time spent researching and searching for the best backend development course, we have already prepared a list of the top five best Java backend development courses. These courses are thorough, beginner-friendly, and will prepare you for the job market.&lt;/p&gt;

&lt;p&gt;As part of our criteria, we have assembled the best course to learn Java for Backend Development. These courses combine the right essential theories, including practical projects, while making learning enjoyable and effective.&lt;/p&gt;

&lt;p&gt;Additionally, these top-rated courses boast a 90% satisfaction rate from participants because they prepare them for the job and cover almost everything needed to become a Java Backend Developer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Top 5 Java Backend Development Courses 2025
&lt;/h2&gt;

&lt;p&gt;Here’s a comprehensive guide to the Top 5 Best Java Backend Development Courses for 2025. These courses are called Roadmap Java Backend Courses, designed to take you from a complete beginner to a different level of expertise.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Become a Java+Spring Backend Developer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mastering Java Backend with Oracle University.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Learn Java by Creating Applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Become a Java Backend Developer Bootcamp&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Building Scalable Java Microservices with Spring Boot and Spring Cloud&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Become a Java+Spring Backend Developer
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqlvo9inwzhweu7u25hnl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqlvo9inwzhweu7u25hnl.png" alt="java eng.png" width="800" height="450"&gt;&lt;/a&gt;The course takes you from ground zero and gradually moves you to become proficient in Java Backend Development.&lt;/p&gt;

&lt;p&gt;Below are the modules covered in this course:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Java Essentials:&lt;/strong&gt;  The Java Essentials module is a complete, beginner-friendly course that explains the Core Java Basics, Object-Oriented Programming, Java syntax, and concepts such as variables, data types, arrays, strings, functions, control flow in Java, and error handling. This 49-video lesson course will expose you to core Java basics, Object-Oriented Programming, and Error Handling in Java.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Advanced Java:&lt;/strong&gt;  As the name suggests, this is a complete advanced Java course that aims to teach you advanced concepts in Java, such as Collections, Java I/O Streams and Build Tool, and Multithreading in Java. This course explores I/O streams, collections, build tools, and multithreading in great detail, giving you the required knowledge to excel in Java Backend Development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Design Patterns in Java:&lt;/strong&gt; In this module, you will learn the significance of design patterns and how to apply key Creational, Structural, and Behavioral patterns to create robust, maintainable, and scalable Java software solutions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unit Testing in Java:&lt;/strong&gt; In this module, you will learn the importance of unit testing, the principles of Test-Driven Development (TDD), how to write test cases using JUnit, how to utilize advanced JUnit features like parameterized tests and test suites, and how to implement mocking with Mockito.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Spring Framework and Spring Boot:&lt;/strong&gt;  In this module, you’ll begin with the essentials of the Spring Framework, exploring how to configure beans using annotations and XML, manage bean lifecycles, and tap into Spring’s modular ecosystem, including AOP, Spring MVC, Spring Batch, Integration, and JMS. As you progress, you'll dive deep into security, messaging, and cloud support through Spring Security and Spring Cloud.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Microservices in Java:&lt;/strong&gt; You will learn about the benefits and challenges of Microservices Architecture, how to build and configure microservices with Spring Boot, enable communication between microservices using Feign Client, implement event-driven messaging brokers, configure service discovery and registration with Eureka, and utilize API Gateway and load balancing with Zuul, Spring Cloud Gateway, and Ribbon.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Containerization:&lt;/strong&gt;  In this module, you'll learn to use Docker and Kubernetes by containerizing a Java application, working with Docker images, containers, registries, Dockerfiles, and Docker Compose, then dive into Kubernetes architecture and components like Pods, Nodes, and Clusters, set up clusters with Minikube and AWS, manage resources such as Deployments, Services, Ingress, ConfigMaps, and Secrets, scale applications, and implement monitoring and logging.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Milestone Projects in Java:&lt;/strong&gt; Build over 10+ projects while learning Java. Build a SaaS product in Java.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is an all-in-one Java and Spring course for learning backend engineering with Java. This comprehensive course is designed for Java developers seeking proficiency in Java.&lt;/p&gt;

&lt;h3&gt;
  
  
  Course Highlights:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Lifetime access to course materials&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dedicated doubt resolution sessions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Industry-oriented curriculum following the  &lt;a href="http://roadmap.sh/?ref=top-5-backend-development-courses&amp;amp;utm_source=masteringbackend&amp;amp;utm_campaign=top-5-backend-development-courses&amp;amp;utm_medium=blog" rel="noopener noreferrer"&gt;Roadmap.sh&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Live sessions and webinars with industry experts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Certification upon completion&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Real-world projects and case studies&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Course Duration:&lt;/strong&gt;  2-4 months.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Course Price:&lt;/strong&gt; starting at $60 monthly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Course Link:&lt;/strong&gt; &lt;a href="https://masteringbackend.com/courses/become-a-java-spring-backend-engineer?ref=top-5-backend-development-courses&amp;amp;utm_source=masteringbackend&amp;amp;utm_campaign=top-5-backend-development-courses&amp;amp;utm_medium=blog" rel="noopener noreferrer"&gt;https://masteringbackend.com/courses/become-a-java-spring-backend-engineer&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Mastering Java Backend with Oracle University
&lt;/h2&gt;

&lt;p&gt;This is the official Java course from Oracle University. Java is currently owned by Oracle Corporation, which acquired Sun Microsystems, the original developers of Java.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fipt4g70vgxw2o55q5yx4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fipt4g70vgxw2o55q5yx4.png" alt="java backend.png" width="800" height="394"&gt;&lt;/a&gt;However, the Java core specification is managed through the Java Community Process (JCP), and Oracle owns the official Java Standard Edition (SE) implementation.&lt;/p&gt;

&lt;p&gt;The Oracle University has created a series of Java courses to help you develop in-demand programming skills with comprehensive training on the latest Java technology.&lt;/p&gt;

&lt;p&gt;Below are some of the Java Backend Development Courses from Oracle University:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Java Explorer:&lt;/strong&gt;  Learn the basics of Java, such as variables, loops, objects, classes, arrays, and decision-making constructs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Java SE 11: Programming Complete:&lt;/strong&gt;  This course is intended for students with some programming experience and is a comprehensive training for Java developers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Developing Applications for the Java EE 7 Platform:&lt;/strong&gt; This course teaches you how to build and deploy enterprise applications with Java EE.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Architect Enterprise Application with Java EE:&lt;/strong&gt;  This course teaches you how to develop robust architectures for enterprise Java applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Oracle University is a subscription-based platform; you can access most of the courses when you subscribe. Also, you can access certification courses from the university and earn a recognized certificate from Oracle.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Learn Java by Creating Applications
&lt;/h2&gt;

&lt;p&gt;This is an official course from JetBrains, the creators of JetBrains IDEs and the Kotlin programming language. It teaches Java development practically by building chatbots, games, algorithms, and even neural networks from scratch.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6jy352vzfom5zeeqt00w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6jy352vzfom5zeeqt00w.png" alt="java.png" width="800" height="418"&gt;&lt;/a&gt;The course is subdivided into tracks to help you gradually expand your knowledge and improve in the areas that interest you.&lt;/p&gt;

&lt;p&gt;Below is a list of the tracks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Java for Beginners:&lt;/strong&gt;  This course is for complete Java beginners and programming newbies. Its track will help you start and prepare for some computer science certifications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Java Core:&lt;/strong&gt;  This track is a great choice for learners who want to gain a firm grasp of Java fundamentals and be introduced to algorithmic problems and mathematical models.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Java Backend Developer:&lt;/strong&gt; This track was specifically designed to prepare you for your first Junior Developer interview. It contains tasks necessary to successfully pass your technical interview.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Java Desktop Application Developer:&lt;/strong&gt;  If you already know the basics of Java and would like to create desktop apps, this is the right track for you. You will also master the Swing framework.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Course Highlights:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;200+ interactive projects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Personalized study plan&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integration with JetBrains IDEs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Knowledge map&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Instant feedback&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Certificate of completion&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Become a Java Backend Developer Bootcamp
&lt;/h2&gt;

&lt;p&gt;All-in-one Java Bootcamp for learning backend engineering with Java. This bootcamp is designed for Java developers seeking proficiency in Java.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo6f75ta2ksgevz4k8vs4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo6f75ta2ksgevz4k8vs4.png" alt="java b.png" width="800" height="361"&gt;&lt;/a&gt;The Java Backend Developer Bootcamp is a comprehensive backend engineering bootcamp that will equip you with the skills to take your backend engineering career to the next level.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bootcamp Outline:
&lt;/h3&gt;

&lt;p&gt;Below is the content outline that we cover in this bootcamp to turn you into a great backend developer using the Java programming language.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Basics of Back-End Development&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Server-side Programming Language (Java)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build a Back-End with Spring&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;API and API Design&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git and GitHub&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mastering Database&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deployment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Software Testing&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Software Design Principles&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Web Security&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Caching and CDNs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Message Brokers and Search Engines&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scalability&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Containerization and CI/CD&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Structures and Algorithms&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What to Expect in a Technical Interview (Landing Job)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Bootcamp Highlights:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;200+ recorded videos and lessons&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Personalized study plan&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;3-month access to the instructor&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lifetime Access and updates&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Practice Projects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Career Services&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Instant feedback&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Certificate of completion&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Course Duration:&lt;/strong&gt;  2-4 months.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Course Price:&lt;/strong&gt; starting at $500 monthly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Course Link:&lt;/strong&gt; &lt;a href="https://academy.masteringbackend.com/?ref=top-5-backend-development-courses&amp;amp;utm_source=masteringbackend&amp;amp;utm_campaign=top-5-backend-development-courses&amp;amp;utm_medium=blog" rel="noopener noreferrer"&gt;https://academy.masteringbackend.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Building Scalable Java Microservices with Spring Boot and Spring Cloud
&lt;/h2&gt;

&lt;p&gt;Are you a Java developer looking to take your microservices skills to the next level? Google Cloud, in collaboration with Coursera, offers an  &lt;strong&gt;intermediate-level course&lt;/strong&gt;  that teaches you how to build scalable, cloud-native microservices using  &lt;strong&gt;Spring Boot&lt;/strong&gt;  and  &lt;strong&gt;Spring Cloud&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this course, you'll learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Build Spring Boot microservices that integrate with  &lt;strong&gt;Google Cloud managed services&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use  &lt;strong&gt;Pub/Sub&lt;/strong&gt;  and  &lt;strong&gt;Spring Integration&lt;/strong&gt;  for message handling&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Store data with  &lt;strong&gt;Cloud SQL&lt;/strong&gt;  and migrate to  &lt;strong&gt;Cloud Spanner&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Implement distributed tracing using  &lt;strong&gt;Cloud Trace&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This course is perfect if you already have some experience with Java and want to deepen your skills by working with real-world cloud tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  Course Highlights:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;3 hands-on modules&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Approx.  &lt;strong&gt;12 hours of content&lt;/strong&gt;  — learn at your own pace&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;2 assignments&lt;/strong&gt;  to test your knowledge&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A  &lt;strong&gt;shareable certificate&lt;/strong&gt;  for your LinkedIn or resume&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lifetime access via  &lt;strong&gt;Coursera Plus&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The course is taught by instructors from  &lt;strong&gt;Google Cloud&lt;/strong&gt;, who bring real-world expertise and practical examples to every lesson.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;Choosing the right Java backend development course in 2025 is more than just selecting a popular program — it's about finding the one that aligns with your learning style, career goals, and current experience level. Whether you're a complete beginner starting from scratch or a developer looking to deepen your expertise, the courses listed above provide a comprehensive roadmap to mastering Java for backend engineering.&lt;/p&gt;

&lt;p&gt;From industry-aligned programs like  &lt;strong&gt;"Become a Java + Spring Backend Developer"&lt;/strong&gt;  by Masteringbackend to practical, hands-on courses from  &lt;strong&gt;Oracle University&lt;/strong&gt;,  &lt;strong&gt;JetBrains&lt;/strong&gt;, and  &lt;strong&gt;Google Cloud&lt;/strong&gt;, these options are carefully curated to help you build real-world skills and become job-ready. Each course combines structured modules, project-based learning, expert-led instruction, and certifications that can give you an edge in today’s competitive job market.&lt;/p&gt;

&lt;p&gt;Now is the best time to invest in your backend engineering career. Choose the course that suits you best and take the first step toward becoming a professional Java Backend Developer in 2025.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ready to Become a Java Backend Engineer?
&lt;/h3&gt;

&lt;p&gt;If you're serious about launching your backend engineering career with Java, then  &lt;a href="https://masteringbackend.com/courses/become-a-java-spring-backend-engineer?ref=top-5-backend-development-courses&amp;amp;utm_source=masteringbackend&amp;amp;utm_campaign=top-5-backend-development-courses&amp;amp;utm_medium=blog" rel="noopener noreferrer"&gt;&lt;strong&gt;Become a Java+Spring Backend Developer&lt;/strong&gt;&lt;/a&gt;  is the ultimate course to get you there.&lt;/p&gt;

&lt;p&gt;With a structured roadmap, real-world projects, and modules that take you from complete beginner to job-ready backend engineer, this course is your all-in-one solution. You'll learn everything from Java fundamentals to advanced Spring Boot microservices and even containerization with Docker and Kubernetes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Lifetime access&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hands-on projects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Live sessions with experts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Certification on completion&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Designed by backend engineers for backend engineers&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Join thousands of developers already learning Java the right way.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://masteringbackend.com/courses/become-a-java-spring-backend-engineer?ref=top-5-backend-development-courses&amp;amp;utm_source=masteringbackend&amp;amp;utm_campaign=top-5-backend-development-courses&amp;amp;utm_medium=blog" rel="noopener noreferrer"&gt;Start Learning Today&lt;/a&gt;  — and build your future in backend engineering!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Have a great one!!!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Author: &lt;a href="https://blog.masteringbackend.com/authors/kaperskyguru" rel="noopener noreferrer"&gt;Solomon Eseme&lt;/a&gt;
&lt;/h3&gt;




&lt;h3&gt;
  
  
  Thank you for being a part of the community
&lt;/h3&gt;

&lt;p&gt;Before you go:&lt;/p&gt;

&lt;h3&gt;
  
  
  Whenever you’re ready
&lt;/h3&gt;

&lt;p&gt;There are 4 ways we can help you become a great backend engineer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://masteringbackend.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Platform:&lt;/strong&gt;&lt;/a&gt; Join thousands of backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learning and set schedules, and solve backend engineering tasks, exercises, and challenges.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://masteringbackend.com/academy?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;The MB Academy:&lt;/strong&gt;&lt;/a&gt; The “MB Academy” is a 6-month intensive Advanced Backend Engineering Boot Camp to produce great backend engineers.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://backendweeky.dev/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Join Backend Weekly:&lt;/strong&gt;&lt;/a&gt; If you like posts like this, you will absolutely enjoy our exclusive weekly newsletter, sharing exclusive backend engineering resources to help you become a great Backend Engineer.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://getbackendjobs.com/?ref=medium" rel="noopener noreferrer"&gt;&lt;strong&gt;Get Backend Jobs:&lt;/strong&gt;&lt;/a&gt; Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://blog.masteringbackend.com/top-5-java-backend-development-courses" rel="noopener noreferrer"&gt;&lt;em&gt;https://blog.masteringbackend.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>backenddevelopment</category>
      <category>courses</category>
      <category>backend</category>
    </item>
    <item>
      <title>Which AI Skills Actually Get You Hired in 2026?</title>
      <dc:creator>Jane</dc:creator>
      <pubDate>Thu, 19 Mar 2026 17:00:00 +0000</pubDate>
      <link>https://forem.com/masteringbackend/which-ai-skills-actually-get-you-hired-in-2026-4dlc</link>
      <guid>https://forem.com/masteringbackend/which-ai-skills-actually-get-you-hired-in-2026-4dlc</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuzm513domz85vwjbaq6j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuzm513domz85vwjbaq6j.png" alt="imagedescription" width="800" height="1003"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've been thinking a lot about the AI job market lately.&lt;/p&gt;

&lt;p&gt;Everyone says "learn AI", but which skills actually matter?&lt;/p&gt;

&lt;p&gt;After talking with hiring managers and seeing what's actually in demand, here are&lt;br&gt;
the 3 skills that separate candidates:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;RAG Implementation&lt;/strong&gt; — Real document processing and vector databases, not
just API calls&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI Observability&lt;/strong&gt; — Tracking and debugging AI systems in production&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost Optimization&lt;/strong&gt; — Making AI affordable to run at scale&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Notice what's NOT on this list? "Prompt engineering." Everyone claims that.--&lt;/p&gt;

&lt;p&gt;If you want to go deeper, I'm hosting a free workshop this Saturday with Victor&lt;br&gt;
Eduoh from Laand.&lt;/p&gt;

&lt;h3&gt;
  
  
  "How to Land AI Engineering Jobs."
&lt;/h3&gt;

&lt;p&gt;Saturday, March 22nd. 4 PM UTC. Free.&lt;/p&gt;

&lt;h3&gt;
  
  
  Register here: &lt;a href="http://lu.ma/mb-events" rel="noopener noreferrer"&gt;http://lu.ma/mb-events&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Even if you never take my bootcamp, this workshop will change how you approach AI&lt;br&gt;
jobs.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>backenddevelopment</category>
      <category>skills</category>
      <category>backend</category>
    </item>
  </channel>
</rss>
