<?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>DEV Community: David Shemang</title>
    <description>The latest articles on DEV Community by David Shemang (@shemzz).</description>
    <link>https://dev.to/shemzz</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F509480%2Fd5b7abec-b7fc-4ccb-89a9-2dee6089fd7a.jpg</url>
      <title>DEV Community: David Shemang</title>
      <link>https://dev.to/shemzz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shemzz"/>
    <language>en</language>
    <item>
      <title>The Expensive Convenience of Someone Else's Intelligence</title>
      <dc:creator>David Shemang</dc:creator>
      <pubDate>Fri, 27 Nov 2026 10:59:00 +0000</pubDate>
      <link>https://dev.to/shemzz/the-expensive-convenience-of-someone-elses-intelligence-jc2</link>
      <guid>https://dev.to/shemzz/the-expensive-convenience-of-someone-elses-intelligence-jc2</guid>
      <description>&lt;p&gt;There's something fascinating about how little you need to know about artificial intelligence to build a product powered by it today.&lt;/p&gt;

&lt;p&gt;A few lines of code. An API key. A reasonably well-structured prompt.&lt;/p&gt;

&lt;p&gt;And suddenly, your application can understand language, reason through problems, write code, analyse documents, or hold a conversation.&lt;/p&gt;

&lt;p&gt;You don't need to understand how a transformer works. You don't need to train a model. You certainly don't need a warehouse full of GPUs.&lt;/p&gt;

&lt;p&gt;Someone else has already done the difficult part.&lt;/p&gt;

&lt;p&gt;You simply rent the intelligence.&lt;/p&gt;

&lt;p&gt;And for a while, it feels like one of the greatest bargains in software engineering.&lt;/p&gt;

&lt;p&gt;Until you begin to realise that the intelligence is not the only thing you're renting.&lt;/p&gt;

&lt;p&gt;You're also renting someone else's infrastructure decisions.&lt;/p&gt;

&lt;p&gt;Their availability.&lt;/p&gt;

&lt;p&gt;Their performance characteristics.&lt;/p&gt;

&lt;p&gt;Their pricing structure.&lt;/p&gt;

&lt;p&gt;Their model lifecycle.&lt;/p&gt;

&lt;p&gt;And, to an extent, their priorities.&lt;/p&gt;

&lt;p&gt;None of this is necessarily a problem when you're getting started.&lt;/p&gt;

&lt;p&gt;In fact, I'd argue that renting intelligence is one of the smartest decisions most AI startups can make.&lt;/p&gt;

&lt;p&gt;But there's an interesting point in the life of an AI product when the convenience that helped you build it begins to influence what the product can become.&lt;/p&gt;

&lt;p&gt;And I think we're only beginning to appreciate how important that transition is.&lt;/p&gt;

&lt;h2&gt;
  
  
  We Have Become Very Good at Borrowing Complexity
&lt;/h2&gt;

&lt;p&gt;Software engineering has always been a story of abstractions.&lt;/p&gt;

&lt;p&gt;We rarely write our own database engines. We don't build an operating system every time we want to deploy an application. We use cloud providers instead of constructing data centres.&lt;/p&gt;

&lt;p&gt;And we generally consider this progress.&lt;/p&gt;

&lt;p&gt;Good abstractions allow engineers to spend less time solving problems that have already been solved and more time building things that matter to their users.&lt;/p&gt;

&lt;p&gt;LLM APIs are an extraordinary extension of that idea.&lt;/p&gt;

&lt;p&gt;Consider what an application developer had to do just a few years ago to build something resembling a capable conversational assistant.&lt;/p&gt;

&lt;p&gt;The amount of specialised research, training data, compute infrastructure, and machine learning expertise required would have made the project unrealistic for most small teams.&lt;/p&gt;

&lt;p&gt;Today, an experienced software engineer can build a useful prototype over a weekend.&lt;/p&gt;

&lt;p&gt;That's remarkable.&lt;/p&gt;

&lt;p&gt;But abstractions have an interesting property.&lt;/p&gt;

&lt;p&gt;They remove the need to manage certain kinds of complexity.&lt;/p&gt;

&lt;p&gt;They don't necessarily remove the consequences of that complexity.&lt;/p&gt;

&lt;p&gt;When you use a managed database, you may not need to worry about replication internals, but you still care about availability, query latency, and data consistency.&lt;/p&gt;

&lt;p&gt;When you deploy to a cloud platform, you may not manage the physical servers, but your application still experiences the consequences of network failures, resource contention, and infrastructure costs.&lt;/p&gt;

&lt;p&gt;And when you integrate an LLM through an API, you may never see the inference engine.&lt;/p&gt;

&lt;p&gt;But your users certainly experience its behaviour.&lt;/p&gt;

&lt;p&gt;The abstraction is convenient.&lt;/p&gt;

&lt;p&gt;The consequences remain yours.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Invoice Is Only the Beginning
&lt;/h2&gt;

&lt;p&gt;Most conversations about the cost of AI eventually arrive at tokens.&lt;/p&gt;

&lt;p&gt;Input tokens.&lt;/p&gt;

&lt;p&gt;Output tokens.&lt;/p&gt;

&lt;p&gt;Cached tokens.&lt;/p&gt;

&lt;p&gt;Reasoning tokens.&lt;/p&gt;

&lt;p&gt;Price per million tokens.&lt;/p&gt;

&lt;p&gt;These are useful numbers, but I think they can create a misleading sense of precision.&lt;/p&gt;

&lt;p&gt;A model that costs less per token isn't necessarily cheaper for your application.&lt;/p&gt;

&lt;p&gt;Suppose Model A costs twice as much per token as Model B.&lt;/p&gt;

&lt;p&gt;At first glance, Model B seems like the obvious economic choice.&lt;/p&gt;

&lt;p&gt;But what if Model B requires longer prompts to achieve acceptable results?&lt;/p&gt;

&lt;p&gt;What if it generates more tokens before arriving at an answer?&lt;/p&gt;

&lt;p&gt;What if it needs two attempts to complete a task that Model A handles correctly the first time?&lt;/p&gt;

&lt;p&gt;What if its tool-calling reliability is slightly worse, causing more failed workflows and human interventions?&lt;/p&gt;

&lt;p&gt;Suddenly, the price comparison becomes much less straightforward.&lt;/p&gt;

&lt;p&gt;The real cost isn't simply what you pay to generate a token.&lt;/p&gt;

&lt;p&gt;It's what you pay to achieve a useful outcome.&lt;/p&gt;

&lt;p&gt;And that difference becomes particularly important when AI is responsible for completing work rather than merely producing text.&lt;/p&gt;

&lt;p&gt;Imagine an AI agent responsible for confirming customer orders.&lt;/p&gt;

&lt;p&gt;It receives an order, contacts the customer, verifies the details, and updates the merchant's system.&lt;/p&gt;

&lt;p&gt;The business doesn't care how many tokens the agent generated.&lt;/p&gt;

