<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chidinma Osonwa-Paul on Medium]]></title>
        <description><![CDATA[Stories by Chidinma Osonwa-Paul on Medium]]></description>
        <link>https://medium.com/@chidinmaosonwa-paul?source=rss-558fdb2cc9a5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fcCxE0vpWYgqgwuNl6cqLA.jpeg</url>
            <title>Stories by Chidinma Osonwa-Paul on Medium</title>
            <link>https://medium.com/@chidinmaosonwa-paul?source=rss-558fdb2cc9a5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 18:21:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chidinmaosonwa-paul/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Webhooks vs Polling vs WebSockets: Choosing the Right Real-Time Architecture]]></title>
            <link>https://medium.com/@chidinmaosonwa-paul/webhooks-vs-polling-vs-websockets-choosing-the-right-real-time-architecture-0ad5a65ade82?source=rss-558fdb2cc9a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ad5a65ade82</guid>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[backend-engineering]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[webhooks]]></category>
            <category><![CDATA[polling]]></category>
            <dc:creator><![CDATA[Chidinma Osonwa-Paul]]></dc:creator>
            <pubDate>Sat, 05 Sep 2026 04:01:08 GMT</pubDate>
            <atom:updated>2026-09-05T04:01:08.311Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*51AoaidH6gY_3RvX" /><figcaption>WebHooks vs WebSockets vs Polling from <a href="https://media.licdn.com/dms/image/v2/D4D22AQEcvua05q4eaQ/feedshare-shrink_800/feedshare-shrink_800/0/1697426516776?e=1790208000&amp;v=beta&amp;t=TxjJKoccpEvJLhopRuqK_nLzuyUGCnMrQwFkAWGtF9I">LinkedIn</a></figcaption></figure><p>“Real-time” is one of those requirements that can make a backend architecture more complicated than it needs to be.</p><p>A feature request might say that users should see updates as soon as something changes. That sounds straightforward, but it leaves out the question that matters most: how quickly is “as soon as” actually required to be?</p><p>The answer could be a few hundred milliseconds, several seconds, or even a minute. The system might need to notify another backend service, continuously communicate with a browser, or simply keep a page reasonably up to date.</p><p>Those are very different problems.</p><p>Polling, webhooks, and WebSockets are often discussed together because they can all be used to detect or deliver changes. They are not interchangeable, though, and choosing between them based on which technology sounds more modern is a good way to introduce unnecessary complexity.</p><p>The better approach is to start with the communication pattern the system actually needs.</p><h3>Polling is not bad engineering</h3><p>Polling is often treated as the unsophisticated option, and I think that that reputation is undeserved.</p><p>It is simply a model in which a client periodically requests the current state of a resource. The frequency of those requests determines the trade-off between freshness and resource consumption.</p><p>A client polling every five seconds makes 720 requests per hour. At one request every 30 seconds, that falls to 120 requests per hour.</p><p>Those numbers are simple arithmetic, but they illustrate the fundamental problem with frequent polling: the majority of requests may happen when nothing has changed.</p><p>The trade-off becomes more significant as the number of clients and monitored resources grows. <a href="https://docs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api?apiVersion=2026-03-10">GitHub</a> explicitly recommends using webhook events instead of polling its API where possible because polling can consume API rate-limit quota. When polling is necessary, GitHub recommends doing it only as often as needed and following any polling interval supplied by the API.</p><p>That does not mean polling should be avoided altogether.</p><p>If an application only needs to refresh data periodically, polling can be the most sensible option. A dashboard that updates every minute does not necessarily benefit from the operational complexity of maintaining thousands of persistent connections.</p><p>The mistake is not using polling. The mistake is using aggressive polling when the product does not require that level of freshness.</p><h3>Webhooks work better when the event originates somewhere else</h3><p>Webhooks change the model considerably.</p><p>Instead of repeatedly checking an external system for a change, a service can expose an endpoint and receive an HTTP request when a subscribed event occurs. This makes webhooks particularly useful for integrations between backend systems.</p><p>GitHub uses this model extensively. Its documentation describes <a href="https://docs.github.com/en/webhooks/about-webhooks">webhooks</a> as a way to subscribe to events and receive data when those events occur, rather than repeatedly polling the API. GitHub specifically identifies lower resource usage, better scalability for monitoring many resources, and near real-time updates as advantages of webhooks.</p><p>Consider a payment provider, source-control platform, CI service, or email provider. In each case, an external system owns the event. Your application needs to react to it.</p><p>Polling forces your application to keep checking, while a webhook lets the system that owns the event initiate the notification. That is a much better fit for event-driven integrations.</p><p>But webhooks introduce their own reliability concerns. An HTTP request can fail, a receiving service can be unavailable, events can arrive late or out of order. <a href="https://docs.github.com/en/webhooks/testing-and-troubleshooting-webhooks/troubleshooting-webhooks">GitHub’s documentation </a>explicitly warns that webhook deliveries are not necessarily immediate and can arrive out of order.</p><p>Webhook consumers therefore need to be designed with failure in mind.</p><p>GitHub recommends validating webhook signatures, responding with a 2XX status within 10 seconds, and moving longer processing to asynchronous work where appropriate. It also recommends using the delivery identifier when handling events.</p><p>That last part is particularly important.</p><p>A webhook endpoint should not assume that receiving an event once means the processing problem is solved. Reliable event handling usually requires thinking about duplicate deliveries, retries, ordering, persistence, and idempotency.</p><p>In other words, webhooks reduce the need to constantly ask whether something happened, but they do not remove the reliability problem around what happens after an event is delivered.</p><h3>WebSockets are for persistent communication</h3><p>WebSockets address a different requirement.</p><p>The <a href="https://www.rfc-editor.org/info/rfc6455/">WebSocket Protocol </a>provides a persistent, bidirectional communication channel between a client and server. Unlike traditional HTTP polling, the server does not need to wait for a new request before sending data to a connected client.</p><p>That makes WebSockets a natural fit for applications where communication is continuous and interactive.</p><p>Chat applications are an obvious example. Collaborative applications, multiplayer games, live dashboards, and other interfaces that need frequent updates can also benefit from the model.</p><p>The important characteristic is not simply that WebSockets are “faster.” It is rather that both sides can communicate over an established connection.</p><p>That comes with a different operational model. Persistent connections have to be managed. Clients disconnect and reconnect. Servers need to deal with connection state and message delivery. Systems also need to consider what happens when a client disappears temporarily and misses messages.</p><p>The browser WebSocket API has another limitation worth considering. <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/index.html?">MDN </a>notes that the standard WebSocket API does not provide backpressure. If messages arrive faster than the application can process them, the application can end up buffering data or becoming unresponsive.</p><p>So WebSockets are not simply an upgraded version of polling. They solve a different problem, and they introduce a different set of engineering concerns.</p><h3>The real decision is about latency and ownership</h3><p>A useful way to choose between these approaches is to ask two questions:</p><ul><li>Who owns the state change?</li></ul><p>And:</p><ul><li>How quickly does the consumer need to know about it?</li></ul><p>If the consumer only needs to check the latest state occasionally, polling is often enough. If another system owns the event and your backend needs to react when it occurs, a webhook is usually a better communication model. If a connected client needs continuous, low-latency, two-way communication, WebSockets become much more appropriate.</p><p>There is also an important distinction between state and events.</p><p>Polling generally asks for the current state, a webhook delivers an event, and a WebSocket provides a channel through which messages can flow continuously.</p><p>That distinction affects how the receiving system should be designed.</p><p>Suppose an order has moved through several states while a consumer was temporarily offline, a polling client can usually retrieve the current state when it reconnects. An event-driven consumer may need durable event handling or another mechanism to determine what it missed and a WebSocket client may need to reconnect and resynchronize its state.</p><p>The communication mechanism therefore influences more than network traffic. It influences the reliability model of the application.</p><h3>You do not have to choose only one</h3><p>Real systems frequently combine these approaches.</p><ol><li>A browser application might use ordinary HTTP requests to retrieve its initial state and a WebSocket connection for subsequent live updates.</li><li>A backend might receive webhooks from an external service while periodically reconciling its own records against that service as a recovery mechanism.</li><li>A product might use polling for a low-priority dashboard while using WebSockets for a feature where users genuinely need immediate updates.</li></ol><p>There is nothing architecturally wrong with that.</p><p>In fact, forcing one communication mechanism across every part of an application can be less sensible than choosing the appropriate mechanism for each interaction.</p><h3>“Real-time” is not a sufficient architecture requirement</h3><p>The phrase “we need real-time updates” does not tell an engineer enough to choose a technology.</p><p>The useful questions are more specific:</p><ul><li>How much latency can the user tolerate?</li><li>How frequently do changes occur?</li><li>Who produces the events?</li><li>Does the consumer need the latest state or every individual event?</li><li>Does communication need to happen in both directions?</li><li>What happens when the consumer is offline?</li><li>How important are delivery guarantees?</li><li>What happens when the receiving system is unavailable?</li></ul><p>Once those questions are answered, the technology choice becomes considerably easier.</p><p>Polling, webhooks, and WebSockets are not competing levels of sophistication. Instead, they represent different communication patterns.</p><p>Polling can be perfectly reasonable when freshness requirements are modest. Webhooks are well suited to event notifications between independent systems. WebSockets are better when an application needs persistent, bidirectional communication.</p><p>The best architecture is rarely the one with the most sophisticated technology but the one whose complexity matches the problem, and if a feature can tolerate a 30-second delay, introducing persistent connections to achieve sub-second updates may solve a problem the product never actually had.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ad5a65ade82" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secrets Management & Key Rotation: The Complete Guide to Keeping Application Secrets Secure]]></title>
            <link>https://medium.com/@chidinmaosonwa-paul/secrets-management-key-rotation-the-complete-guide-to-keeping-application-secrets-secure-e3a9aeec1f96?source=rss-558fdb2cc9a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3a9aeec1f96</guid>
            <category><![CDATA[aws-secret-manager]]></category>
            <category><![CDATA[secret-management-tools]]></category>
            <category><![CDATA[key-rotation]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Chidinma Osonwa-Paul]]></dc:creator>
            <pubDate>Sat, 05 Sep 2026 02:54:16 GMT</pubDate>
            <atom:updated>2026-09-05T02:54:16.150Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ldzuDfahhEOJJBlhrvZLfQ.jpeg" /><figcaption>secrets management from <a href="https://unsplash.com/s/illustrations/secret-management">Unsplash</a></figcaption></figure><p>Most applications depend on credentials that developers rarely think about once they have been configured. A database password allows an application to connect to its database, an API key gives it access to an external service, cryptographic keys can also protect sensitive information or verify that a message came from a trusted source. These credentials may be invisible to the people using the application, but if one of them falls into the wrong hands, the consequences can extend far beyond a single compromised value.</p><p>The challenge becomes even greater as an application grows. Secrets end up being used across local development environments, source-control repositories, CI/CD pipelines, cloud infrastructure, databases, and third-party services. Without a deliberate way to manage them, it becomes surprisingly difficult to know where a credential exists, who can access it, how long it has been valid, or what needs to happen when it is compromised.</p><p>This is where secrets management and key rotation become essential parts of application security.</p><p>Secrets management is about more than finding a safe place to store passwords and API keys. It involves controlling how secrets are created, stored, accessed, monitored, rotated, revoked, and eventually removed. Key rotation complements this process by replacing credentials or cryptographic keys before they become an unnecessary long-term security risk.</p><p>The need for these practices is not theoretical. GitHub reported detecting more than 1 million leaked secrets on public repositories during the first eight weeks of 2024, showing just how easily credentials can find their way into places where they should never have been exposed.</p><p>In this article, we’ll break down how secrets management works, why key rotation matters, how organizations can approach rotation safely, and the mistakes developers should avoid when handling application credentials.</p><h3>What Is Secrets Management?</h3><p>Secrets management is the process of securely creating, storing, accessing, distributing, rotating, auditing, and revoking sensitive credentials used by applications and infrastructure.</p><p>A secret can be many things, including:</p><ul><li>Database usernames and passwords</li><li>API keys</li><li>Access tokens</li><li>Authentication credentials</li><li>Private keys</li><li>SSH keys</li><li>TLS certificates</li><li>Encryption keys</li><li>Service-account credentials</li><li>Connection strings</li></ul><p><a href="https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html?">OWASP</a>’s Secrets Management Cheat Sheet identifies many of these same categories and recommends treating secrets as resources that need centralized storage, access control, auditing, rotation, and lifecycle management.</p><p>One important distinction is that <strong>not every secret is a cryptographic key</strong>. A database password and an encryption key are both sensitive, but they have different purposes and can require different management strategies.</p><p>NIST’s <a href="https://www.nist.gov/publications/recommendation-key-management-part-1-general-1?"><em>Recommendation for Key Management</em> </a>focuses specifically on cryptographic keying material and its lifecycle, including protection, usage, compromise recovery, and destruction.</p><p>So secrets management isn’t simply putting your API key in an environment variable. That is only one small part of the problem.</p><p>A proper secrets management strategy should answer questions such as:</p><ul><li>Where is the secret stored?</li><li>Who can access it?</li><li>How is access authenticated?</li><li>How long should the secret remain valid?</li><li>How is the secret rotated?</li><li>What happens if it is compromised?</li><li>How do we know who accessed it?</li><li>How do we revoke it?</li><li>How does the application receive the new secret?</li></ul><p>That is what differentiates storing secrets from managing secrets.</p><h3>Why Secrets Management?</h3><p>Consider a simple example:</p><pre>const databasePassword = &quot;production-password&quot;;</pre><p>Now imagine that credential accidentally ends up in a public Git repository. Deleting the file doesn’t necessarily solve the problem because someone may already have cloned the repository or the credential may exist in Git history, logs, build artifacts, screenshots, or other systems.</p><p>This is why simply removing a leaked secret isn’t enough. A better approach is to keep secret values outside the application source code and inject or retrieve them at runtime.</p><p>For local development, that might mean an environment variable. For production workloads, organizations commonly use dedicated secret-management services rather than manually distributing credentials across application servers.</p><p>The goal is to separate application logic from sensitive configuration while controlling access to that configuration.</p><p>OWASP recommends that secrets that are no longer required or may have been compromised should be securely revoked.</p><h3>Environment Variables Are Not a Complete Secrets Strategy</h3><p>Environment variables are useful, but it is a mistake to assume that putting a secret in an environment variable automatically makes it secure. The secret still has to come from somewhere.</p><p>It may be injected by a CI/CD platform, container runtime, cloud service, deployment system, or secrets manager. Depending on the environment, secrets can also be exposed through debugging output, process inspection, configuration dumps, or logs.</p><p>This is why the real question is about who can access the environment in which that variable exists, and how is the value controlled throughout its lifecycle.</p><p>For small projects, environment variables can be perfectly reasonable. As systems become more complex, a dedicated secrets-management solution can provide stronger controls around access, auditing, versioning, and rotation.</p><h3>What Is Key Rotation?</h3><p>Key rotation is the process of replacing an existing secret or cryptographic key with a new one. For example, suppose an application currently uses API_KEY = key_v1. After rotation, it might use API_KEY = key_v2</p><p>The old key is then revoked or retired according to the application’s rotation strategy. Rotation reduces the amount of time a credential remains useful if it is exposed. <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/best-practices.html?">AWS,</a> for example, recommends rotating secrets because credentials that remain unchanged for long periods have a greater opportunity to be compromised, and its Secrets Manager supports automatic rotation.</p><p>The same concept applies to cryptographic keys, although the process can be considerably more complicated because existing data may still depend on an older key.</p><p><a href="https://www.nist.gov/publications/recommendation-key-management-part-1-general-1">NIST</a> describes the concept of a cryptoperiod, which is the period during which a cryptographic key is authorized for use. NIST also points out that the appropriate period depends on the key type, its environment, and the characteristics of the information being protected.</p><p>That means there isn’t one universal rule saying every key must be rotated every 30, 60, or 90 days. Rotation schedules should be based on the credential’s risk, usage, and operational requirements.</p><h3>Why Rotate Secrets?</h3><p>The main reason is to reduce the amount of time a compromised credential can remain useful.</p><p>Imagine an API key is accidentally exposed today but nobody notices until several weeks later. If the credential is still valid, an attacker who obtained it may still be able to use it.</p><p>Regular rotation reduces that window.</p><p><a href="https://docs.cloud.google.com/secret-manager/docs/rotation-recommendations">Google Cloud’s Secret Manager documentation</a> identifies limiting the impact of leaked secrets and reducing the risk of service disruption during emergency rotation as benefits of periodic rotation.</p><p>Rotation can also help when:</p><ul><li>A credential has been exposed.</li><li>A person or service no longer needs access.</li><li>A credential has reached the end of its intended lifetime.</li><li>Security policies require replacement.</li><li>A service’s authentication mechanism has changed.</li><li>An organization wants to reduce reliance on long-lived credentials.</li></ul><p>When compromise is suspected, however, you shouldn’t simply wait for the next scheduled rotation. The credential should be replaced or revoked as part of the incident-response process.</p><h3>Rotation and Revocation Are Different</h3><p>These terms are sometimes used interchangeably, but they describe different actions.</p><p>Rotation replaces an existing credential with a new one:</p><p>key_v1 — key_v2</p><p>Revocation makes a credential invalid:</p><p>key_v1: no longer accepted</p><p>A normal rotation might involve generating a replacement and then retiring the old value.</p><p>A compromised credential may require immediate revocation or replacement rather than waiting for a scheduled rotation.</p><p>Understanding the difference becomes particularly important when designing an incident-response process.</p><h3>Why Automated Rotation?</h3><p>Manually rotating credentials may be manageable for a small application. It becomes considerably harder when dozens or hundreds of services depend on them.</p><p>A single database credential might be used by: Application — Database — Background worker — CI/CD pipeline — Third-party service</p><p>This is why automated rotation is useful. A<a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html?">WS Secrets Manager,</a> for example, can automatically rotate supported secrets and update the credentials in both the secret and the corresponding database or service.</p><p>Azure Key Vault also provides automated rotation capabilities for supported scenarios. <a href="https://learn.microsoft.com/en-us/azure/key-vault/secrets/secure-secrets?">Microsoft </a>recommends regular rotation of secrets to reduce the impact of leaked credentials.</p><p>Automation doesn’t mean you can ignore the rotation process. It means the process can happen consistently without relying on someone remembering to do it manually.</p><h3>The Biggest Challenge: Rotating Without Breaking the Application</h3><p>This is where key rotation becomes an engineering problem rather than just a security task.</p><p>Imagine your application currently uses password_v1. You create password_v2. If you immediately disable password_v1, any application that hasn’t received the new credential may stop working.</p><p>One way to avoid this is to temporarily support both credentials while consumers transition:</p><pre>          Application<br>           /       \<br>          ↓         ↓<br>     key_v1       key_v2<br>          \         /<br>           ↓       ↓<br>             Service</pre><p>Once the application has successfully moved to key_v2, key_v1 can be disabled.</p><p>AWS documents an alternating-users rotation strategy for supported database credentials, while Microsoft provides guidance for rotating resources that use two sets of credentials. The broader principle is worth remembering: <strong><em>don’t revoke the old credential until you’ve confirmed that the new credential is working everywhere that needs it.</em></strong></p><h3>Secret Versioning Makes Rotation Easier</h3><p>Secret versioning allows a secrets manager to maintain different versions of a secret instead of simply overwriting the existing value.</p><p>For example:</p><p>Secret</p><p>├── Version 1</p><p>├── Version 2</p><p>└── Version 3</p><p><a href="https://docs.cloud.google.com/secret-manager/docs/rotation-recommendations">Google Cloud Secret Manager</a> uses secret versions and recommends using a controlled rollout when introducing a new version. Its guidance also recommends disabling an old version before destroying it, giving teams an opportunity to identify applications that still depend on it. This can make rotation safer because there is a clear transition between the old and new values.</p><p>It also makes troubleshooting easier. If a new credential causes an unexpected problem, knowing which version was previously active can help with recovery.</p><h3>Encryption Keys</h3><p>Rotating an API key and rotating an encryption key are not necessarily the same problem.</p><p>Suppose data was encrypted using Encryption Key A. You generate Encryption Key B, you cannot automatically assume that Key A can be deleted immediately. Existing encrypted data may still depend on it.</p><p>NIST’s key-management guidance emphasizes managing cryptographic keys throughout their lifecycle, including protection, usage, compromise recovery, and destruction. Azure provides a practical example of this complexity. When customer-managed keys are rotated, Azure notes that old and new key versions may both need to remain enabled while data-encryption keys are re-wrapped. The underlying data is not necessarily re-encrypted during this process. This is why encryption-key rotation needs to be designed around the application’s encryption architecture rather than treated like changing a database password.</p><h3>Least Privilege Still Matters</h3><p>A securely stored secret can still create a major security problem if it has excessive permissions.</p><p>Suppose a backend service only needs to read records from a database, its credential shouldn’t automatically have permission to delete databases, create administrators, or access unrelated production systems.</p><p>This is the principle of <strong>least privilege</strong>: give an identity only the access required to perform its job. That way, if a credential is compromised, the potential blast radius is smaller.</p><p>The same principle applies to the secrets manager itself. Developers, applications, and CI/CD pipelines should only be able to retrieve the secrets they actually need.</p><h3>What If a Secret Is Leaked?</h3><p>Deleting the secret from your repository is not enough. If a production API key has been committed publicly, assume that someone could have copied it.</p><p>A sensible response is:</p><ol><li>Detect exposure</li><li>Identify credential</li><li>Revoke or replace it</li><li>Update the application</li><li>Check for suspicious activity</li><li>Investigate the cause</li></ol><p>The exact response depends on the credential and the system it protects, but the important part is to invalidate the exposed value rather than simply hiding it again.</p><p><a href="https://docs.github.com/en/code-security/concepts/secret-security/secret-scanning">GitHub</a>’s secret-scanning documentation and cloud-provider guidance both reinforce the importance of detecting exposed credentials and responding to them appropriately.</p><h3>A Practical Secrets Management Checklist</h3><p>If you’re reviewing the security of an application, start with these questions:</p><p><strong>Storage</strong></p><ul><li>Are secrets kept out of source control?</li><li>Are production and development credentials separated?</li><li>Are sensitive values stored in an appropriate secret-management system?</li></ul><p><strong>Access</strong></p><ul><li>Who can retrieve each secret?</li><li>Does every application have only the access it needs?</li><li>Is secret access auditable?</li></ul><p><strong>Rotation</strong></p><ul><li>Does each important credential have a rotation strategy?</li><li>Can rotation be automated?</li><li>Can credentials be replaced without unnecessary downtime?</li><li>Are old credentials revoked after successful rotation?</li></ul><p><strong>Monitoring</strong></p><ul><li>Are credentials excluded from application logs?</li><li>Can leaked secrets be detected?</li><li>Are suspicious authentication events monitored?</li></ul><p><strong>Incident response</strong></p><ul><li>Can compromised credentials be revoked quickly?</li><li>Do you know which systems depend on each credential?</li><li>Is there a documented recovery process?</li></ul><h3>Conclusion</h3><p>Secrets management is much more than finding somewhere to put an API key.</p><p>It is more about maintaining control over credentials throughout their lifecycle: where they are stored, who can access them, how they are used, when they are rotated, and what happens when they can no longer be trusted.</p><p>Key rotation strengthens that lifecycle by limiting how long credentials remain valid, but successful rotation also requires careful planning. If the new credential isn’t deployed everywhere before the old one is revoked, a security improvement can quickly become an availability problem.</p><p>The best approach is therefore not to rotate secrets blindly. Store them securely, restrict access, monitor their use, automate rotation where practical, and design the transition so that old credentials can be safely retired.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3a9aeec1f96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Idempotency in Distributed Systems: How to Safely Handle Retries and Duplicate Requests]]></title>
            <link>https://medium.com/@chidinmaosonwa-paul/idempotency-in-distributed-systems-how-to-safely-handle-retries-and-duplicate-requests-4436cf1ec1f6?source=rss-558fdb2cc9a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4436cf1ec1f6</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[idempotency]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Chidinma Osonwa-Paul]]></dc:creator>
            <pubDate>Sun, 30 Aug 2026 18:15:10 GMT</pubDate>
            <atom:updated>2026-08-30T19:48:50.914Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*noZ6ymhcSRW4QqHF" /><figcaption>Image credit: <a href="https://media.licdn.com/dms/image/v2/D4D12AQEdT6Bxy-HUFA/article-cover_image-shrink_720_1280/B4DZXXN0f5HkAM-/0/1743072480445?e=1789603200&amp;v=beta&amp;t=36TnXURqK38txsQAmv5sJVCckVYfqTUcPy12UchluCw">LinkedIn</a></figcaption></figure><p>Imagine you’re at an ATM and you press the button to withdraw money. The machine takes a few seconds, but nothing appears to happen, so you press the button again.</p><p>Now imagine that the first request actually went through, but the ATM just hadn’t updated the screen yet.</p><p>You didn’t intend to make two withdrawals. You intended to make one withdrawal, and the second attempt was simply a retry.</p><p>Software systems deal with this kind of situation all the time.</p><p>A user clicks “Pay” and the request reaches the server, but the response gets lost somewhere along the way. The payment may have succeeded, but the client doesn’t know that, so it tries again.</p><p>Without the right safeguards, one payment can become two.</p><p>This is the problem <strong>idempotency</strong> helps to solve.</p><p>Idempotency is about making repeated attempts at the same operation safe. It’s a deceptively simple idea, but implementing it correctly involves some of the harder parts of backend engineering: unreliable networks, retries, race conditions, database transactions, distributed systems, and failure recovery.</p><p>So let’s look at what idempotency actually means and how to design systems that can safely handle the fact that sometimes, the same request will arrive more than once.</p><h3>What Is Idempotency?</h3><p>An operation is <strong>idempotent</strong> when performing it multiple times has the same intended effect as performing it once.</p><p>A simple mathematical representation is:</p><pre>f(f(x)) = f(x)</pre><p>In software, that means repeating an operation shouldn’t create an additional unintended effect.</p><p>Consider an API that lets you update a user’s profile:</p><pre>PUT /users/123<br>Content-Type: application/json<br><br>{<br>  &quot;name&quot;: &quot;Jane&quot;<br>}</pre><p>The first request changes the user’s name to Jane. If the exact same request is sent again, the user’s name is still Jane; the second request doesn’t create another user or append another name.</p><p>The resulting state is the same, and that is idempotency.</p><p>However, there is an important distinction here: <strong>Idempotent does not necessarily mean “executed only once.”</strong></p><p>The server may receive the request multiple times, but what matters is that repeated identical requests have the same intended effect as a single request.</p><p>This distinction is also reflected in HTTP’s definition of idempotency. <a href="https://datatracker.ietf.org/doc/html/rfc9110?">RFC 9110 </a>defines an HTTP request method as idempotent when multiple identical requests have the same intended effect on the server as a single request. It identifies PUT, DELETE, and the safe HTTP methods as idempotent.</p><h3><strong>Why Do Duplicate Requests Happen?</strong></h3><p>Because networks fail.</p><p>A typical request might pass through these components:</p><pre>Client<br>   ↓<br>Internet<br>   ↓<br>Load Balancer<br>   ↓<br>API Gateway<br>   ↓<br>Application Server<br>   ↓<br>Database</pre><p>Every network boundary introduces the possibility of latency, timeout, disconnection, or failure.</p><p>Now consider this sequence:</p><ol><li>Client sends request</li><li>Server receives request</li><li>Server processes request</li><li>Database transaction succeeds</li><li>Server sends response</li><li>Connection fails</li><li>Client never receives response</li></ol><p>From the client’s perspective, the request appears to have failed.</p><p>But did it?</p><p>The client can’t always distinguish between:</p><ul><li>a request that never reached the server, and</li><li>a request that succeeded but whose response was lost.</li></ul><p>This is sometimes referred to as an <strong>ambiguous outcome, </strong>and when the client can’t determine what happened, it may retry.</p><h3>The Payment Problem</h3><p>Suppose your application has a payment endpoint:</p><pre>POST /payments<br>Content-Type: application/json<br><br>{<br>  &quot;amount&quot;: 5000,<br>  &quot;currency&quot;: &quot;NGN&quot;,<br>  &quot;customerId&quot;: &quot;cus_123&quot;<br>}</pre><p>The server receives the request and successfully processes the payment, then the connection drops before the client receives the response. The client sees something like “request timed out”, So it tries again.</p><p>The server receives another POST/payments request.</p><p>From the server’s perspective, this could be a completely new payment, or it could be the client’s attempt to retry the payment it just processed.</p><p>Without some way to distinguish between those two situations, the server could process the payment twice. The client didn’t necessarily do anything wrong, since retrying after a timeout can be a reasonable reliability strategy.</p><p>The problem is that the server needs a way to recognize that the second request represents the same logical operation.</p><h3>Idempotency Keys</h3><p>This is where <strong>idempotency keys</strong> come in.</p><p>An idempotency key is a unique identifier associated with a particular logical operation.</p><p>The client sends it along with the request:</p><pre>POST /payments<br>Idempotency-Key: 8f4b7c9e-...</pre><p>If the request needs to be retried, the client sends the same key, and the server can now recognize that both requests represent the same operation.</p><p>Conceptually:</p><pre>Request 1<br>    │<br>    │ Idempotency-Key: abc123<br>    ▼<br>  Server<br>    │<br>    ▼<br> Process payment<br>    │<br>    ▼<br> Store result<br><br><br>Request 2<br>    │<br>    │ Idempotency-Key: abc123<br>    ▼<br>  Server<br>    │<br>    ▼<br> Recognize previous operation<br>    │<br>    ▼<br> Return previous result</pre><p>This pattern is used by production APIs. Stripe, for example, supports idempotency keys for safely retrying requests and recommends using a sufficiently random identifier such as a UUID v4.</p><h3>How Does an Idempotent API Work?</h3><p>At a high level, the server needs to remember which idempotency keys it has already processed.</p><p>For a new key, the flow might look like this:</p><ol><li>Receive the request.</li><li>Validate the request.</li><li>Check the idempotency key.</li><li>Claim the key.</li><li>Process the operation.</li><li>Store the result.</li><li>Return the response.</li></ol><p>When the same key appears again, the server can retrieve the previous result instead of performing the operation again.</p><p>A simple idempotency table might contain:</p><p><strong>key:</strong> a unique identifier for the operation.</p><p><strong>request_hash:</strong> a fingerprint of the original request, useful for detecting attempts to reuse a key with different parameters.</p><p><strong>status:</strong> the current state of the operation, such as processing or completed.</p><p><strong>response_code:</strong> the HTTP status returned by the original request.</p><p><strong>response_body: </strong>the response associated with the operation, if your implementation stores it.</p><p><strong>created_at:</strong> when the idempotency record was created.</p><p><strong>expires_at:</strong> when the record can be removed.</p><p>There are different ways to design this.</p><p>One approach is to store the complete response associated with the key. A retry can then receive the same status code and response body, while another approach is to store the ID of the resource created by the operation.</p><p>For example:</p><pre>Idempotency-Key<br>      ↓<br>Payment ID<br>      ↓<br>Retrieve payment<br>      ↓<br>Construct response</pre><p>Neither approach is universally better. The appropriate design depends on the application and the guarantees you need.</p><p>Stripe’s API, for example, documents storing the resulting status code and response body for an idempotency key and returning that result when the same key is reused.</p><h3>The Race Condition Hiding in Your Idempotency Logic</h3><p>Here’s where implementing idempotency gets more interesting.</p><p>Imagine two identical requests arrive at almost exactly the same time. Both requests check whether the idempotency key exists, they both find that it doesn’t, and they both proceed.</p><p>Now you have:</p><pre>Request A ──→ Check key ──→ Doesn&#39;t exist ──→ Process payment<br>Request B ──→ Check key ──→ Doesn&#39;t exist ──→ Process payment</pre><p>The same payment could be processed twice.</p><p>This is a classic <strong>check-then-act race condition</strong>, and a naive implementation might look like this:</p><pre>if (!await idempotencyKeyExists(key)) {<br>  await createIdempotencyKey(key);<br>  await processPayment();<br>}</pre><p>The problem is that checking whether the key exists and creating it are separate operations.</p><p>Another request can slip in between them, so this means that simply having an idempotency table isn’t enough. The operation that claims the key must itself be safe when multiple requests happen concurrently.</p><h3>Making the Idempotency Check Atomic</h3><p>A relational database can enforce uniqueness at the database level:</p><pre>CREATE TABLE idempotency_keys (<br>    key VARCHAR(255) PRIMARY KEY,<br>    request_hash TEXT NOT NULL,<br>    status VARCHAR(20) NOT NULL,<br>    created_at TIMESTAMP NOT NULL<br>);</pre><p>Now two requests attempting to create the same key can’t both successfully insert it.</p><p>Conceptually:</p><pre>Request A<br>   ↓<br>Insert abc123<br>   ↓<br>Success<br>   ↓<br>Process<br><br><br>Request B<br>   ↓<br>Insert abc123<br>   ↓<br>Unique constraint<br>   ↓<br>Recognize duplicate</pre><p>Depending on the architecture, other approaches include atomic conditional writes, transactions, optimistic concurrency control, or distributed locks.</p><p>The important idea is that checking and claiming an idempotency key must be concurrency-safe.</p><h3>What Happens If the Server Crashes?</h3><p>Now consider a more difficult scenario.</p><p>The server receives the request, processes the operation, commits the database transaction, and then crashes before sending the response.</p><p>The client never receives confirmation, but it retries using the same idempotency key.</p><p>The system needs to know that the original operation already happened.</p><p>This is why idempotency isn’t simply an API feature.</p><p>It interacts with:</p><ul><li>database transactions,</li><li>durable storage,</li><li>concurrency,</li><li>failure recovery, and</li><li>external side effects.</li></ul><p>For example, imagine your API does this:</p><pre>Create order<br>    ↓<br>Charge payment provider<br>    ↓<br>Publish event<br>    ↓<br>Return response</pre><p>What happens if the application crashes after charging the payment provider but before publishing the event?</p><p>What happens if it publishes the event but crashes before recording that it did so?</p><p>These are no longer simple HTTP problems but distributed-systems problems.</p><h3>Idempotency in Distributed Systems</h3><p>Consider a basic event-driven architecture like this:</p><pre>             Order Service<br>                   │<br>                   ▼<br>             Message Broker<br>              /           \<br>             ▼             ▼<br>      Payment Service   Email Service</pre><p>The Order Service publishes an OrderCreated event; the message broker delivers it to the Payment Service; the Payment Service processes the payment, but crashes before acknowledging the message.</p><p>The broker may deliver the message again, and the consumer could therefore receive:</p><pre>OrderCreated<br>OrderCreated</pre><p>This is why consumers often need to be idempotent too.</p><p>One approach is to maintain a record of processed message IDs:</p><pre>processed_messages<br>------------------<br>message_id<br>processed_at</pre><p>When a message arrives, the consumer checks whether its ID has already been processed.</p><p>If it has, the consumer can avoid repeating the business operation. If it hasn’t, it processes the message and records the ID.</p><p>This is essentially the same principle applied at a different layer:</p><p>The same logical operation may arrive more than once, so repeating it shouldn’t create an unintended additional effect.</p><p>AWS recommends designing systems to handle duplicate events and requests safely, particularly in event-driven architectures where retries and duplicate deliveries can occur.</p><h3>Common Idempotency Mistakes</h3><h3>1. Generating a new key for every retry</h3><p>If the original request uses Idempotency-Key: abc123, and the retry uses Idempotency-Key: xyz789, the server sees two different operations.</p><p>A retry of the same logical operation should reuse the original key.</p><h3>2. Using predictable keys</h3><p>An idempotency key should be sufficiently unique. A value such as user-123-payment could create collisions or make accidental key reuse more likely.</p><p>Random, high-entropy identifiers are generally safer. Stripe recommends UUID v4 or another sufficiently random value.</p><h3>3. Using a non-atomic duplicate check</h3><p>Checking whether a key exists and then inserting it as separate operations can introduce a race condition. Concurrency needs to be handled at the storage or transaction level.</p><h3>4. Reusing a key for a different request</h3><p>Suppose a client sends Idempotency-Key: abc123 with an amount of 100. Later, it sends the same key with an amount of 500. Those shouldn’t become the same operation.</p><p>One approach is to store a fingerprint of the original request and reject subsequent requests that reuse the key with different parameters.</p><p>Stripe documents this behavior in its <a href="https://docs.stripe.com/api/idempotent_requests">API.</a></p><h3>5. Keeping keys forever</h3><p>Idempotency records need a retention policy. You may only need them for the period during which a retry is considered valid, and that period depends on your application’s retry behavior and business requirements.</p><h3>How to Test an Idempotent API</h3><p>If you’re implementing idempotency, testing only the happy path isn’t enough. The interesting bugs appear when things go wrong.</p><h3>Test 1. Send the same request twice</h3><p>Send the same request with the same idempotency key. Make sure to verify that only one intended business operation occurs.</p><h3>Test 2. Send duplicate requests concurrently</h3><p>Send two identical requests at approximately the same time. This tests whether your implementation can handle the race condition described earlier.</p><h3>Test 3. Reuse a key with different parameters</h3><p>Use the same idempotency key with a different request body. The system should reject the conflicting request rather than just treating it as the original operation.</p><h3>Test 4. Simulate a timeout</h3><p>Allow the server to complete the operation but prevent the client from receiving the response, then retry using the same key. The retry should not create another business operation.</p><h3>Test 5. Simulate a server crash</h3><p>Test failures at different stages of the operation:</p><ul><li>before the database transaction commits,</li><li>after the transaction commits,</li><li>after an external side effect,</li><li>before the response is returned.</li></ul><p>This is where you’ll find out whether your idempotency design actually handles failure or only works during normal execution.</p><h3>Conclusion</h3><p>Distributed systems are built on components that communicate over networks, and networks aren’t perfectly reliable.</p><p>A request can succeed while its response is lost, a message can be delivered more than once, a worker can crash after performing an operation but before acknowledging it, a client can retry because it can’t determine whether the original request succeeded.</p><p>These aren’t unusual edge cases. They’re fundamental problems that reliable systems have to account for.</p><p>Idempotency gives us a way to make those failures safer, but implementing it properly requires more than generating a UUID.</p><p>You need to think about how requests are identified, how duplicate operations are detected, how concurrent requests are handled, how state is persisted, what happens when a server crashes, and how downstream services handle retries.</p><p>The goal isn’t to prevent every duplicate request from reaching your system, because that is often impossible.</p><p>The goal is to make sure that a duplicate attempt doesn’t become a duplicate business operation, and that is the real value of idempotency.</p><p>Reliable systems are designed to make retries safe, not assume that requests will happen exactly once.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4436cf1ec1f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building gRPC + REST Hybrid Backends]]></title>
            <link>https://medium.com/@chidinmaosonwa-paul/building-grpc-rest-hybrid-backends-7e104894caea?source=rss-558fdb2cc9a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e104894caea</guid>
            <category><![CDATA[grpc-gateway]]></category>
            <category><![CDATA[backend-architecture]]></category>
            <category><![CDATA[hybrid-model]]></category>
            <category><![CDATA[rest-architecture]]></category>
            <category><![CDATA[grpc]]></category>
            <dc:creator><![CDATA[Chidinma Osonwa-Paul]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 18:06:15 GMT</pubDate>
            <atom:updated>2026-05-09T21:55:03.887Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Practical Guide for Modern Backend Systems</h3><p>“Should we use REST or gRPC?”</p><p>This question sounds reasonable, but in production, it is often the wrong one. Real systems are not built around protocol purity, but mostly around constraints like performance, tooling, client expectations, and team structure.</p><p>That is why many modern backends just settle into a hybrid model: REST for external APIs, and gRPC for internal communication. This approach combines the strengths of both protocols while avoiding their weaknesses.</p><p>This article explains why gRPC + REST hybrid architectures exist, when they make sense, and how to implement them cleanly, especially in Node.js environments.</p><h3>Why REST Alone Starts to Break Down</h3><p>REST works well for many applications, but as systems scale, some limitations become obvious. For instance, JSON over HTTP becomes inefficient for high-throughput internal communication, there is no strict contract enforcement between services, versioning becomes painful across multiple microservices, streaming and real-time data are not so easy to implement, and latency increases with verbose payloads.</p><p>For public APIs, these trade-offs could be acceptable, but for internal service-to-service communication, they are not.</p><h3>Why gRPC Excels for Internal Communication</h3><p><a href="https://www.wallarm.com/what/the-concept-of-grpc">gRPC (<strong>google Remote Procedure Call</strong>) </a>was designed specifically for distributed systems. Its key strengths include:</p><p><strong>1. Efficient binary serialization (Protocol Buffers)</strong></p><p>Data is encoded in a compact binary format rather than JSON, resulting in smaller payloads and significantly faster parsing, especially under high throughput.</p><p><strong>2. Strong service contracts</strong></p><p>APIs are defined using schemas that are enforced at compile time, reducing runtime errors and preventing accidental breaking changes between services.</p><p><strong>3. Built-in streaming support</strong></p><p>gRPC supports client-side/server-side and bi-directional streaming out of the box, making it well-suited for real-time data flows and long-lived connections.</p><p><strong>4. Language-agnostic client and server SDKs</strong></p><p>Services written in different languages can communicate reliably using generated SDKs, enabling true polyglot microservice architectures.</p><p><strong>5. HTTP/2 as the transport layer</strong></p><p>Features like multiplexing, header compression, and persistent connections reduce latency and improve performance compared to traditional HTTP/1.1-based APIs.</p><p>For internal microservices, gRPC often outperforms REST in both speed and developer productivity.</p><h3>Why Not Expose gRPC Directly to Clients?</h3><p>Despite its advantages, gRPC is not ideal for public APIs for the following reasons:</p><ol><li><strong>Limited browser support</strong></li></ol><p>Browsers do not natively support gRPC, requiring additional layers such as gRPC-Web, which adds complexity and tooling overhead.</p><p><strong>2. More difficult debugging and inspection</strong></p><p>Binary payloads make gRPC requests harder to inspect and debug compared to plain HTTP and JSON used by REST APIs.</p><p><strong>3. Higher friction for third-party consumers</strong></p><p>Most external clients expect standard HTTP endpoints with JSON responses, not generated SDKs and protobuf definitions.</p><p><strong>4. Ecosystem built around REST</strong></p><p>Existing infrastructure, such as caches, proxies, API gateways and monitoring tools, is primarily designed for RESTful HTTP traffic, making gRPC harder to integrate at the edge.</p><p>This is why most production systems do not expose gRPC directly to external consumers.</p><h3><a href="https://zuplo.com/blog/grpc-api-gateway">The Hybrid Model: gRPC Inside, REST Outside</a></h3><p>A gRPC + REST hybrid backend typically looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y1M9RVDg-3-25SiqXiABNw.png" /></figure><p>Responsibilities Split:</p><ul><li><strong>REST:</strong> Public APIs, authentication, rate limiting, backward compatibility, developer experience</li><li><strong>gRPC:</strong> Internal communication, high-performance data exchange, streaming, strong contracts between teams</li></ul><p>This separation keeps the system fast internally and friendly externally.</p><h3>Node.js in a Hybrid Architecture</h3><p>Node.js integrates naturally into a hybrid gRPC + REST architecture, especially when deployed at the edge of the system.</p><h3>Common Node.js Roles</h3><ol><li><strong>REST Gateway / BFF (Backend-for-Frontend)</strong>: In many hybrid systems, Node.js powers the public-facing layer. Using frameworks like Express, Fastify or NestJS, it handles:</li></ol><ul><li>HTTP request/response cycles</li><li>Authentication and authorization</li><li>Input validation</li><li>Data transformation and response shaping for clients</li></ul><p>At this layer, Node.js acts as the translator between the outside world and internal services. It absorbs the complexity of HTTP so downstream services do not have to.</p><p><strong>2. gRPC Client Layer: </strong>From the gateway, Node.js communicates with internal services via gRPC, commonly using @grpc/grpc-js.</p><p>Here, <a href="http://node.js/">Node.js</a> could do the following:</p><ul><li>Establish and manage gRPC connections</li><li>Send strongly-typed requests defined by Protocol Buffers</li><li>Translate gRPC responses into JSON for external consumers</li></ul><p>This keeps internal communication efficient while still maintaining a clean public interface.</p><p><strong>3. Hosting gRPC Services: </strong>Node.js can also run gRPC servers directly, particularly for I/O-heavy or coordination-based services. However, for CPU-intensive workloads, many teams often prefer languages like Go or Rust for better performance characteristics.</p><h3>Versioning Strategy in gRPC + REST Hybrid Backends</h3><p>API versioning is one of the hardest parts of backend architecture, especially in a gRPC + REST hybrid system where you manage both internal and external APIs.</p><h3>gRPC Versioning</h3><p>For gRPC services, the rule is to evolve without breaking contracts.</p><ul><li>Make additive changes only</li><li>Don’t remove or rename existing fields</li><li>Introduce new fields instead of modifying old ones</li><li>Create new services or methods for major changes</li></ul><h3>REST API Versioning</h3><ul><li>REST versioning happens at the HTTP boundary.</li><li>Use explicit versions such as /v1 and /v2</li><li>Treat REST as a presentation layer over gRPC</li><li>Map multiple REST versions to the same gRPC services when possible</li></ul><p>This separation allows you to evolve public APIs without constantly refactoring internal services (which is one of the key advantages of a hybrid backend architecture).</p><h3>Security in Hybrid Backends</h3><p>Security responsibilities should be clearly split into:</p><ul><li><strong>REST Gateway:</strong> OAuth / JWT, rate limiting, input validation, public attack surface protection</li><li><strong>gRPC Services:</strong> Mutual TLS (mTLS), internal authorization, zero-trust assumptions</li></ul><h3>Common Mistakes to Avoid</h3><ul><li>Exposing gRPC directly to browsers</li><li>Duplicating business logic in REST and gRPC layers</li><li>Treating REST and gRPC as equal peers instead of layered responsibilities</li><li>Ignoring<a href="https://protobuf.dev/"> protobuf</a> evolution rules</li><li>Forgetting observability early</li></ul><h3>When Should You Use a gRPC + REST Hybrid Backend?</h3><p>A gRPC + REST hybrid backend is not something you adopt simply because it is trending. It becomes the right architectural choice when your backend system begins to grow beyond a single service, and when performance, scalability and team coordination start to matter.</p><p>You should consider a hybrid API architecture when:</p><ul><li>Your system consists of multiple internal microservices that require fast and efficient service-to-service communication.</li><li>Internal performance and low latency are critical to your backend operations.</li><li>You need to expose public APIs to browsers, mobile applications or third-party developers who expect RESTful HTTP endpoints.</li><li>Different engineering teams own separate services and need strongly defined contracts to prevent breaking changes.</li><li>You are designing for long-term scalability and want an architecture that can evolve without major rewrites.</li></ul><p>For small or early-stage applications, a REST-only backend is often sufficient. However, as systems scale and microservices multiply, a gRPC + REST hybrid architecture provides the balance between internal performance and external compatibility that modern backend systems require.</p><h3>Conclusion</h3><p>gRPC + REST hybrid backends are a pragmatic response to real production problems, so using REST where it excels and gRPC where it matters most allows teams to build systems that are both developer-friendly and operationally robust.</p><p>If you are building or scaling a serious backend system in Node.js, understanding this architecture has become standard practice and is no longer optional.</p><p><em>Thank you for reading until the end. Before you go:</em></p><ul><li><em>Please clap and follow the writer.</em></li><li><em>Connect with me on </em><a href="https://medium.com/www.linkedin.com/in/chidinma-osonwa-paul"><em>LinkedIn</em></a><em> and </em><a href="https://x.com/jewelchidinma?s=21"><em>Twitter.</em></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e104894caea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Middleware in Express.js]]></title>
            <link>https://medium.com/@chidinmaosonwa-paul/understanding-middleware-in-express-js-8d0f8c007d11?source=rss-558fdb2cc9a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d0f8c007d11</guid>
            <category><![CDATA[middleware]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Chidinma Osonwa-Paul]]></dc:creator>
            <pubDate>Thu, 27 Nov 2025 09:03:51 GMT</pubDate>
            <atom:updated>2025-11-27T09:03:51.111Z</atom:updated>
            <content:encoded><![CDATA[<p>When you first start using Express.js, it’s easy to treat it casually because you write app.get() routes, send responses, and things work. But outside of what you see, something is enabling that smooth flow: middleware.</p><p>Middleware is what gives Express its flexibility. It allows you to log requests, validate users, handle errors, parse JSON, and so much more, all without repeating code in every route.</p><p>In this article, you will learn what middleware is, types of middleware in Express, how it works in Express, common middleware mistakes and how to avoid them.</p><h3>What Is Middleware in Express.js?</h3><p>At its simplest, middleware is a function that runs between a request and a response.</p><p>Every time a client sends a request to your Express server, that request doesn’t go straight to your endpoint. Instead, it passes through a series of middleware functions, and each one can inspect, modify or stop the request before it reaches its final destination.</p><p>Here’s the simplest form of a middleware function:</p><pre>app.use((req, res, next) =&gt; {<br> console.log(&#39;Request received&#39;);<br><br>//To pass control to the next middleware<br> next(); });</pre><p>The three main parameters req, res, and next are what make a middleware work:</p><ul><li><strong>req:</strong> this parameter contains information about the HTTP request (headers, body, params, etc.).</li><li><strong>res:</strong> this parameter lets you send a response back to the client.</li><li><strong>next():</strong> this parameter passes control to the next middleware in the stack.</li></ul><p>If you don’t call next(), the request stops there.</p><h3><strong>The Request-Response Lifecycle</strong></h3><p>In Express.js, every incoming request goes through a series of steps before a response is returned. These steps are handled by middleware functions, which are the core of how Express processes data.</p><p>When a request arrives, Express doesn’t respond immediately. Instead, it passes the request through several middleware functions. Each middleware performs a specific task:</p><ul><li>One middleware might log the request details.</li><li>Another might check authentication or permissions.</li><li>Another might parse the request body or add useful information to the request object.</li></ul><p>Each middleware does its job and then hands the request over to the next one. Once the final handler is reached, Express builds the actual response and sends it back to the client.</p><p>This entire journey, from the moment the server receives a request to the moment it sends a response, is known as the <strong>request-response lifecycle in Express.js</strong>. It’s a fundamental concept for anyone building APIs or backend applications with Node.js.</p><p><strong>Visually:</strong></p><p>Request — (Middleware 1) — (Middleware 2) — (Route Handler) — Response</p><p>For example:</p><pre>app.use((req, res, next) =&gt; {<br> console.log(&#39;1. Logging middleware&#39;);<br> next();<br>});<br><br>app.use((req, res, next) =&gt; {<br> console.log(&#39;2. Authentication middleware&#39;);<br> next();<br>});<br><br>app.get(&#39;/&#39;, (req, res) =&gt; {<br> res.send(&#39;Hello from the route!&#39;);<br>});</pre><p><strong>Output when you visit /:</strong></p><p>1. Logging middleware</p><p>2. Authentication middleware</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ypCYmYNYZtuNiei610aNSg.jpeg" /><figcaption>Image from <a href="https://xiphcyber.com/articles/middleware-guide">xiphcyber</a></figcaption></figure><h3>Types of Middleware in Express</h3><p>Express comes in different layers, depending on where and how it’s used, and they include the following:</p><h4><strong>1. Application-Level Middleware</strong></h4><p>This refers to middleware functions that apply to the entire app for all routes. They are not meant for a specific route alone, and they are mostly registered with <em>app.use()</em>, or route methods like <em>app.get()</em>.</p><p>An example is a simple request logger:</p><pre>app.use((req, res, next) =&gt; {<br> console.log(`${req.method} ${req.url}`);<br> next();<br>});</pre><p>If you want it to apply only to certain routes:</p><pre>app.use(&#39;/api&#39;, (req, res, next) =&gt; {<br> console.log(&#39;API request logged&#39;);<br> next();<br>});</pre><h4><strong>2. Router-Level Middleware</strong></h4><p>As your app grows, it is best to separate routes using <em>express.Router()</em>. Router-level middleware works exactly like app-level middleware, but is attached to a specific router. It refers to middleware functions that are bound to a specific instance of the Express router. It is also often used to group related routes (e.g., all routes related to authentication or user management) and apply middleware logic to them.</p><pre>const express = require(&#39;express&#39;);<br><br>const router = express.Router();<br><br>router.use((req, res, next) =&gt; {<br> console.log(&#39;Router middleware triggered&#39;);<br> next();<br>});<br><br>router.get(&#39;/users&#39;, (req, res) =&gt; {<br> res.send(&#39;User list&#39;);<br>});<br><br>app.use(&#39;/api&#39;, router);</pre><p>Visiting “/api/users” will trigger the router middleware before hitting the route.</p><h4>3. Built-in Middleware</h4><p>Express provides several useful middleware functions out of the box. So this refers to middleware functions that are included in the Express framework by default. The purpose is to make it easy for developers to handle tasks without having to start from scratch.</p><p>Examples are:</p><ul><li><strong>express.json()</strong>- this parses incoming JSON payloads.</li><li><strong>express.urlencoded()</strong>- this parses URL-encoded data (form submissions).</li><li><strong>express.static()</strong>- this serves static files like images, CSS, or JavaScript.</li></ul><p>Code example:</p><pre>app.use(express.json());<br><br>app.use(express.static(&#39;public&#39;));</pre><p>Built-in middleware functions save you from installing extra packages for common tasks.</p><h4>4. Third-Party Middleware</h4><p>These are middleware functions that are developed by external developers and are not part of the core Express ecosystem. You can install external middleware to extend your app’s capabilities or to add extra functionality.</p><p>Common examples are:</p><ul><li><strong>Morgan:</strong> for logging HTTP requests.</li><li><strong>Cors:</strong> enables cross-origin resource sharing.</li><li><strong>Helmet:</strong> adds security headers.</li></ul><p>Example:</p><p>(Install the middlewares first)</p><pre>npm install morgan cors helmet</pre><pre>const morgan = require(&#39;morgan&#39;);<br><br>const cors = require(&#39;cors&#39;);<br><br>const helmet = require(&#39;helmet&#39;);<br><br>app.use(morgan(&#39;dev&#39;));<br><br>app.use(cors());<br><br>app.use(helmet());</pre><h3>How Middleware Works</h3><p>Middleware runs in sequence, from top to bottom, exactly as you define it in your code. This order determines the flow of control.</p><p>For example:</p><pre>app.use((req, res, next) =&gt; {<br> console.log(&#39;First middleware&#39;);<br> next();<br>});<br><br>app.use((req, res, next) =&gt; {<br> console.log(&#39;Second middleware&#39;);<br> next();<br>});<br><br>app.get(&#39;/&#39;, (req, res) =&gt; {<br> res.send(&#39;Final route handler&#39;);<br>});</pre><p><strong>Console output:</strong></p><p>First middleware</p><p>Second middleware</p><p>The request passes through the stack until a response is sent. Once a middleware sends a response (like<em> res.send()</em>), Express stops moving to the next function.</p><p>That’s why <em>next()</em> is important, and forgetting to add “next” freezes your request indefinitely.</p><h3>Common Middleware Mistakes and How to Avoid Them</h3><ol><li><strong>Forgetting to call next(): </strong>This stops the request mid-way, causing the browser to hang.</li><li><strong>Wrong order of middleware: </strong>For example, placing authentication after route definitions won’t protect them. In this case, authentication has to come first.</li><li><strong>Mixing async functions without error handling: </strong>Always wrap async middleware with try/catch or use an async wrapper to pass errors to your global handler.</li><li><strong>Overusing global middleware: </strong>Don’t attach everything to app.use()because it adds unnecessary overhead. Use router-level middleware for modular control.</li></ol><h3>Best Practices for Writing Clean Middleware</h3><ul><li><strong>Keep middleware focused on a single responsibility: </strong>Example: one for logging, one for authentication, one for validation.</li><li><strong>Organize middleware into separate files:</strong></li></ul><p>middleware/</p><p>logger.js</p><p>auth.js</p><p>errorHandler.js</p><ul><li><strong>Use async/await responsibly: </strong>Always handle rejected promises to avoid unhandled rejections.</li><li><strong>Leverage third-party libraries wisely: </strong>If something reliable already exists (like Helmet for security), use it.</li><li><strong>Order matters, so you should structure wisely: </strong>Security and parsing middleware (like helmet, express.json()) should come early, while error handling should always be last.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d0f8c007d11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Basics of Web Development: A Comprehensive Guide for Beginners]]></title>
            <link>https://medium.com/@chidinmaosonwa-paul/the-basics-of-web-development-a-comprehensive-guide-for-beginners-05841063411d?source=rss-558fdb2cc9a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/05841063411d</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Chidinma Osonwa-Paul]]></dc:creator>
            <pubDate>Mon, 26 May 2025 10:24:41 GMT</pubDate>
            <atom:updated>2025-05-26T10:24:41.870Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G8ATYqNfs2g2j1G_vzNEUg.png" /><figcaption>An illustration showing the roadmaps in web development</figcaption></figure><p>Have you ever wondered how websites like Facebook, Amazon or your favorite blog are built? If you have, then you’re stepping into the world of web development. Every website you visit, from your favorite social media platform to an online shopping site, was created by a web developer. Simply put, web development involves creating websites and web applications that people use every day.</p><p>This article breaks down the fundamentals of web development in a simple, beginner-friendly way. If you’re looking to build your first website or pursue a tech career, this guide offers a solid foundation.</p><h3>What is web development?</h3><p>Web development refers to the process of building and maintaining websites or web applications that run on the internet. It involves a combination of coding, designing and managing web technologies to create user-friendly and functional online experiences.</p><p>There are three main categories of web development:</p><ul><li><strong>Frontend development</strong>: This refers to everything the user sees and interacts with on a website, like buttons, layout, images and animations.</li><li><strong>Backend development</strong>: This is the behind-the-scenes part/server-side operations that handle data and logic.</li><li><strong>Full-stack development</strong>: This is a combination of both frontend and backend development.</li></ul><h3>Frontend Development</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MEMphFdLCPNJaP4lPPcpGA.png" /><figcaption>An illustration showing the core technologies of frontend development</figcaption></figure><p>If you love design and making things interactive, frontend development might be the best stack to pursue in tech. Frontend development focuses on the visual layout and interactive elements of a website (the part users directly engage with).</p><h3>Core technologies of frontend development</h3><ul><li><a href="https://www.theserverside.com/definition/HTML-Hypertext-Markup-Language"><strong>HTML (HyperText Markup Language)</strong></a>: This is the skeleton of all web pages; it structures the content like texts, images and links.</li><li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS"><strong>CSS (Cascading Style Sheets)</strong></a>: This handles the styling of the website, like colours, fonts, spacing and layout to make sure the web page is visually appealing.</li><li><a href="https://www.geeksforgeeks.org/introduction-to-javascript/"><strong>JavaScript</strong></a>: This adds interactivity like buttons, forms, sliders, and animations (CSS makes it look good, while JavaScript makes it work).</li></ul><h3>Popular tools and frameworks for frontend development</h3><ul><li><a href="http://react.js/"><strong>React.js</strong></a>: A popular JavaScript library for building fast and dynamic user interfaces.</li><li><a href="https://www.techtarget.com/whatis/definition/bootstrap"><strong>Bootstrap</strong></a>: A CSS framework for responsive design on all devices.</li><li><strong>Design tools: </strong>These include Figma or Adobe XD for designing website mockups before coding (they are mostly used by UI/UX designers).</li></ul><h3>Frontend developer responsibilities</h3><ul><li>Building responsive layouts that work on all devices</li><li>Implementing designs based on wireframes or mockups</li><li>Ensuring accessibility and performance optimization</li></ul><h3>Backend Development</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mhI9EUFByg4UUYuJCUinQw.png" /><figcaption>An illustration showing the core technologies of backend development</figcaption></figure><p>While the frontend is what users see, backend development deals with the server, databases, and APIs that power the frontend. Although users don’t directly see the backend, it enables everything from authentication to storing user data.</p><h3>Core technologies of backend development</h3><p><strong>Programming languages</strong>:</p><ul><li>JavaScript(<a href="https://nodejs.org/en/about">Node.js</a>)</li><li><a href="https://www.ruby-lang.org/en/about/">Ruby</a></li><li><a href="https://www.python.org/about/">Python</a>(Django and Flask)</li><li><a href="https://www.php.net/manual/en/introduction.php">PHP</a></li><li><a href="https://www.java.com/en/download/help/whatis_java.html">Java</a></li><li><a href="https://go.dev/">Golang</a></li><li><a href="https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/overview">C#</a></li></ul><p><strong>Databases</strong>:</p><ul><li><a href="https://www.hostinger.com/tutorials/what-is-mysql">MySQL</a></li><li><a href="https://www.postgresql.org/about/">PostgreSQL</a></li><li><a href="https://www.techtarget.com/searchdatamanagement/definition/MongoDB">MongoDB</a></li><li><a href="https://mariadb.org/about/">MariaDB</a></li><li><a href="https://builtin.com/data-science/sqlite">SQLite</a></li><li><a href="https://redis.io/about/">Redis</a></li><li><a href="https://cassandra.apache.org/_/cassandra-basics.html">Apache Cassandra</a></li></ul><p><strong>Web servers</strong>:</p><ul><li>Apache</li><li><a href="https://www.hostinger.com/tutorials/what-is-nginx">Nginx</a></li></ul><p>Cloud services like;</p><ul><li><a href="https://en.wikipedia.org/wiki/Heroku">Heroku</a></li><li>Render</li><li><a href="https://en.wikipedia.org/wiki/Amazon_Web_Services">AWS</a></li></ul><p><strong>APIs (Application Programming Interface)</strong></p><ul><li>RESTful APIs</li><li>SOAP</li><li>GraphQL</li><li>Webhooks</li><li>gRPC</li></ul><h3>Backend developer responsibilities</h3><ul><li>Writing server-side logic</li><li>Building APIs (Application Programming Interfaces)</li><li>Managing databases and ensuring data security</li><li>Handling user authentication and authorization</li></ul><h3>Full-Stack Development</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MEMphFdLCPNJaP4lPPcpGA.png" /><figcaption>An illustration showing what full-stack development entails</figcaption></figure><p>A full-stack developer is skilled in both frontend and backend development, building complete web applications independently. This makes them highly valuable in startups and small teams.</p><p>Popular full-stack stacks include:</p><ul><li><strong>MERN</strong>: MongoDB, Express.js, React.js, Node.js</li><li><strong>MEAN</strong>: MongoDB, Express.js, Angular, Node.js</li><li><strong>LAMP</strong>: Linux, Apache, MySQL, PHP</li><li><strong>LEMP: </strong>Linux, Engine-X, MySQL, PHP</li></ul><h3>How does it work? Web development process</h3><p>Building a web application involves several stages:</p><ol><li><strong>Planning and research: </strong>Define your site’s purpose, target audience and core features.</li><li><strong>Design: </strong>Use wireframes or design tools to create a visual layout.</li><li><strong>Development: </strong>Code the frontend and backend components.</li><li><strong>Testing: </strong>Check for bugs, broken links, compatibility, speed and performance issues.</li><li><strong>Deployment: </strong>Publish the site using services like GitHub Pages, Vercel, Netlify or cloud providers like the ones listed above.</li><li><strong>Maintenance: </strong>Regularly update content, fix issues, and improve features.</li></ol><h3>Version control and collaboration</h3><p>An important part of web development is <strong>version control</strong>, which tracks changes in your codebase. When coding starts becoming complex or multiple people work together, keeping track of changes is extremely important, and that’s where <strong>Git</strong> and platforms like <strong>GitHub</strong> come in.</p><ul><li><strong>Git</strong>: The most popular version control system. It tracks every change you make in your code.</li><li><strong>GitHub</strong>, <strong>GitLab</strong> or <strong>Bitbucket</strong>: Platforms for hosting repositories, managing issues, and collaborating on projects.</li></ul><p>Version control allows multiple developers to work on a project without overwriting each other’s changes. Also, learning Git early will save you headaches later and open doors to contributing to open-source projects.</p><h3>Essential soft skills for web developers</h3><p>Technical skills are important, but so are soft skills:</p><ul><li><strong>Problem-solving</strong>: Debugging errors and optimizing performance.</li><li><strong>Communication</strong>: Working with designers, stakeholders, or clients.</li><li><strong>Continuous learning</strong>: Staying updated with new frameworks and best practices, as web development evolves very fast.</li></ul><h3>Getting started: A beginner’s roadmap</h3><ol><li><strong>Learn HTML, CSS, and JavaScript: </strong>Start with the basics of web structure, styling, and interactivity.</li><li><strong>Practice building simple projects: </strong>Try building a personal portfolio, a blog, or a to-do list app.</li><li><strong>Understand Git and GitHub: </strong>Learn how to use version control and contribute to open-source projects.</li><li><strong>Learn a backend language: </strong>Choose Node.js or Python to start building simple server applications.</li><li><strong>Deployment: </strong>Learn how to host your projects online using platforms like Vercel or Netlify.</li><li><strong>Join developer communities: </strong>Connect with others through forums like <a href="https://stackoverflow.com/questions">Stack Overflow</a>, <a href="https://dev.to/">Dev.to</a> or <a href="https://github.com/community">GitHub</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05841063411d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Document Your API with Postman: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@chidinmaosonwa-paul/how-to-document-your-api-with-postman-a-step-by-step-guide-476093b6d278?source=rss-558fdb2cc9a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/476093b6d278</guid>
            <category><![CDATA[postman]]></category>
            <category><![CDATA[documentation]]></category>
            <category><![CDATA[postmanapi]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Chidinma Osonwa-Paul]]></dc:creator>
            <pubDate>Mon, 19 May 2025 12:14:46 GMT</pubDate>
            <atom:updated>2025-05-19T12:14:46.954Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Postman API platform" src="https://cdn-images-1.medium.com/max/1024/1*lCAnYnetjU5n5T7lSECZmQ.jpeg" /><figcaption>Source:<a href="https://www.postman.com/"> Postman</a></figcaption></figure><p>If you’ve ever been handed an <a href="https://www.postman.com/what-is-an-api/">API</a> without documentation, you know the struggle is real. If you’re building an API, testing one, or writing docs for it, chances are you’ve used Postman. It’s not just a tool for sending requests. Postman also makes API documentation very easy to generate, update, and share.</p><p>In this post, I’ll show you exactly how to document your API with Postman. By the end of this post, you’ll be able to publish clear interactive documentation that others can actually use and understand. But before I do that…</p><h3>Why document APIs in Postman?</h3><ul><li>It is beginner-friendly and requires no setup</li><li>Generates live, interactive docs</li><li>Supports versioning and examples</li><li>Lets you collaborate with your team in real-time</li><li>You can share a public or private URL instantly</li></ul><p>Before we get into it, here’s what you should have ready:</p><ul><li>A free <a href="https://www.postman.com/">Postman account</a></li><li>An API you’ve already tested or are working on</li><li>Basic knowledge of how your API works</li></ul><p><strong>Step-by-step: how to document APIs in Postman</strong></p><p><strong>Step 1: create a collection</strong></p><p>Collections are like folders for your API endpoints. They help you organize your requests and are they are the foundation for your documentation.</p><h4>Example:</h4><p>Let’s say you’re building a User Management API. Start by creating a collection named exactly that.</p><ol><li>Open Postman.</li><li>Click <strong>“New”</strong> &gt; <strong>“Collection”</strong>.</li><li>Name it User Management API.</li><li>Add a short description like:</li></ol><p>“This collection contains all endpoints for managing users: register, login, profile updates, and more.”</p><h3>Step 2: add API requests to your collection</h3><p>Now, start adding the actual API endpoints:</p><ul><li>Click the <strong>“+”</strong> tab to open a new request.</li><li>Choose the HTTP method (GET, POST, PUT, DELETE etc.).</li><li>Enter the URL and any required headers or body data.</li><li>Save it to your collection.</li><li>Add a request name like Register User (remember we’re still working with the User Management API example)</li><li>It should look like this: POST /api/users/register</li></ul><p>Then, under the “Documentation” tab:</p><ul><li>Describe what the endpoint does</li><li>List required fields (like name, email, password)</li><li>Mention validation rules or auth requirements</li></ul><h4>An example of the description:</h4><p>“Registers a new user. All fields are required. Passwords must be at least 8 characters long. Returns a JWT token on success.”</p><h3>Step 3: add request body and parameters</h3><p>In the <strong>Body</strong> tab, select <strong>raw</strong> and choose JSON.</p><pre>{<br> “name”: “Jewel Chidinma”,<br> “email”: “jewelchidinma@gmail.com”,<br> “password”: “SecurePass123”<br>}</pre><p>In the <strong>Headers</strong> tab:</p><ul><li>Add Content-Type: application/json</li></ul><p>If your endpoint accepts query parameters or path variables, document them too in the <strong>Params</strong> or <strong>Path Variables</strong> tab.</p><h3>Step 4: save example responses</h3><p>Example responses make your documentation interactive and the users can see what to expect from the API. You can save actual responses from your API and display them in your documentation.</p><p>How to add examples:</p><ol><li>Click “send” on the request to see the response.</li><li>When you get the response, click the three dots (…) in the response section</li><li>Select <strong>“Save as example”</strong>.</li><li>Give the example a name like “201 OK — User Registered Successfully”</li></ol><p>Example response:</p><pre>{<br> “message”: “User registered successfully.”,<br> “user”: {<br> “id”: “6245fa8c91d5f0a3f9c13b2e”,<br> “email”: “jewelchidinma@gmail.com”<br> },<br> “token”: “eyJhbGciOiJIUzI1NiIsInR…”<br>}</pre><p>You can also add examples for errors like:</p><ul><li>400 Bad Request for invalid email</li><li>409 Conflict for duplicate user</li><li>500 Internal Server Error</li></ul><h3>Step 5: organize your endpoints with folders</h3><p>If your API has multiple modules (Auth, Users, Products, Orders), create folders inside your collection to group them.</p><p><strong>Example:</strong></p><pre>User Management API<br>├── Auth<br>│ ├── Register<br>│ └── Login<br>├── Profile<br>│ ├── Get Profile<br>│ └── Update Profile<br>├── Admin<br>│ └── Get All Users</pre><h3>Step 6: publish your documentation</h3><p>Once everything is done:</p><ol><li>Go to your collection.</li><li>Click the <strong>“View in Web”</strong> button (top right corner)</li><li>Once you’re on the web dashboard, click <strong>“Publish Docs”</strong>.</li><li>Choose a custom name, decide if it should be <strong>public or private</strong>, and hit publish.</li></ol><p>Postman will give you a shareable link like:<br><a href="https://learning.postman.com/docs/publishing-your-api/api-documentation-overview/">(https://documenter.getpostman.com/view/your-api-docs)</a></p><p>People can now click through your endpoints and see sample requests/responses.</p><h3>Best practices for API documentation in Postman</h3><ul><li>Use clear request names for your endpoints, and not something like “Untitled Request 1”</li><li>Add descriptions for each endpoint so that others can understand the purpose</li><li>Include example responses to show the real output of the API</li><li>Document error codes to prevent confusion when anything goes wrong</li><li>Group related requests (e.g., Auth, Users, Payments)</li><li>Use versioning especially for production APIs</li><li>Update your docs regularly</li></ul><p><a href="https://www.postman.com/api-platform/api-documentation/">You can read more on API documentation here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=476093b6d278" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>