&lt;p&gt;It cares whether the order was successfully confirmed.&lt;/p&gt;

&lt;p&gt;If a cheaper model reduces inference costs by 40% but introduces enough failures to increase human intervention and unsuccessful confirmations, the apparent savings may disappear.&lt;/p&gt;

&lt;p&gt;Conversely, an expensive frontier model might be unnecessary for a workflow that a smaller, specialised model can handle reliably.&lt;/p&gt;

&lt;p&gt;The right question isn't necessarily:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Which model is cheapest?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It's:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the least expensive reliable way to complete this particular job?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That question changes how you think about model selection.&lt;/p&gt;

&lt;p&gt;It also changes how you think about the business you're building.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Strange Economics of Intelligence
&lt;/h2&gt;

&lt;p&gt;There's another aspect of this that I find interesting.&lt;/p&gt;

&lt;p&gt;Traditional software has relatively predictable execution costs.&lt;/p&gt;

&lt;p&gt;A database query consumes resources. An HTTP request takes time. A background job uses compute.&lt;/p&gt;

&lt;p&gt;There are variations, of course, but engineers have developed mature techniques for estimating, monitoring, and optimising these systems.&lt;/p&gt;

&lt;p&gt;LLM workloads introduce a different kind of variability.&lt;/p&gt;

&lt;p&gt;Two requests that look similar at the application layer can have very different computational characteristics.&lt;/p&gt;

&lt;p&gt;One may contain a short prompt and produce a concise answer.&lt;/p&gt;

&lt;p&gt;Another may require extensive context, multiple reasoning steps, several tool calls, and a much longer response.&lt;/p&gt;

&lt;p&gt;If you're building an agentic system, a single user request might trigger an entire sequence of model interactions.&lt;/p&gt;

&lt;p&gt;And those interactions can multiply costs in ways that aren't immediately obvious from the initial API integration.&lt;/p&gt;

&lt;p&gt;This creates an interesting commercial problem.&lt;/p&gt;

&lt;p&gt;You might charge your customers a fixed monthly subscription while your underlying intelligence costs vary with their behaviour.&lt;/p&gt;

&lt;p&gt;Your most active customers may also be your most expensive customers.&lt;/p&gt;

&lt;p&gt;That's not inherently bad. Heavy usage can indicate that customers are receiving real value.&lt;/p&gt;

&lt;p&gt;But it becomes dangerous when the value you capture doesn't grow alongside the cost of delivering it.&lt;/p&gt;

&lt;p&gt;A product can become more popular while its unit economics become worse.&lt;/p&gt;

&lt;p&gt;And unlike an infrastructure problem that only affects performance, this one can threaten the sustainability of the business itself.&lt;/p&gt;

&lt;p&gt;It's possible to build an AI product that customers genuinely love and still struggle to make money from it.&lt;/p&gt;

&lt;p&gt;Which is why I think inference engineering is becoming as much a product and business discipline as a technical one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your Users Don't Know What Time-to-First-Token Means
&lt;/h2&gt;

&lt;p&gt;One of the most interesting things about working with conversational AI is how quickly infrastructure performance becomes a user-experience problem.&lt;/p&gt;

&lt;p&gt;Consider a voice conversation.&lt;/p&gt;

&lt;p&gt;When someone asks a question, they expect a response.&lt;/p&gt;

&lt;p&gt;Not eventually.&lt;/p&gt;

&lt;p&gt;Not when the GPU becomes available.&lt;/p&gt;

&lt;p&gt;Not after the inference provider finishes scheduling requests.&lt;/p&gt;

&lt;p&gt;They expect a response within the rhythm of a normal conversation.&lt;/p&gt;

&lt;p&gt;A delay that might be tolerable in a document-analysis application can feel awkward during a phone call.&lt;/p&gt;

&lt;p&gt;A longer delay can make the interaction feel unnatural.&lt;/p&gt;

&lt;p&gt;And a sufficiently long pause may cause the user to repeat themselves, interrupt the system, or assume the call has failed.&lt;/p&gt;

&lt;p&gt;This is where metrics like time-to-first-token become interesting.&lt;/p&gt;

&lt;p&gt;Time-to-first-token, or TTFT, measures how long it takes for a model to begin producing output after receiving a request.&lt;/p&gt;

&lt;p&gt;But even that doesn't tell the entire story.&lt;/p&gt;

&lt;p&gt;For a voice agent, the user experiences a sequence of operations.&lt;/p&gt;

&lt;p&gt;Their speech must be captured and recognised, unless the system uses an end-to-end speech model.&lt;/p&gt;

&lt;p&gt;The application may need to retrieve context or perform other processing.&lt;/p&gt;

&lt;p&gt;The language model must generate a response.&lt;/p&gt;

&lt;p&gt;The response must be converted into speech.&lt;/p&gt;

&lt;p&gt;And the audio must reach the user.&lt;/p&gt;

&lt;p&gt;Every stage introduces latency.&lt;/p&gt;

&lt;p&gt;Some of these operations can overlap, and a well-designed streaming pipeline can reduce the perceived delay substantially.&lt;/p&gt;

&lt;p&gt;But the important point remains:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The user experiences the system, not the individual components.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can have a fast language model and a slow voice agent.&lt;/p&gt;

&lt;p&gt;You can have excellent average inference latency and still deliver a poor experience when the slowest requests occur at the wrong moment.&lt;/p&gt;

&lt;p&gt;This is why I find averages increasingly uninteresting when evaluating interactive systems.&lt;/p&gt;

&lt;p&gt;Suppose your median response time looks excellent.&lt;/p&gt;

&lt;p&gt;But one in twenty requests takes substantially longer.&lt;/p&gt;

&lt;p&gt;For an application handling occasional document summaries, that might be acceptable.&lt;/p&gt;

&lt;p&gt;For a conversational system, it can become a recurring interruption.&lt;/p&gt;

&lt;p&gt;And when a workflow requires multiple sequential model calls, the impact of slow requests can compound.&lt;/p&gt;

&lt;p&gt;The experience is shaped not only by how fast the system usually is, but by how it behaves when things don't go as expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Model Isn't Always the Problem
&lt;/h2&gt;

&lt;p&gt;There's a temptation to blame the model whenever an AI application feels slow.&lt;/p&gt;

&lt;p&gt;Sometimes that's justified.&lt;/p&gt;

&lt;p&gt;But a great deal can happen between your application sending a request and the model producing its first token.&lt;/p&gt;

&lt;p&gt;There is network transport.&lt;/p&gt;

&lt;p&gt;There may be connection setup.&lt;/p&gt;

&lt;p&gt;There may be request queuing.&lt;/p&gt;

&lt;p&gt;The inference provider may be operating a shared environment where multiple customers compete for available capacity.&lt;/p&gt;

&lt;p&gt;A request may land on a worker that needs to load a model or rebuild useful cached context.&lt;/p&gt;

&lt;p&gt;And the provider may be scaling its infrastructure to accommodate changing demand.&lt;/p&gt;

&lt;p&gt;These are familiar distributed-systems problems, expressed through a new computational workload.&lt;/p&gt;

&lt;p&gt;One particularly interesting example is the KV cache.&lt;/p&gt;

&lt;p&gt;During transformer inference, the system maintains representations of previously processed tokens so it doesn't have to recompute the entire sequence for every generated token.&lt;/p&gt;

&lt;p&gt;This cache can significantly influence inference performance.&lt;/p&gt;

&lt;p&gt;But efficiently managing it across multiple workers and requests is not trivial.&lt;/p&gt;

&lt;p&gt;An application may send a large system prompt repeatedly.&lt;/p&gt;

&lt;p&gt;From the application developer's perspective, the request is straightforward.&lt;/p&gt;

&lt;p&gt;But depending on the provider's caching implementation, the same prompt may be processed again, partially reused, or served from an existing cache.&lt;/p&gt;

&lt;p&gt;That affects both latency and cost.&lt;/p&gt;

&lt;p&gt;And because many LLM APIs expose stateless request interfaces, the application often has limited visibility into how the underlying infrastructure manages these optimisations.&lt;/p&gt;

&lt;p&gt;The abstraction is simple.&lt;/p&gt;

&lt;p&gt;The machinery behind it is anything but.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Illusion of an Interchangeable Model
&lt;/h2&gt;

&lt;p&gt;One of the attractive features of modern AI infrastructure is how easy it appears to switch providers.&lt;/p&gt;

&lt;p&gt;Many inference services expose APIs compatible with popular frontier-model interfaces.&lt;/p&gt;

&lt;p&gt;Change an endpoint.&lt;/p&gt;

&lt;p&gt;Update a model identifier.&lt;/p&gt;

&lt;p&gt;Adjust a few configuration values.&lt;/p&gt;

&lt;p&gt;And your application is talking to a different model.&lt;/p&gt;

&lt;p&gt;Technically, that can be surprisingly easy.&lt;/p&gt;

&lt;p&gt;Operationally, it's a different story.&lt;/p&gt;

&lt;p&gt;Two models may support similar interfaces while behaving differently in ways that matter to your product.&lt;/p&gt;

&lt;p&gt;Their tool-calling behaviour may differ.&lt;/p&gt;

&lt;p&gt;Their adherence to structured output may differ.&lt;/p&gt;

&lt;p&gt;Their ability to follow complex instructions may differ.&lt;/p&gt;

&lt;p&gt;They may handle long contexts differently.&lt;/p&gt;

&lt;p&gt;And the same open-weight model can behave differently depending on how a provider configures or serves it.&lt;/p&gt;

&lt;p&gt;Quantisation, context limits, inference settings, and serving optimisations can all influence the outcome.&lt;/p&gt;

&lt;p&gt;So an API-compatible replacement is not necessarily a behaviourally equivalent replacement.&lt;/p&gt;

&lt;p&gt;This is where evaluation becomes essential.&lt;/p&gt;

&lt;p&gt;Not generic benchmark scores alone.&lt;/p&gt;

&lt;p&gt;Not the model leaderboard everyone is discussing this week.&lt;/p&gt;

&lt;p&gt;Your own evaluations.&lt;/p&gt;

&lt;p&gt;Built around the actual work your product performs.&lt;/p&gt;

&lt;p&gt;If your application confirms orders, evaluate order confirmation.&lt;/p&gt;

&lt;p&gt;If it schedules appointments, evaluate appointment scheduling.&lt;/p&gt;

&lt;p&gt;If it executes financial workflows, evaluate correctness, authorisation boundaries, and failure handling.&lt;/p&gt;

&lt;p&gt;Measure the things that would matter if a real customer depended on the system.&lt;/p&gt;

&lt;p&gt;And measure them repeatedly.&lt;/p&gt;

&lt;p&gt;Because model quality isn't a permanent property you can assume after one successful test.&lt;/p&gt;

&lt;p&gt;Models change.&lt;/p&gt;

&lt;p&gt;Providers change.&lt;/p&gt;

&lt;p&gt;Your workflows evolve.&lt;/p&gt;

&lt;p&gt;And user behaviour rarely stays within the boundaries of your original test cases.&lt;/p&gt;

&lt;p&gt;I increasingly think a company's private evaluation data may become one of its most valuable technical assets.&lt;/p&gt;

&lt;p&gt;Not because the evaluation framework itself is particularly difficult to build.&lt;/p&gt;

&lt;p&gt;But because the examples, edge cases, failure patterns, and success criteria represent accumulated knowledge about the problem the company is solving.&lt;/p&gt;

&lt;p&gt;That knowledge is harder to rent.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Does Renting Stop Making Sense?
&lt;/h2&gt;

&lt;p&gt;At some point, an engineering team may begin considering alternatives to frontier-model APIs.&lt;/p&gt;

&lt;p&gt;Perhaps inference costs are growing faster than revenue.&lt;/p&gt;

&lt;p&gt;Perhaps latency is too unpredictable.&lt;/p&gt;

&lt;p&gt;Perhaps the application requires a specialised model.&lt;/p&gt;

&lt;p&gt;Or perhaps the team needs more control over model versions, capacity, and deployment behaviour.&lt;/p&gt;

&lt;p&gt;There are several possible responses.&lt;/p&gt;

&lt;p&gt;One is to route simpler workloads to less expensive models.&lt;/p&gt;

&lt;p&gt;Another is to use an inference provider hosting open-weight models.&lt;/p&gt;

&lt;p&gt;Another is to reserve dedicated GPU capacity.&lt;/p&gt;

&lt;p&gt;And at sufficiently large scale, some organisations may operate substantial inference infrastructure themselves.&lt;/p&gt;

&lt;p&gt;But I don't think these choices should be treated as a mandatory progression.&lt;/p&gt;

&lt;p&gt;There's a popular assumption in engineering that maturity means eventually owning more of your infrastructure.&lt;/p&gt;

&lt;p&gt;Sometimes it does.&lt;/p&gt;

&lt;p&gt;But owning infrastructure also means owning its problems.&lt;/p&gt;

&lt;p&gt;Dedicated GPUs don't automatically make inference cheap.&lt;/p&gt;

&lt;p&gt;They introduce capacity planning, utilisation concerns, operational commitments, model-serving complexity, monitoring, and failure recovery.&lt;/p&gt;

&lt;p&gt;A GPU sitting idle is still costing money.&lt;/p&gt;

&lt;p&gt;A GPU operating near its limits may introduce performance problems.&lt;/p&gt;

&lt;p&gt;And a team that spends months optimising inference infrastructure may be diverting engineering resources away from the actual product.&lt;/p&gt;

&lt;p&gt;For some companies, that investment will be justified.&lt;/p&gt;

&lt;p&gt;For others, it may be an expensive distraction.&lt;/p&gt;

&lt;p&gt;The correct decision depends on workload characteristics, scale, performance requirements, engineering capability, and economics.&lt;/p&gt;

&lt;p&gt;Not prestige.&lt;/p&gt;

&lt;p&gt;Not what the largest AI companies are doing.&lt;/p&gt;

&lt;p&gt;And certainly not the assumption that running your own models automatically makes your company more sophisticated.&lt;/p&gt;

&lt;p&gt;Sometimes the most mature engineering decision is to continue paying someone else to manage the complexity.&lt;/p&gt;

&lt;p&gt;The important thing is knowing why.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Infrastructure You Don't Own Can Still Shape Your Product
&lt;/h2&gt;

&lt;p&gt;There's a deeper strategic question underneath all of this.&lt;/p&gt;

&lt;p&gt;When you build on someone else's intelligence, how much control do you really have over the future of your product?&lt;/p&gt;

&lt;p&gt;Suppose a provider changes its pricing.&lt;/p&gt;

&lt;p&gt;Or retires a model your application depends on.&lt;/p&gt;

&lt;p&gt;Or introduces new usage restrictions.&lt;/p&gt;

&lt;p&gt;Or experiences repeated service degradation.&lt;/p&gt;

&lt;p&gt;Or changes behaviour in a way that affects a critical workflow.&lt;/p&gt;

&lt;p&gt;Your product may be functioning exactly as you designed it.&lt;/p&gt;

&lt;p&gt;And yet its reliability, economics, or user experience can change because of decisions made outside your organisation.&lt;/p&gt;

&lt;p&gt;This isn't unique to AI.&lt;/p&gt;

&lt;p&gt;Software companies have always depended on external platforms.&lt;/p&gt;

&lt;p&gt;Payment processors.&lt;/p&gt;

&lt;p&gt;Cloud providers.&lt;/p&gt;

&lt;p&gt;App stores.&lt;/p&gt;

&lt;p&gt;Communication networks.&lt;/p&gt;

&lt;p&gt;Identity services.&lt;/p&gt;

&lt;p&gt;But AI introduces an unusually consequential dependency because the model often sits close to the product's core functionality.&lt;/p&gt;

&lt;p&gt;If the intelligence layer changes, the behaviour of the product itself may change.&lt;/p&gt;

&lt;p&gt;That's a different kind of dependency from replacing a logging provider.&lt;/p&gt;

&lt;p&gt;And it deserves architectural attention.&lt;/p&gt;

&lt;p&gt;This doesn't mean every startup should immediately become model-agnostic or build elaborate multi-provider routing systems.&lt;/p&gt;

&lt;p&gt;Premature abstraction can be just as expensive as vendor lock-in.&lt;/p&gt;

&lt;p&gt;But it does mean teams should understand where their dependencies are concentrated.&lt;/p&gt;

&lt;p&gt;Which capabilities are difficult to replace?&lt;/p&gt;

&lt;p&gt;Which workflows are sensitive to model behaviour?&lt;/p&gt;

&lt;p&gt;Which providers represent single points of failure?&lt;/p&gt;

&lt;p&gt;And which parts of the system could be redesigned if the economics changed?&lt;/p&gt;

&lt;p&gt;The goal isn't complete independence.&lt;/p&gt;

&lt;p&gt;That's rarely realistic.&lt;/p&gt;

&lt;p&gt;The goal is to preserve enough optionality that your business can adapt.&lt;/p&gt;

&lt;h2&gt;
  
  
  Perhaps the Intelligence Was Never the Product
&lt;/h2&gt;

&lt;p&gt;Here's the part I find most interesting.&lt;/p&gt;

&lt;p&gt;As increasingly capable models become available through APIs, access to intelligence becomes less distinctive.&lt;/p&gt;

&lt;p&gt;Not irrelevant.&lt;/p&gt;

&lt;p&gt;Not worthless.&lt;/p&gt;

&lt;p&gt;But less exclusive.&lt;/p&gt;

&lt;p&gt;If two companies can access the same model, what makes one product meaningfully better than the other?&lt;/p&gt;

&lt;p&gt;It probably isn't the API key.&lt;/p&gt;

&lt;p&gt;It may be the quality of the workflows built around the model.&lt;/p&gt;

&lt;p&gt;The proprietary context the system can access.&lt;/p&gt;

&lt;p&gt;The integrations it can execute.&lt;/p&gt;

&lt;p&gt;The reliability of its actions.&lt;/p&gt;

&lt;p&gt;The quality of its evaluations.&lt;/p&gt;

&lt;p&gt;The distribution channels through which it reaches customers.&lt;/p&gt;

&lt;p&gt;Or the depth of its understanding of a particular industry.&lt;/p&gt;

&lt;p&gt;Consider two AI agents that can both hold convincing conversations.&lt;/p&gt;

&lt;p&gt;One answers questions impressively.&lt;/p&gt;

&lt;p&gt;The other understands the business process, checks relevant information, executes authorised actions, recovers from failures, and knows when to involve a human.&lt;/p&gt;

&lt;p&gt;They may use the same underlying language model.&lt;/p&gt;

&lt;p&gt;But they're not delivering the same product.&lt;/p&gt;

&lt;p&gt;The difference lies in the system around the intelligence.&lt;/p&gt;

&lt;p&gt;And that system is where a substantial part of the engineering work begins.&lt;/p&gt;

&lt;p&gt;It's also where much of the commercial value may ultimately reside.&lt;/p&gt;

&lt;p&gt;A customer doesn't necessarily want access to an intelligent model.&lt;/p&gt;

&lt;p&gt;They want a problem solved.&lt;/p&gt;

&lt;p&gt;And the ability to consistently solve that problem is not something you acquire merely by choosing the most capable model.&lt;/p&gt;

&lt;p&gt;You have to engineer it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Cost of Convenience Is Not Always Money
&lt;/h2&gt;

&lt;p&gt;I started this reflection thinking about inference costs.&lt;/p&gt;

&lt;p&gt;But the more I examine the subject, the more I think the expensive part of renting intelligence isn't always the invoice.&lt;/p&gt;

&lt;p&gt;Sometimes it's uncertainty.&lt;/p&gt;

&lt;p&gt;Sometimes it's limited control.&lt;/p&gt;

&lt;p&gt;Sometimes it's the engineering compromises required to work around a provider's constraints.&lt;/p&gt;

&lt;p&gt;Sometimes it's the opportunity cost of building your product around capabilities that may change without your permission.&lt;/p&gt;

&lt;p&gt;And sometimes it's the distraction of trying to own infrastructure before your business has earned the complexity.&lt;/p&gt;

&lt;p&gt;None of this makes managed AI APIs a bad idea.&lt;/p&gt;

&lt;p&gt;Quite the opposite.&lt;/p&gt;

&lt;p&gt;They've made an extraordinary amount of innovation possible.&lt;/p&gt;

&lt;p&gt;A small team can now build applications that would have been financially or technically unrealistic not long ago.&lt;/p&gt;

&lt;p&gt;That's a remarkable shift in what software engineers can accomplish.&lt;/p&gt;

&lt;p&gt;But the convenience of an abstraction should never be confused with the absence of trade-offs.&lt;/p&gt;

&lt;p&gt;At the beginning, the question is often whether a model can do what you need.&lt;/p&gt;

&lt;p&gt;Later, the questions become more difficult.&lt;/p&gt;

&lt;p&gt;Can it do it reliably?&lt;/p&gt;

&lt;p&gt;Can it do it quickly enough?&lt;/p&gt;

&lt;p&gt;Can it do it at a cost your business can sustain?&lt;/p&gt;

&lt;p&gt;Can you measure when it fails?&lt;/p&gt;

&lt;p&gt;Can you change providers without rebuilding everything?&lt;/p&gt;

&lt;p&gt;And can the product continue delivering value as the underlying technology evolves?&lt;/p&gt;

&lt;p&gt;Those are engineering questions.&lt;/p&gt;

&lt;p&gt;But they're also business questions.&lt;/p&gt;

&lt;p&gt;And I suspect the companies that build enduring AI products will be the ones that learn to answer both.&lt;/p&gt;

&lt;p&gt;Because there is nothing inherently wrong with building on someone else's intelligence.&lt;/p&gt;

&lt;p&gt;We've built much of the modern software industry on infrastructure we don't own.&lt;/p&gt;

&lt;p&gt;The mistake would be assuming that because the intelligence is rented, the responsibility for what we build with it is rented too.&lt;/p&gt;

&lt;p&gt;It isn't.&lt;/p&gt;

&lt;p&gt;The model may belong to someone else.&lt;/p&gt;

&lt;p&gt;The infrastructure may belong to someone else.&lt;/p&gt;

&lt;p&gt;Even the most impressive capabilities may originate somewhere outside our control.&lt;/p&gt;

&lt;p&gt;But the product is still ours.&lt;/p&gt;

&lt;p&gt;And so are its consequences.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>systemdesign</category>
      <category>startup</category>
      <category>software</category>
    </item>
    <item>
      <title>The Internet Could Have Looked Very Different. So Could Everything We're Building Today.</title>
      <dc:creator>David Shemang</dc:creator>
      <pubDate>Wed, 18 Nov 2026 17:03:16 +0000</pubDate>
      <link>https://dev.to/shemzz/the-internet-could-have-looked-very-different-so-could-everything-were-building-today-1bj9</link>
      <guid>https://dev.to/shemzz/the-internet-could-have-looked-very-different-so-could-everything-were-building-today-1bj9</guid>
      <description>&lt;p&gt;&lt;em&gt;Some thoughts on Gopher, the early web, and why the best technology doesn't always win.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I've been building software since 2017, and one thing I've gradually come to appreciate is that the technologies we use today aren't necessarily the only ways things could have worked.&lt;/p&gt;

&lt;p&gt;We often look at successful technologies in hindsight and assume their success was inevitable.&lt;/p&gt;

&lt;p&gt;The web was always going to be the web. Smartphones were always going to look like smartphones. Cloud computing was always going to become the default way we deploy software.&lt;/p&gt;

&lt;p&gt;But history tells a slightly different story.&lt;/p&gt;

&lt;p&gt;Some of the technologies that now seem obvious were once competing against alternatives that were just as promising, sometimes even better suited to the conditions of their time.&lt;/p&gt;

&lt;p&gt;I was recently reading about the early internet, and I came across something fascinating.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There was a time when the World Wide Web wasn't the obvious future of the internet.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In fact, one of its strongest competitors was a system called Gopher.&lt;/p&gt;

&lt;p&gt;And the story of what happened to Gopher says quite a lot about technology, business, and the decisions we make as builders today.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before the Web Became the Web
&lt;/h2&gt;

&lt;p&gt;Think about how you use the internet today.&lt;/p&gt;

&lt;p&gt;You open a browser, type an address, click a link, and move from one website to another. You barely think about what's happening underneath.&lt;/p&gt;

&lt;p&gt;We take hyperlinks, web pages, and browsers for granted because they're practically inseparable from our experience of the internet.&lt;/p&gt;

&lt;p&gt;But in the early 1990s, things were different.&lt;/p&gt;

&lt;p&gt;The internet already existed, but there wasn't yet a universally dominant way for ordinary people to navigate information on it.&lt;/p&gt;

&lt;p&gt;One of the popular systems at the time was Gopher, developed at the University of Minnesota.&lt;/p&gt;

&lt;p&gt;Gopher didn't work like the modern web.&lt;/p&gt;

&lt;p&gt;Instead of visually rich pages filled with images, buttons, and hyperlinks, it presented information through hierarchical, text-based menus.&lt;/p&gt;

&lt;p&gt;You selected a category, opened another menu, and continued navigating until you found what you needed.&lt;/p&gt;

&lt;p&gt;It sounds primitive now, but consider the environment it was built for.&lt;/p&gt;

&lt;p&gt;Internet connections were painfully slow. Computing resources were limited. Downloading even a single image could be an exercise in patience.&lt;/p&gt;

&lt;p&gt;In that environment, a lightweight, text-first system wasn't necessarily a bad idea.&lt;/p&gt;

&lt;p&gt;It was practical.&lt;/p&gt;

&lt;p&gt;And that's something I find interesting about engineering. A solution can make perfect sense within the constraints of its time and still end up being the wrong foundation for the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Decision That Changed Everything
&lt;/h2&gt;

&lt;p&gt;In 1993, something important happened.&lt;/p&gt;

&lt;p&gt;The University of Minnesota announced licensing arrangements for commercial uses of its Gopher server software.&lt;/p&gt;

&lt;p&gt;Around the same period, CERN made the World Wide Web technology freely available.&lt;/p&gt;

&lt;p&gt;It's tempting to reduce what happened next to a simple story: one technology charged money, the other was free, and the free one won.&lt;/p&gt;

&lt;p&gt;But I think that explanation misses something.&lt;/p&gt;

&lt;p&gt;The web wasn't merely competing on cost.&lt;/p&gt;

&lt;p&gt;It introduced a fundamentally different way of organising and connecting information.&lt;/p&gt;

&lt;p&gt;With Gopher, information was largely organised through menus and directories.&lt;/p&gt;

&lt;p&gt;With the web, documents could link directly to other documents.&lt;/p&gt;

&lt;p&gt;A piece of information didn't have to exist only within a predefined navigation structure. It could point somewhere else, and that destination could point somewhere else again.&lt;/p&gt;

&lt;p&gt;That sounds like a small architectural distinction.&lt;/p&gt;

&lt;p&gt;But it changed what people could build.&lt;/p&gt;

&lt;p&gt;The web made it possible for information to grow through connections rather than depend primarily on centrally organised hierarchies.&lt;/p&gt;

&lt;p&gt;And because the underlying technology was freely available, developers and organisations could experiment without having to negotiate access to the foundation.&lt;/p&gt;

&lt;p&gt;Gopher didn't disappear overnight, and licensing wasn't the only reason the web overtook it. But the contrast illustrates something I've come to believe strongly:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The architecture of a technology determines what is possible. Its distribution model often determines how far those possibilities can spread.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As engineers, we tend to spend a lot of time thinking about the first part.&lt;/p&gt;

&lt;p&gt;As founders, we cannot afford to ignore the second.&lt;/p&gt;

&lt;h2&gt;
  
  
  Being Early Is Not the Same as Being Right
&lt;/h2&gt;

&lt;p&gt;Another interesting example from that period is Apple's Newton.&lt;/p&gt;

&lt;p&gt;Apple introduced the Newton MessagePad in 1993, long before smartphones and tablets became everyday devices.&lt;/p&gt;

&lt;p&gt;It was a handheld computer with features that now sound familiar, including personal information management and handwriting recognition.&lt;/p&gt;

&lt;p&gt;The ambition was impressive.&lt;/p&gt;

&lt;p&gt;The execution, particularly the handwriting recognition, was less convincing.&lt;/p&gt;

&lt;p&gt;The technology struggled with the expectations placed on it, and the Newton eventually disappeared from Apple's product lineup.&lt;/p&gt;

&lt;p&gt;Years later, handheld computing became one of the most important categories in consumer technology.&lt;/p&gt;

&lt;p&gt;So was the Newton a bad idea?&lt;/p&gt;

&lt;p&gt;I don't think that's the most useful question.&lt;/p&gt;

&lt;p&gt;The more interesting question is whether the surrounding technology, market expectations, and user experience were mature enough to support the idea.&lt;/p&gt;

&lt;p&gt;You can correctly anticipate where an industry is going and still build a product that fails.&lt;/p&gt;

&lt;p&gt;That's a difficult reality for founders.&lt;/p&gt;

&lt;p&gt;We often talk about being early as though it's automatically an advantage.&lt;/p&gt;

&lt;p&gt;Sometimes it is.&lt;/p&gt;

&lt;p&gt;But being early can also mean spending years trying to convince customers to adopt something they don't yet need, cannot comfortably use, or aren't willing to pay for.&lt;/p&gt;

&lt;p&gt;And while you're doing that, the economics of keeping the business alive don't disappear.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A product can be ahead of its time and still be a poor business at the time it exists.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Those two things aren't contradictory.&lt;/p&gt;

&lt;h2&gt;
  
  
  What This Makes Me Think About AI
&lt;/h2&gt;

&lt;p&gt;I find these stories particularly relevant to what's happening with artificial intelligence today.&lt;/p&gt;

&lt;p&gt;We're currently in a period where almost every week introduces a new model, framework, agent platform, or approach to building AI-powered applications.&lt;/p&gt;

&lt;p&gt;There is enormous excitement around what these systems can do.&lt;/p&gt;

&lt;p&gt;And understandably so.&lt;/p&gt;

&lt;p&gt;But I sometimes wonder how many of the architectural decisions we're making today will look obvious ten years from now, and how many will look like Gopher.&lt;/p&gt;

&lt;p&gt;Consider AI agents.&lt;/p&gt;

&lt;p&gt;Right now, there's considerable attention on systems that can reason, use tools, execute workflows, and perform tasks with increasing autonomy.&lt;/p&gt;

&lt;p&gt;But we haven't settled on what the dominant architecture for these systems will look like.&lt;/p&gt;

&lt;p&gt;Will businesses interact with agents primarily through conversational interfaces?&lt;/p&gt;

&lt;p&gt;Will agents operate quietly behind existing software?&lt;/p&gt;

&lt;p&gt;Will they communicate through shared protocols?&lt;/p&gt;

&lt;p&gt;Will orchestration become a distinct infrastructure layer, or will much of it be absorbed into existing platforms?&lt;/p&gt;

&lt;p&gt;I don't think anyone can answer all of these questions confidently yet.&lt;/p&gt;

&lt;p&gt;And that's precisely what makes this period interesting.&lt;/p&gt;

&lt;p&gt;In my work with conversational AI and workflow automation, one distinction I keep returning to is the difference between a system that can demonstrate a capability and one that can deliver that capability reliably in a business environment.&lt;/p&gt;

&lt;p&gt;An agent successfully completing a task during a demonstration is encouraging.&lt;/p&gt;

&lt;p&gt;But production introduces a different set of questions.&lt;/p&gt;

&lt;p&gt;What happens when an external API fails? What happens when the user changes their mind halfway through a workflow? How does the system recover from an incomplete action? When should it stop trying and involve a human?&lt;/p&gt;

&lt;p&gt;And perhaps most importantly, does the value of automating the task justify the cost and complexity of running the system?&lt;/p&gt;

&lt;p&gt;These questions aren't as exciting as announcing a new autonomous agent.&lt;/p&gt;

&lt;p&gt;But they're often what determines whether a product becomes useful infrastructure or remains an impressive experiment.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Best Technology Doesn't Always Win
&lt;/h2&gt;

&lt;p&gt;There's a tendency among engineers to believe that better technology should naturally produce a better outcome.&lt;/p&gt;

&lt;p&gt;If a system is faster, more scalable, more elegant, or technically superior, surely it should have an advantage.&lt;/p&gt;

&lt;p&gt;And often it does.&lt;/p&gt;

&lt;p&gt;But technical quality is only one part of the equation.&lt;/p&gt;

&lt;p&gt;A product also needs distribution.&lt;/p&gt;

&lt;p&gt;It needs an adoption path.&lt;/p&gt;

&lt;p&gt;It needs an economic model that works.&lt;/p&gt;

&lt;p&gt;It needs to fit into the environment where customers will actually use it.&lt;/p&gt;

&lt;p&gt;And sometimes it needs a little luck.&lt;/p&gt;

&lt;p&gt;The history of technology is full of products that were impressive but failed to become commercially significant.&lt;/p&gt;

&lt;p&gt;It's also full of technologies that succeeded despite limitations their competitors didn't have.&lt;/p&gt;

&lt;p&gt;That doesn't mean engineering quality is irrelevant.&lt;/p&gt;

&lt;p&gt;It means technical superiority doesn't automatically translate into market leadership.&lt;/p&gt;

&lt;p&gt;For someone building a company, that's an important distinction.&lt;/p&gt;

&lt;p&gt;You can spend months perfecting an architecture while another team builds something less sophisticated, gets it into customers' hands, learns faster, and establishes a distribution advantage.&lt;/p&gt;

&lt;p&gt;Of course, moving quickly with a poor technical foundation creates its own problems.&lt;/p&gt;

&lt;p&gt;The challenge is finding the right balance.&lt;/p&gt;

&lt;p&gt;Build enough to deliver real value. Design carefully where failure would be expensive. Avoid complexity that doesn't yet solve a meaningful problem.&lt;/p&gt;

&lt;p&gt;And keep paying attention to the market.&lt;/p&gt;

&lt;p&gt;Because the market doesn't reward engineering elegance in isolation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Strange Thing About Progress
&lt;/h2&gt;

&lt;p&gt;There's one more aspect of this history that I find fascinating.&lt;/p&gt;

&lt;p&gt;Despite everything we've achieved in digital technology, people are increasingly interested in older, analogue experiences.&lt;/p&gt;

&lt;p&gt;Vinyl records, film cameras, and other retro devices continue to attract people who didn't necessarily grow up using them.&lt;/p&gt;

&lt;p&gt;At first, that seems strange.&lt;/p&gt;

&lt;p&gt;Why would someone choose a less convenient technology when a more efficient alternative exists?&lt;/p&gt;

&lt;p&gt;But perhaps efficiency isn't the only thing people value.&lt;/p&gt;

&lt;p&gt;Sometimes people care about the experience itself.&lt;/p&gt;

&lt;p&gt;The physical interaction. The limitations. The sense of ownership. The feeling that something was made for a particular purpose rather than optimised to do everything.&lt;/p&gt;

&lt;p&gt;I think there's a lesson here for software products too.&lt;/p&gt;

&lt;p&gt;We often assume that adding more capabilities automatically improves a product.&lt;/p&gt;

&lt;p&gt;More features. More automation. More integrations. More intelligence.&lt;/p&gt;

&lt;p&gt;But usefulness isn't always proportional to capability.&lt;/p&gt;

&lt;p&gt;Sometimes the better product is the one that does fewer things, more predictably, with less friction.&lt;/p&gt;

&lt;p&gt;And as AI makes it increasingly easy to generate software and introduce new capabilities, I suspect this distinction will become even more important.&lt;/p&gt;

&lt;p&gt;The ability to build more doesn't necessarily mean we should.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'm Taking Away From This
&lt;/h2&gt;

&lt;p&gt;The Gopher story isn't really about an obsolete internet protocol.&lt;/p&gt;

&lt;p&gt;At least, that's not what makes it interesting to me.&lt;/p&gt;

&lt;p&gt;It's a reminder that technology evolves through decisions made under uncertainty.&lt;/p&gt;

&lt;p&gt;Engineers choose architectures based on the constraints they understand.&lt;/p&gt;

&lt;p&gt;Founders choose business models based on the markets they can see.&lt;/p&gt;

&lt;p&gt;Companies make strategic decisions without knowing which assumptions will still hold five or ten years later.&lt;/p&gt;

&lt;p&gt;And sometimes, a decision that seems reasonable today becomes the reason a technology struggles tomorrow.&lt;/p&gt;

&lt;p&gt;I don't think there's a formula for avoiding that.&lt;/p&gt;

&lt;p&gt;But I do think it should make us more thoughtful about what we're building and why.&lt;/p&gt;

&lt;p&gt;Are we solving a problem that matters today, or betting entirely on a future that may take longer than expected to arrive?&lt;/p&gt;

&lt;p&gt;Are we designing systems that others can adopt and build upon?&lt;/p&gt;

&lt;p&gt;Are we mistaking technical sophistication for customer value?&lt;/p&gt;

&lt;p&gt;And are we building something people will continue to find useful after the excitement around the technology fades?&lt;/p&gt;

&lt;p&gt;These are questions I find myself returning to as I move further from simply writing software into building products and companies.&lt;/p&gt;

&lt;p&gt;Because ultimately, we're not just choosing technologies.&lt;/p&gt;

&lt;p&gt;We're making bets about how people will work, communicate, transact, and interact with software in the future.&lt;/p&gt;

&lt;p&gt;Some of those bets will turn out to be right.&lt;/p&gt;

&lt;p&gt;Others won't.&lt;/p&gt;

&lt;p&gt;And twenty years from now, someone might look back at what we're building today and wonder how close the world came to turning out very differently.&lt;/p&gt;

</description>
      <category>software</category>
      <category>softwaredevelopment</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Your Payment Webhook Is Not a Notification. It's a Distributed Systems Problem.</title>
      <dc:creator>David Shemang</dc:creator>
      <pubDate>Sun, 08 Nov 2026 11:08:00 +0000</pubDate>
      <link>https://dev.to/shemzz/your-payment-webhook-is-not-a-notification-its-a-distributed-systems-problem-2heh</link>
      <guid>https://dev.to/shemzz/your-payment-webhook-is-not-a-notification-its-a-distributed-systems-problem-2heh</guid>
      <description>&lt;p&gt;&lt;em&gt;Why building reliable payment infrastructure requires thinking beyond HTTP 200.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Consider this scenario.&lt;/p&gt;

&lt;p&gt;A customer places an order on an e-commerce platform and pays ₦85,000. The payment provider processes the transaction successfully and sends a webhook to your backend.&lt;/p&gt;

&lt;p&gt;Your backend receives it, updates the order to &lt;code&gt;PAID&lt;/code&gt;, and returns HTTP 200.&lt;/p&gt;

&lt;p&gt;Everything works.&lt;/p&gt;

&lt;p&gt;Except the payment provider never receives your response because of a temporary network interruption.&lt;/p&gt;

&lt;p&gt;It retries the webhook.&lt;/p&gt;

&lt;p&gt;Your backend receives the exact same event again.&lt;/p&gt;

&lt;p&gt;Now, depending on how you implemented your payment processing logic, you might have just credited a wallet twice, created two orders, triggered duplicate notifications, or initiated another fulfilment process.&lt;/p&gt;

&lt;p&gt;This is not an edge case. It is a fundamental characteristic of distributed systems.&lt;/p&gt;

&lt;p&gt;And it is something every developer building payment-enabled applications should understand.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem with assuming exactly-once delivery
&lt;/h2&gt;

&lt;p&gt;Most webhook integrations operate with an at-least-once delivery guarantee.&lt;/p&gt;

&lt;p&gt;In simple terms, the sender will keep attempting delivery until it receives an acceptable acknowledgement or exhausts its retry policy.&lt;/p&gt;

&lt;p&gt;This means your application must assume that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The same event can arrive multiple times.&lt;/li&gt;
&lt;li&gt;Events can arrive out of order.&lt;/li&gt;
&lt;li&gt;A request can time out even when the operation succeeds.&lt;/li&gt;
&lt;li&gt;Your application can process an event but fail before acknowledging it.&lt;/li&gt;
&lt;li&gt;Two identical requests can execute concurrently.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The mistake is designing your application around the assumption that one request equals one business operation.&lt;/p&gt;

&lt;p&gt;HTTP does not guarantee that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Idempotency is your first line of defence
&lt;/h2&gt;

&lt;p&gt;An operation is idempotent when executing it multiple times produces the same effective result as executing it once.&lt;/p&gt;

&lt;p&gt;For webhook processing, this means identifying an event that has already been processed and refusing to repeat its business effects.&lt;/p&gt;

&lt;p&gt;A straightforward implementation might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;processPaymentWebhook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;PaymentEvent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;existing&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;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;webhookEvent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findUnique&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;eventId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&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;existing&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'PROCESSED'&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;success&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;duplicate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Process the event...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, there is a concurrency problem here.&lt;/p&gt;

&lt;p&gt;Two identical webhook requests could arrive almost simultaneously. Both might check the database before either has inserted the event.&lt;/p&gt;

&lt;p&gt;Both see nothing.&lt;/p&gt;

&lt;p&gt;Both proceed.&lt;/p&gt;

&lt;p&gt;This is why checking for an existing record alone is insufficient.&lt;/p&gt;

&lt;p&gt;You need a database-enforced uniqueness constraint.&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;TABLE&lt;/span&gt; &lt;span class="n"&gt;webhook_events&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="kt"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;provider_event_id&lt;/span&gt; &lt;span class="kt"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;UNIQUE&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="kt"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;received_at&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMP&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="nb"&gt;NOW&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;processed_at&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMP&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;The unique constraint ensures that concurrent requests cannot successfully register the same provider event twice.&lt;/p&gt;

&lt;p&gt;Your application should then use an atomic insert or transaction to claim the event before executing its business effects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate event receipt from business execution
&lt;/h2&gt;

&lt;p&gt;Another mistake is treating webhook receipt and business processing as the same operation.&lt;/p&gt;

&lt;p&gt;They should be separate concerns.&lt;/p&gt;

&lt;p&gt;A more resilient architecture looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Receive the webhook.&lt;/li&gt;
&lt;li&gt;Verify its authenticity using the provider's signature mechanism.&lt;/li&gt;
&lt;li&gt;Validate the event structure.&lt;/li&gt;
&lt;li&gt;Persist the event with a unique provider event ID.&lt;/li&gt;
&lt;li&gt;Acknowledge receipt.&lt;/li&gt;
&lt;li&gt;Process the event asynchronously.&lt;/li&gt;
&lt;li&gt;Record the processing outcome.&lt;/li&gt;
&lt;li&gt;Retry failed processing safely.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This approach prevents a slow downstream operation from holding up the webhook response.&lt;/p&gt;

&lt;p&gt;For stronger reliability, use a transactional outbox pattern or an equivalent durable job mechanism. Simply returning HTTP 200 after placing a job in an in-memory queue is not sufficient. If the application crashes before the job is persisted, the event can be lost.&lt;/p&gt;

&lt;h2&gt;
  
  
  Idempotency is not just about webhooks
&lt;/h2&gt;

&lt;p&gt;This is where things become particularly interesting.&lt;/p&gt;

&lt;p&gt;Imagine a customer clicking the Pay button multiple times because the page appears unresponsive.&lt;/p&gt;

&lt;p&gt;Or a mobile application retrying a request after losing connectivity.&lt;/p&gt;

&lt;p&gt;Or a merchant's POS terminal submitting a transaction again because it never received the first response.&lt;/p&gt;

&lt;p&gt;The same principle applies.&lt;/p&gt;

&lt;p&gt;For operations that create financial or irreversible effects, introduce an idempotency key.&lt;/p&gt;

&lt;p&gt;For example:&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="no"&gt;POST&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;v1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;payments&lt;/span&gt;
&lt;span class="nc"&gt;Idempotency&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;order_123_payment_attempt_01&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your backend should associate that key with the original operation and its result.&lt;/p&gt;

&lt;p&gt;Subsequent requests using the same key should return the original result rather than initiating another payment.&lt;/p&gt;

&lt;p&gt;Be deliberate about the key's scope, retention period, and payload consistency. Reusing the same key with a different payment amount or currency should not silently return an unrelated result.&lt;/p&gt;

&lt;h2&gt;
  
  
  The other problem: Out-of-order events
&lt;/h2&gt;

&lt;p&gt;Suppose your payment system receives these events:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;payment.successful&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;payment.pending&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In that order.&lt;/p&gt;

&lt;p&gt;If your implementation blindly updates the payment status based on the latest event received, you could accidentally downgrade a successful payment to pending.&lt;/p&gt;

&lt;p&gt;Arrival order is not necessarily business-event order.&lt;/p&gt;

&lt;p&gt;Your system needs explicit state transition rules.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;allowedTransitions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="no"&gt;PENDING&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'SUCCESSFUL'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'FAILED'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="no"&gt;SUCCESSFUL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="no"&gt;FAILED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&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;This is deliberately simplified. Real payment systems may support additional states, reversals, refunds, disputes, and provider-specific transitions.&lt;/p&gt;

&lt;p&gt;The important principle is that a state transition should be validated against the current state, not blindly accepted because an event arrived.&lt;/p&gt;

&lt;p&gt;For financial systems, you should also maintain an immutable transaction history or ledger rather than relying exclusively on a mutable balance or status field.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build for failure, not just the happy path
&lt;/h2&gt;

&lt;p&gt;When building payment-enabled applications, I pay particular attention to questions that are easy to overlook during initial development:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What happens when the provider processes a payment but our request times out?&lt;/li&gt;
&lt;li&gt;What happens when the same webhook arrives five times?&lt;/li&gt;
&lt;li&gt;What happens when two workers process the same event?&lt;/li&gt;
&lt;li&gt;What happens when the database commits but the application crashes before responding?&lt;/li&gt;
&lt;li&gt;What happens when our system and the provider disagree about a transaction's status?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last question deserves special attention.&lt;/p&gt;

&lt;p&gt;You need reconciliation.&lt;/p&gt;

&lt;p&gt;Your application should periodically compare internal transaction records against the payment provider's records, identify discrepancies, and initiate a controlled resolution process.&lt;/p&gt;

&lt;p&gt;Webhooks are useful for receiving updates. They should not be your only source of financial truth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;Building a payment integration is relatively straightforward.&lt;/p&gt;

&lt;p&gt;Building one that remains correct when networks fail, requests are duplicated, workers crash, and events arrive in unexpected orders is a different engineering problem entirely.&lt;/p&gt;

&lt;p&gt;The difference is not necessarily the number of technologies you use. It is the assumptions you make about failure.&lt;/p&gt;

&lt;p&gt;A production-grade payment system should not depend on requests arriving exactly once, responses arriving on time, or external services behaving perfectly.&lt;/p&gt;

&lt;p&gt;Because eventually, they won't.&lt;/p&gt;

&lt;p&gt;And when that happens, your architecture should already know what to do.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The real test of a payment system isn't whether it works when everything goes right. It's whether it remains financially correct when everything goes wrong.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>api</category>
      <category>architecture</category>
      <category>backend</category>
      <category>systemdesign</category>
    </item>
  </channel>
</rss>
