<?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: Islam Hafez</title>
    <description>The latest articles on DEV Community by Islam Hafez (@islamhafez0).</description>
    <link>https://dev.to/islamhafez0</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%2F3657314%2Fe754616e-5e51-444e-b0d2-de822e4ca2a9.jpeg</url>
      <title>DEV Community: Islam Hafez</title>
      <link>https://dev.to/islamhafez0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/islamhafez0"/>
    <language>en</language>
    <item>
      <title>POST /search Is a Lie. HTTP Finally Admits It.</title>
      <dc:creator>Islam Hafez</dc:creator>
      <pubDate>Wed, 08 Jul 2026 22:47:27 +0000</pubDate>
      <link>https://dev.to/islamhafez0/post-search-is-a-lie-http-finally-admits-it-7jn</link>
      <guid>https://dev.to/islamhafez0/post-search-is-a-lie-http-finally-admits-it-7jn</guid>
      <description>&lt;h3&gt;
  
  
  For 30 years, every search API on the internet has been telling the protocol one thing and doing another. RFC 10008 just ended that.
&lt;/h3&gt;




&lt;p&gt;Somewhere in your codebase right now, there is a route called &lt;code&gt;POST /search&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It works. It has always worked. And every developer who wrote it knew, at some level, that it was wrong — that using POST for a read-only operation was a small, quiet lie to the protocol. They wrote it anyway because HTTP left them no choice. The only verb that could carry a body was POST, and POST is defined to mean "this operation might change something."&lt;/p&gt;

&lt;p&gt;For three decades, every search API, every filter endpoint, every analytics query, every reporting tool on the internet made the same compromise. We picked the verb that &lt;em&gt;worked&lt;/em&gt; over the verb that was &lt;em&gt;correct&lt;/em&gt;, because the correct verb didn't exist.&lt;/p&gt;

&lt;p&gt;On June 15, 2026, after eleven years of drafts, the IETF published RFC 10008. The new method is called QUERY. And the first thing to understand about it is that it isn't really adding something new. It's making the protocol honest about what we were already doing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why the Lie Happened in the First Place
&lt;/h2&gt;

&lt;p&gt;HTTP has always had a semantics problem for complex reads.&lt;/p&gt;

&lt;p&gt;GET is the right verb for reading data. It's safe (no side effects), idempotent (repeat it a hundred times, same result), and cacheable. Proxies can retry it. CDNs can cache it. Clients can prefetch it. Everything about GET is designed around the assumption that reading data is a safe operation that can be done again without consequence.&lt;/p&gt;

&lt;p&gt;The problem is the URL. GET has no body. Your entire request — every filter, every parameter, every field — has to fit in the URI. And nobody actually knows what "fit" means, because the size limit isn't defined by HTTP itself. It depends on the browser, the server, every proxy in between, and every CDN in the path. RFC 9110 recommends servers support at least 8,000 octets. Some support less. Some support more. None of them agree.&lt;/p&gt;

&lt;p&gt;For simple queries, that's fine. &lt;code&gt;GET /products?category=laptops&amp;amp;sort=price&lt;/code&gt; fits anywhere. But modern APIs don't stay simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /analytics/reports
  ?filters[]=region:US,EU
  &amp;amp;filters[]=date_range:2026-01-01..2026-06-30
  &amp;amp;filters[]=revenue:&amp;gt;10000
  &amp;amp;group_by[]=month,region,product_line
  &amp;amp;having[]=total_revenue:&amp;gt;50000
  &amp;amp;sort=total_revenue:desc
  &amp;amp;fields[]=id,name,revenue,margin,growth_rate
  &amp;amp;page=1&amp;amp;per_page=100
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's not contrived. That's a real analytics query. In a URL. And this is the mild version — Elasticsearch DSL, GraphQL queries, and SQL-style filter trees make this look minimalist.&lt;/p&gt;

&lt;p&gt;So teams switched to POST. And POST solved the body-size problem and created a different one: POST is defined to mean "this might have side effects." It is neither safe nor idempotent by default. Caches ignore POST responses. Proxies won't automatically retry a failed POST. Monitoring tools flag POST calls as potentially state-changing. OpenAPI specs describe them under the "mutations" section. Every piece of infrastructure that makes decisions based on HTTP semantics now has the wrong information about what your search endpoint does.&lt;/p&gt;

&lt;p&gt;We weren't just working around a limitation. We were telling the protocol a lie, and that lie had real costs.&lt;/p&gt;




&lt;h2&gt;
  
  
  What QUERY Actually Is
&lt;/h2&gt;

&lt;p&gt;QUERY is a single, precise addition to the HTTP method registry. Four properties, two of which it inherits from GET and two from POST:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;From GET:&lt;/strong&gt; Safe. Idempotent.&lt;br&gt;
&lt;strong&gt;From POST:&lt;/strong&gt; Carries a request body.&lt;br&gt;
&lt;strong&gt;New:&lt;/strong&gt; Explicitly cacheable &lt;em&gt;with&lt;/em&gt; a body.&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="nf"&gt;QUERY&lt;/span&gt; &lt;span class="nn"&gt;/products&lt;/span&gt; &lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt;
&lt;span class="na"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api.example.com&lt;/span&gt;
&lt;span class="na"&gt;Content-Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;application/json&lt;/span&gt;
&lt;span class="na"&gt;Accept&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;application/json&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"filters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"laptops"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"price"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"min"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"max"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"in_stock"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"sort"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"field"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"price"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"direction"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"asc"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"page"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"per_page"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The request body carries the query. The method communicates what the request does. The protocol and the intent finally match.&lt;/p&gt;

&lt;p&gt;Servers advertise which body formats they accept via a new &lt;code&gt;Accept-Query&lt;/code&gt; response header. The RFC's examples include &lt;code&gt;application/json&lt;/code&gt;, &lt;code&gt;application/x-www-form-urlencoded&lt;/code&gt;, &lt;code&gt;application/sql&lt;/code&gt;, &lt;code&gt;application/jsonpath&lt;/code&gt;, and &lt;code&gt;application/xslt+xml&lt;/code&gt;. QUERY doesn't care what format the body is — it's format-agnostic by design. A REST API, a GraphQL server, and an Elasticsearch cluster can all speak QUERY using their own body conventions.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Timeline: 11 Years. 16 Years. Both True.
&lt;/h2&gt;

&lt;p&gt;The idea behind QUERY isn't new. The first draft circulated roughly eleven years ago. It moved through review for over a decade, reached a final draft in November 2025, received IESG approval on November 20, 2025, and was published as RFC 10008 on June 15, 2026.&lt;/p&gt;

&lt;p&gt;The last genuinely new HTTP method before this was PATCH, published as RFC 5789 in March 2010. That makes QUERY the first new general-purpose HTTP method in &lt;strong&gt;sixteen years&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Both numbers — eleven years to draft, sixteen years since the last new method — are features, not bugs. HTTP underpins the entire web. A change to it gets reviewed against every server, every browser, every proxy, every CDN, every security assumption, every existing implementation that exists on the planet before it becomes a standard. That process is deliberately slow. It's why "new HTTP method" is real news, not framework noise.&lt;/p&gt;

&lt;p&gt;The RFC is 24 pages. Read it. It's unusually readable for an IETF document — the problem statement alone is worth your time.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Author List Tells You Something
&lt;/h2&gt;

&lt;p&gt;RFC 10008 carries three names: &lt;strong&gt;Julian Reschke&lt;/strong&gt; of greenbytes, &lt;strong&gt;James M. Snell&lt;/strong&gt; of Cloudflare, and &lt;strong&gt;Mike Bishop&lt;/strong&gt; of Akamai.&lt;/p&gt;

&lt;p&gt;Cloudflare and Akamai, between them, sit in front of a significant portion of the web's traffic. These aren't academic researchers speculating about how CDNs might behave. They are the CDN. Their involvement in writing the spec means the caching behavior — the hardest part to get right — was designed by people who operate the caching infrastructure it will run on.&lt;/p&gt;

&lt;p&gt;That matters more than it sounds. Caching a GET response is straightforward: the URL is the cache key. Caching a QUERY response requires including the request body in the cache key, and getting that wrong opens cache poisoning attacks. The spec is precise about this because the people who wrote it will also be the ones whose infrastructure gets poisoned if they got it wrong.&lt;/p&gt;




&lt;h2&gt;
  
  
  Caching: The Part That Actually Changes Everything
&lt;/h2&gt;

&lt;p&gt;The difference between QUERY and &lt;code&gt;POST /search&lt;/code&gt; isn't just semantic cleanliness. It's whether your responses can be cached.&lt;/p&gt;

&lt;p&gt;POST responses are not cached by default. Every search request hits your server fresh. For simple APIs, that's fine. For high-traffic search endpoints — a product catalog, a content discovery feed, a real-time analytics dashboard — it means every filter combination, every repeated query, every pagination request goes to the origin. No CDN edge caching. No shared cache hits. Your server takes the full load.&lt;/p&gt;

&lt;p&gt;QUERY is explicitly cacheable. A CDN can store the response to a QUERY request and serve it to the next client who sends the same request body to the same URL. For read-heavy APIs, that's not a minor ergonomic improvement. It's a different performance tier.&lt;/p&gt;

&lt;p&gt;The catch: the cache key must include the full request body, not just the URL. A cache that keys on the URL alone will serve one user's search results to every user who queries the same endpoint — regardless of what their filter body says. That is a cache poisoning vulnerability, and it requires no bug in the application. It's a misconfigured cache.&lt;/p&gt;

&lt;p&gt;This is the part your infrastructure team needs to understand before you ship QUERY anywhere near production.&lt;/p&gt;




&lt;h2&gt;
  
  
  What the Protocol Now Lets Intermediaries Do
&lt;/h2&gt;

&lt;p&gt;The semantic shift from POST to QUERY isn't just about correctness. It's about what intermediaries — proxies, CDNs, load balancers, API gateways — are permitted to do with your requests.&lt;/p&gt;

&lt;p&gt;With POST, intermediaries have to assume the operation might have side effects. They won't cache it. They won't automatically retry a failed request. They won't prefetch it. They treat it like a state change, because that's what the protocol says POST might be.&lt;/p&gt;

&lt;p&gt;With QUERY:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Caches&lt;/strong&gt; can store and reuse responses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clients&lt;/strong&gt; can safely retry a failed QUERY without worrying about double-submission.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Proxies&lt;/strong&gt; can automatically retry on network failures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring tools&lt;/strong&gt; can correctly classify it as a read operation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAPI specs&lt;/strong&gt; can describe it accurately without gymnastics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rate limiters&lt;/strong&gt; can apply read-operation quotas instead of write-operation quotas.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every layer of the stack that currently makes decisions based on HTTP method semantics gets the right information. That's not a cosmetic improvement. Distributed systems built around HTTP use method semantics to make real decisions about retry behavior, caching, and traffic routing. Giving them accurate semantics means those decisions become correct.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where It Works Today (Be Specific With Yourself)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Environment&lt;/th&gt;
&lt;th&gt;Status — July 2026&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Node.js&lt;/td&gt;
&lt;td&gt;Native QUERY parsing since early 2024 ✓&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OpenAPI 3.2&lt;/td&gt;
&lt;td&gt;Full documentation support ✓&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;curl&lt;/td&gt;
&lt;td&gt;Supported — &lt;code&gt;curl -X QUERY ...&lt;/code&gt; ✓&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GraphQL servers&lt;/td&gt;
&lt;td&gt;Natural fit for query operations (server-side) ✓&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Spring (Java)&lt;/td&gt;
&lt;td&gt;PR open, &lt;code&gt;RequestMethod&lt;/code&gt; enum not yet updated ✗&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ruby on Rails&lt;/td&gt;
&lt;td&gt;Discussion stage only ✗&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chrome / Firefox / Safari&lt;/td&gt;
&lt;td&gt;Still evaluating; &lt;code&gt;fetch()&lt;/code&gt; not yet ✗&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WAFs (default rulesets)&lt;/td&gt;
&lt;td&gt;Not included in method allowlists pre-June 2026 ✗&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CDNs (default config)&lt;/td&gt;
&lt;td&gt;Varies — verify explicitly before relying on it ✗&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Node.js is ready. OpenAPI is ready. Your WAF is probably not.&lt;/p&gt;

&lt;p&gt;The browser gap is the most significant constraint for public-facing APIs. Browser JavaScript's &lt;code&gt;fetch()&lt;/code&gt; doesn't support QUERY yet as of this writing, which means any API that needs to be called directly from a browser is either stuck on POST-as-fallback or waiting. For server-to-server APIs, internal APIs, and GraphQL backends, the picture is much better.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Security Side Nobody's Talking About
&lt;/h2&gt;

&lt;p&gt;New HTTP methods are an attack surface before they're a feature. Security infrastructure written before June 2026 doesn't know QUERY exists, which creates gaps that are interesting to both attackers and defenders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WAF inspection gaps.&lt;/strong&gt; Web application firewalls typically enforce method allowlists: GET, POST, PUT, DELETE, PATCH. A WAF that doesn't know about QUERY might pass it through without running the injection and XSS detection rules it would run against a POST body carrying the same payload. This isn't a theoretical problem — test it yourself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Send the same payload via POST first&lt;/span&gt;
curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://target.com/api/search &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"q": "test OR 1=1"}'&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt;

&lt;span class="c"&gt;# Then try QUERY&lt;/span&gt;
curl &lt;span class="nt"&gt;-X&lt;/span&gt; QUERY https://target.com/api/search &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"q": "test OR 1=1"}'&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your WAF blocks the POST but passes the QUERY, you've found a live inspection gap in your own infrastructure. Fix that before you enable QUERY in production.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cache poisoning.&lt;/strong&gt; Already covered above — but worth repeating in plain terms. If a cache doesn't include the full request body in its cache key, two different QUERY requests to the same URL will share a cache entry. User A searches for &lt;code&gt;{"category": "laptops"}&lt;/code&gt;. User B searches for &lt;code&gt;{"category": "phones"}&lt;/code&gt;. If the cache keys on URL alone, User B gets User A's laptop results. Worse: an attacker can deliberately populate the cache with a crafted response that other users will receive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CORS preflights.&lt;/strong&gt; QUERY is not a CORS-safelisted method. Any browser JavaScript calling a QUERY endpoint cross-origin will trigger a preflight OPTIONS request — same as PUT or DELETE. The spec got this right on purpose. But your CDN, reverse proxy, and CORS middleware all need to handle that preflight consistently. Don't assume — test the actual path.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSRF audit.&lt;/strong&gt; CSRF middleware is typically scoped to state-changing methods. QUERY is safe by spec — but a developer might implement a QUERY endpoint that has an unintended side effect (logging, rate-limit tracking, "last searched" timestamp updates). If your CSRF middleware doesn't cover QUERY because it's "safe," those side effects get a free pass from cross-site requests. Audit any QUERY endpoint with side effects explicitly.&lt;/p&gt;




&lt;h2&gt;
  
  
  GraphQL Finally Has the Right Verb
&lt;/h2&gt;

&lt;p&gt;GraphQL is the clearest example of how far &lt;code&gt;POST /search&lt;/code&gt; misrepresented what APIs were actually doing.&lt;/p&gt;

&lt;p&gt;GraphQL query operations — not mutations, not subscriptions, just queries — are already safe, already idempotent, and already read-only by design. They've been executed over &lt;code&gt;POST /graphql&lt;/code&gt; for years because GET couldn't carry the complex JSON bodies that GraphQL operations require.&lt;/p&gt;

&lt;p&gt;QUERY is the verb GraphQL queries were always supposed to use. The operation is read-only. The method is now &lt;code&gt;QUERY&lt;/code&gt;. The semantics match. CDN caching of GraphQL query responses becomes correct-by-default rather than requiring custom cache configurations that fight against POST semantics.&lt;/p&gt;

&lt;p&gt;Server-side GraphQL frameworks are among the first candidates to ship QUERY support, and the alignment is clean enough that they should.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Practical Migration Path
&lt;/h2&gt;

&lt;p&gt;Don't do a hard cutover. The ecosystem isn't ready.&lt;/p&gt;

&lt;p&gt;The right approach is additive: keep &lt;code&gt;POST /search&lt;/code&gt; running alongside the new QUERY endpoint. Advertise QUERY support via the &lt;code&gt;Accept-Query&lt;/code&gt; response header on the POST response. Let clients migrate as their tooling catches up. When QUERY traffic exceeds POST traffic for a given endpoint, deprecate POST. Until then, both coexist.&lt;/p&gt;

&lt;p&gt;Before you enable QUERY anywhere that matters, four things need to be explicitly verified:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Your framework routes it.&lt;/strong&gt; Don't assume — check the specific version. Spring doesn't yet. Rails doesn't yet. Express with Node 22+ does.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Your WAF inspects the body.&lt;/strong&gt; Run the comparison test above. If the WAF treats the QUERY body differently from a POST body, that's a problem to fix now, not after you've launched.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Your cache includes the body in the key.&lt;/strong&gt; This is the highest-priority item for any public API. A misconfigured cache is worse than no caching — it serves wrong data to real users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Your CORS and CSRF middleware covers it.&lt;/strong&gt; Don't rely on inheritance from POST behavior. Explicitly add QUERY to the method list your security middleware handles.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Honest Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Property&lt;/th&gt;
&lt;th&gt;GET&lt;/th&gt;
&lt;th&gt;POST&lt;/th&gt;
&lt;th&gt;QUERY&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Safe (no side effects)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Idempotent&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cacheable by default&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Carries a request body&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CORS preflight required&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Depends&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Standard since&lt;/td&gt;
&lt;td&gt;1991&lt;/td&gt;
&lt;td&gt;1996&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;June 2026&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  What This Signals About HTTP Itself
&lt;/h2&gt;

&lt;p&gt;PATCH took sixteen years from proposal to wide adoption. QUERY will probably follow a similar arc. The IETF doesn't ship methods on a quarterly release cycle, and that's exactly why each one matters.&lt;/p&gt;

&lt;p&gt;The gap since PATCH was published in March 2010 is sixteen years. In those sixteen years, the web went from REST APIs being novel to REST APIs being infrastructure. The entire time, every search endpoint on the internet was using the wrong verb, and the protocol had no answer.&lt;/p&gt;

&lt;p&gt;RFC 10008 is a 24-page document. It will take years to fully propagate through frameworks, WAFs, CDNs, and developer habits. But the vocabulary of HTTP — the shared language every API on the internet speaks — just got one new word. A word that makes it possible, for the first time, to say what &lt;code&gt;POST /search&lt;/code&gt; was always trying to say.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;RFC 10008 is available in full at rfc-editor.org/info/rfc10008. The IESG approval record and public review comments are on the IETF datatracker at datatracker.ietf.org/doc/rfc10008. All framework and browser support statuses are current as of July 2026.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

</description>
      <category>http</category>
      <category>api</category>
      <category>webdev</category>
      <category>rfc10008</category>
    </item>
    <item>
      <title>You Don't Use Linked Lists. But They're Running Half Your Software.</title>
      <dc:creator>Islam Hafez</dc:creator>
      <pubDate>Sat, 27 Jun 2026 14:13:23 +0000</pubDate>
      <link>https://dev.to/islamhafez0/you-dont-use-linked-lists-but-theyre-running-half-your-software-4b37</link>
      <guid>https://dev.to/islamhafez0/you-dont-use-linked-lists-but-theyre-running-half-your-software-4b37</guid>
      <description>&lt;h3&gt;
  
  
  The data structure everyone learns for interviews and forgets by Monday — and why that's exactly backwards.
&lt;/h3&gt;




&lt;p&gt;Here's the honest version of what most linked list tutorials skip:&lt;/p&gt;

&lt;p&gt;You are almost certainly never going to write a linked list in JavaScript. Not in production. Not in a side project. Your language's built-in array already handles dynamic sizing, and it does it &lt;em&gt;faster&lt;/em&gt; than a linked list in most cases, for reasons we'll get into. The interview circuit trained you to implement one on a whiteboard, and that's fine — but it created the wrong mental model. You walked away thinking linked lists are a data structure you might &lt;em&gt;use&lt;/em&gt;. They're actually a data structure you need to &lt;em&gt;understand&lt;/em&gt; — because they're hiding inside the tools you use every day, and knowing they're there changes how you reason about performance.&lt;/p&gt;

&lt;p&gt;Your browser's back/forward navigation? Doubly linked list. Your text editor's undo history? Doubly linked list. The LRU cache inside every high-traffic web server, CDN, and database query optimizer? A doubly linked list fused with a hash map. Redis's &lt;code&gt;LPUSH&lt;/code&gt;/&lt;code&gt;RPUSH&lt;/code&gt; commands operate on a linked list. The Node.js event queue has linked list characteristics. The Linux kernel's process scheduler uses circular doubly linked lists internally.&lt;/p&gt;

&lt;p&gt;They're not a relic. They're infrastructure. You just can't see them because they're one layer below where you usually work.&lt;/p&gt;

&lt;p&gt;So let's learn them the right way — starting with the hardware, not the textbook.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Memory Layout Is the Whole Story
&lt;/h2&gt;

&lt;p&gt;Before you write a single node, you need to understand the one thing that determines when a linked list wins and when it loses: &lt;strong&gt;cache locality&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Your CPU doesn't read from RAM one byte at a time. It's too slow for that — a RAM access takes 200–300 CPU cycles, while a cache hit takes 4. So the CPU plays a prediction game: when you access a memory address, it automatically pulls in the surrounding 64 bytes (a "cache line") on the assumption that you'll need nearby data next. This is called spatial locality, and it's why arrays are fast.&lt;/p&gt;

&lt;p&gt;When you store an array of numbers, they sit &lt;em&gt;next to each other in memory&lt;/em&gt;. When you loop over them, the CPU loads the first element — and gets the next 15 for free in the same cache line. It's reading ahead before you even ask.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Array in memory:
[ 10 | 20 | 30 | 40 | 50 | 60 ] → contiguous, cache-friendly
  ^                               one cache fetch, all 6 loaded
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A linked list destroys this. Each node is a separate heap allocation, scattered wherever the allocator found space. Following a &lt;code&gt;next&lt;/code&gt; pointer means jumping to an arbitrary memory address — potentially on a completely different cache line, triggering a new RAM fetch, costing those 200–300 cycles, every single time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Linked list in memory:
[10 | ptr] ──→ [20 | ptr] ──→ [30 | ptr]
 0x1a04          0x7f82         0x3c11
 (separate allocations, scattered across memory)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In practice, benchmarks consistently show linked list traversal running 10–100x slower than array traversal for large datasets — even though both are O(n) on paper. Big-O notation lies to you about this. It ignores constants, and the constant for "RAM access" is enormous on modern hardware.&lt;/p&gt;

&lt;p&gt;This isn't a reason to dismiss linked lists. It's the reason to understand &lt;em&gt;exactly&lt;/em&gt; when their advantages outweigh this cost. That answer is more specific than most tutorials admit.&lt;/p&gt;




&lt;h2&gt;
  
  
  Singly Linked List — The Minimal Form
&lt;/h2&gt;

&lt;p&gt;A singly linked list is a chain of nodes where each node holds data and a pointer to the next node. That's it. No backward travel. No shortcuts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SinglyLinkedList&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// O(1) — we know exactly where the head is&lt;/span&gt;
  &lt;span class="nf"&gt;prepend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="nx"&gt;node&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// O(n) — must walk to the end&lt;/span&gt;
  &lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="nx"&gt;node&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="o"&gt;!&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// O(n) — must walk to find it&lt;/span&gt;
  &lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="o"&gt;!&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// drop the head, O(1)&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&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="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&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="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// skip the node, O(1) once found&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&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="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&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="nf"&gt;toArray&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="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&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="nx"&gt;result&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;Notice something about &lt;code&gt;delete&lt;/code&gt;: &lt;em&gt;finding&lt;/em&gt; the node is O(n), but the actual &lt;em&gt;removal&lt;/em&gt; is O(1) — you just redirect one pointer. No shifting. No copying. No reorganizing memory. Compare that to an array, where deleting from the middle means shifting every subsequent element one position left — O(n) work even after you found the element.&lt;/p&gt;

&lt;p&gt;This is the trade-off in one sentence: &lt;strong&gt;linked lists pay for access with their insertion/deletion advantage.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The singly linked list's natural shape is a &lt;strong&gt;stack&lt;/strong&gt; — you push and pop from the head, both O(1), never need to go backward. It also fits a task queue where you only ever consume from one end.&lt;/p&gt;

&lt;p&gt;What it genuinely can't do: random access. If you want the 500th element, you walk 500 nodes. There's no formula. This alone disqualifies singly linked lists from most use cases where you're searching or indexing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Doubly Linked List — Where It Gets Actually Useful
&lt;/h2&gt;

&lt;p&gt;Add a &lt;code&gt;prev&lt;/code&gt; pointer to every node and something real changes: you can traverse in both directions, and — critically — you can &lt;em&gt;remove a node in O(1) if you already have a reference to it&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DNode&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DoublyLinkedList&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tail&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// tail pointer makes append O(1)&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// O(1) — we hold both ends&lt;/span&gt;
  &lt;span class="nf"&gt;prepend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="nx"&gt;node&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DNode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="o"&gt;!&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tail&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// O(1) — tail pointer, no walking required&lt;/span&gt;
  &lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="nx"&gt;node&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DNode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="o"&gt;!&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tail&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tail&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tail&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tail&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tail&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// O(1) — given the node directly, no searching required&lt;/span&gt;
  &lt;span class="nf"&gt;removeNode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;node&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="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// it was the head&lt;/span&gt;

    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tail&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// it was the tail&lt;/span&gt;

    &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// O(1) — both ends accessible instantly&lt;/span&gt;
  &lt;span class="nf"&gt;removeHead&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeNode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;removeTail&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tail&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeNode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tail&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;The &lt;code&gt;removeNode(node)&lt;/code&gt; method is the entire reason doubly linked lists exist in serious systems. When you have a direct reference to a node — not a value you need to search for, but the &lt;em&gt;actual node object&lt;/em&gt; — deletion is just pointer surgery. Four pointer updates. Done.&lt;/p&gt;

&lt;p&gt;This changes everything for the use case that actually matters.&lt;/p&gt;




&lt;h2&gt;
  
  
  The One Pattern Where Linked Lists Are Irreplaceable
&lt;/h2&gt;

&lt;p&gt;The LRU (Least Recently Used) cache is the canonical real-world use case — and it's worth understanding in detail because it appears in CDN edge nodes, database query planners, CPU cache replacement policies, DNS resolvers, and web server in-memory caches.&lt;/p&gt;

&lt;p&gt;The problem: you have a cache with limited capacity. When it's full and you need to add something new, you evict the item that was accessed &lt;em&gt;least recently&lt;/em&gt;. You need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;O(1) lookup: "Is this key in the cache?"&lt;/li&gt;
&lt;li&gt;O(1) insert: "Add this new key-value pair"&lt;/li&gt;
&lt;li&gt;O(1) eviction: "Remove the least recently used item"&lt;/li&gt;
&lt;li&gt;O(1) promotion: "This key was just accessed, move it to 'most recently used'"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An array can't do this. When you access an item, you need to move it to the "recently used" position — that's O(n) shifting. A hash map alone can't do it either — it has no concept of order.&lt;/p&gt;

&lt;p&gt;The solution is a doubly linked list paired with a hash map:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LRUCache&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;capacity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;capacity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;capacity&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;       &lt;span class="c1"&gt;// key → node (O(1) lookup)&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DoublyLinkedList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// ordered by recency&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&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="o"&gt;!&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeNode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;   &lt;span class="c1"&gt;// O(1) — we have the node directly&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prepend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// O(1) — move to head (most recent)&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;val&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;val&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeNode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// O(1)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;capacity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// evict the tail — it's the least recently used&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tail&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeTail&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// O(1)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prepend&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;val&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt; &lt;span class="c1"&gt;// O(1)&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&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;Every operation is O(1). The hash map gives instant lookup. The doubly linked list maintains order and provides O(1) removal &lt;em&gt;because we store the node reference in the hash map&lt;/em&gt; — we never search for the node, we go directly to it.&lt;/p&gt;

&lt;p&gt;This is the move that makes the whole structure work. The hash map stores node &lt;em&gt;references&lt;/em&gt;, not values. When we access a key, we pull the node directly out of the middle of the list and move it to the head — no traversal. That's only possible with a doubly linked list where &lt;code&gt;removeNode&lt;/code&gt; doesn't require knowing where the node is in the sequence.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Honest Comparison
&lt;/h2&gt;

&lt;p&gt;Most tutorials give you a comparison table. Here's one that's actually honest about modern hardware:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;Array&lt;/th&gt;
&lt;th&gt;Singly LL&lt;/th&gt;
&lt;th&gt;Doubly LL&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Access by index&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;O(1)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;O(n)&lt;/td&gt;
&lt;td&gt;O(n)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Search by value&lt;/td&gt;
&lt;td&gt;O(n)&lt;/td&gt;
&lt;td&gt;O(n)&lt;/td&gt;
&lt;td&gt;O(n)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Insert at head&lt;/td&gt;
&lt;td&gt;O(n) — shift all&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;O(1)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;O(1)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Insert at tail&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;O(1)&lt;/strong&gt; amortized&lt;/td&gt;
&lt;td&gt;O(n) or O(1) w/ tail ptr&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;O(1)&lt;/strong&gt; w/ tail ptr&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete at head&lt;/td&gt;
&lt;td&gt;O(n) — shift all&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;O(1)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;O(1)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete in middle (by value)&lt;/td&gt;
&lt;td&gt;O(n) find + O(n) shift&lt;/td&gt;
&lt;td&gt;O(n) find + &lt;strong&gt;O(1)&lt;/strong&gt; remove&lt;/td&gt;
&lt;td&gt;O(n) find + &lt;strong&gt;O(1)&lt;/strong&gt; remove&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete by node reference&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;O(1)&lt;/strong&gt; ← the whole game&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory per element&lt;/td&gt;
&lt;td&gt;Low (just data)&lt;/td&gt;
&lt;td&gt;Medium (+1 pointer)&lt;/td&gt;
&lt;td&gt;Higher (+2 pointers)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cache performance&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Excellent&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Poor&lt;/td&gt;
&lt;td&gt;Poor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Traversal speed in practice&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~10–100x faster&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Slow&lt;/td&gt;
&lt;td&gt;Slow&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The "delete by node reference" row is the one that matters. It's the entire reason doubly linked lists exist in production systems. Everything else, arrays do better or equal for most workloads — &lt;em&gt;because of cache locality, not because of Big-O&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;If you're choosing between array and linked list for a problem where you're iterating through data, an array wins even if your Big-O analysis says they're equal. The constant factor of cache performance is that significant.&lt;/p&gt;




&lt;h2&gt;
  
  
  When to Actually Use Each One
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Reach for a singly linked list when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You're building a stack and want textbook clarity (though an array works fine here too)&lt;/li&gt;
&lt;li&gt;You're implementing something where you only ever add/remove from one end&lt;/li&gt;
&lt;li&gt;Memory is extremely tight and you can't afford the extra &lt;code&gt;prev&lt;/code&gt; pointer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Reach for a doubly linked list when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need O(1) deletion and you'll have direct node references (LRU cache, undo history where each action holds its own node)&lt;/li&gt;
&lt;li&gt;You're building anything that requires backward traversal without a second pass&lt;/li&gt;
&lt;li&gt;You're implementing a deque (double-ended queue) with O(1) operations at both ends&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Don't reach for either when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You're just storing and iterating over data — use an array&lt;/li&gt;
&lt;li&gt;You need frequent random access — use an array&lt;/li&gt;
&lt;li&gt;You're searching by value — use a hash map or sorted array with binary search&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The deeper point: linked lists are most valuable not as standalone structures but as the &lt;em&gt;ordered component&lt;/em&gt; inside composite structures. The LRU cache doesn't use a linked list instead of a hash map — it uses them together. That combination produces something neither could achieve alone. That's the real lesson.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where They're Already Running in Your Stack
&lt;/h2&gt;

&lt;p&gt;Without writing a single line of linked list code, these structures are running around you right now:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Node.js&lt;/strong&gt; — The &lt;code&gt;timers&lt;/code&gt; module maintains doubly linked lists to track setTimeout/setInterval expiry. The &lt;code&gt;http&lt;/code&gt; module uses them for connection pools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;V8 (Chrome's JS engine)&lt;/strong&gt; — The garbage collector uses linked list-like structures to track object generations and manage the free list of available memory blocks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redis&lt;/strong&gt; — &lt;code&gt;LPUSH&lt;/code&gt;/&lt;code&gt;RPUSH&lt;/code&gt;/&lt;code&gt;LPOP&lt;/code&gt;/&lt;code&gt;RPOP&lt;/code&gt; operate on a linked list. Redis lists are actually a hybrid (ziplist for small sizes, linkedlist for large), but the interface is a linked list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Linux kernel&lt;/strong&gt; — The process scheduler's run queue is a doubly linked list. The &lt;code&gt;list_head&lt;/code&gt; structure in the kernel source is one of the most used data structures in any OS codebase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your browser's navigation&lt;/strong&gt; — Every &lt;code&gt;window.history.back()&lt;/code&gt; and &lt;code&gt;window.history.forward()&lt;/code&gt; is a doubly linked list traversal.&lt;/p&gt;

&lt;p&gt;You've been using linked lists constantly. You just didn't know their name.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Real Reason to Learn This
&lt;/h2&gt;

&lt;p&gt;Interview prep is the wrong motivation to learn linked lists. The right motivation is this: understanding &lt;em&gt;why&lt;/em&gt; a doubly linked list paired with a hash map gives you O(1) everything for an LRU cache — that kind of reasoning is what separates engineers who design systems from engineers who just implement requirements.&lt;/p&gt;

&lt;p&gt;When someone at a senior system design interview says "we need an LRU cache with O(1) get and put" and you immediately know the structure — and, more importantly, you know &lt;em&gt;why&lt;/em&gt; that structure works at the hardware level — that's not trivia. That's thinking.&lt;/p&gt;

&lt;p&gt;The data structure is simple. The thinking behind it isn't.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Code examples are in JavaScript for readability. The concepts apply identically in Python, Go, Rust, or any other language. In production systems you'd typically use the language's built-in deque or list structures rather than rolling your own — but understanding the internals is exactly the point.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Cheers !&lt;/p&gt;

</description>
      <category>datastructures</category>
      <category>javascript</category>
      <category>computerscience</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Monolithic vs Microservices</title>
      <dc:creator>Islam Hafez</dc:creator>
      <pubDate>Sun, 21 Jun 2026 10:02:55 +0000</pubDate>
      <link>https://dev.to/islamhafez0/monolithic-vs-microservices-1g3p</link>
      <guid>https://dev.to/islamhafez0/monolithic-vs-microservices-1g3p</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmjt9qh4fplaf7wn103is.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmjt9qh4fplaf7wn103is.png" alt="Monolithic vs Microservices By Islam Hafez - Frontend Architect and Odoo Developer" width="799" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Intro&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Ever heard the words "monolithic" and "microservices" tossed around in tech conversations? Don't worry if they sound a bit confusing – you're not alone! These terms are hot topics in the world of software design, and for good reason.&lt;/p&gt;

&lt;p&gt;In this article, we're going to break down what monolithic and microservices mean. We'll compare them in simple terms and talk about when you might want to use each one.&lt;/p&gt;

&lt;p&gt;Monolithic and microservices are both types of software architecture. In simple terms, architecture is just a fancy word for the overall design of a computer program - it's the plan that lays out how all the pieces of the software will fit and work together. These are just different ways to build web applications.&lt;/p&gt;

&lt;p&gt;We are going to understand each architecture with the help of an example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We'll consider designing an online travel booking web application that offers hotel reservations, flight bookings, and train ticket purchases, along with payment processing and user account management for understanding these architectures.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We will be discussing these architectures concerning backend logic.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Monolithic&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In a monolithic architecture, we would design the application as a single, unified system. All the code for every feature would reside within one codebase(project). This includes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hotel booking functionality&lt;/li&gt;
&lt;li&gt;Flight reservation system&lt;/li&gt;
&lt;li&gt;Train ticket booking&lt;/li&gt;
&lt;li&gt;Payment processing&lt;/li&gt;
&lt;li&gt;User authentication (sign-up and login)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The entire codebase, encompassing all these functions, operates as one cohesive unit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqqvnhunw4bsdbpj7px7s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqqvnhunw4bsdbpj7px7s.png" alt="monolithic architecture single codebase diagram" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In a monolithic architecture, you build and deploy the entire application as one single unit. This means you have to use just one technology stack for the whole app, whether it's Java with Spring Boot, Python with Django, JavaScript with Node.js, or any other combination.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Monolithic architecture is often the go-to choice for small startups, personal projects, or companies that don't deal with a huge user base.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Benefits of Monolithic Architecture&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Easier to Develop:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You work with a single codebase, which means less complexity to manage.&lt;/li&gt;
&lt;li&gt;All parts of your application are in one place, making it simpler to understand the overall structure.&lt;/li&gt;
&lt;li&gt;When you need to add new features, you can easily integrate them into the existing codebase.&lt;/li&gt;
&lt;li&gt;Testing is more straightforward because you can run all tests in one go.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Easier to Manage:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Deployment is simpler because you're dealing with just one application.&lt;/li&gt;
&lt;li&gt;You only need to monitor and maintain a single system.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These advantages make monolithic architecture a practical choice for smaller projects or teams that want to get their application up and running quickly without dealing with the complexities of more distributed systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Challenges with Monolithic Architecture&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Some major issues that come with using a monolithic architecture include:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Single Point of Failure&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In a monolithic setup, all parts of the application are tightly interconnected. This means if something goes wrong in one area—like a bug or performance issue—it can affect the entire system. Imagine if a glitch in one feature causes the whole app to crash, leaving users unable to access anything. This dependency on a single codebase makes the system vulnerable to widespread failures, impacting reliability and user experience. It also limits flexibility in updating and scaling different parts of the app independently, which can lead to more downtime and operational headaches.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Redeployment&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Imagine we need to make a minor update to improve the payment functionality in our application. Even though it's a small change, we have to redeploy the entire app. This can be incredibly frustrating. A simple tweak to one part of the system forces us to go through the whole deployment process again, involving all components of the app, even those not affected by the change. This not only wastes time and resources but also increases the risk of introducing new bugs and downtime, making the process unnecessarily cumbersome.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Scaling Issues&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;When user traffic spikes, a monolithic application can struggle to cope. Every part of the app—from hotel bookings to payments—feels the strain on the single server. This overload leads to slow responses, timeouts, and errors, frustrating users.&lt;/p&gt;

&lt;p&gt;To manage increased traffic, you typically need to scale horizontally by deploying multiple copies of the entire app across many servers.&lt;/p&gt;

&lt;p&gt;However, this method is inefficient because it requires replicating the entire application, even for parts that don't need more resources. And with scaling, comes a hefty bill to manage.&lt;/p&gt;

&lt;p&gt;Balancing performance needs with cost efficiency becomes challenging. Scaling down during quieter periods also poses challenges, including safely decommissioning excess servers without disrupting service and managing data consistency.&lt;/p&gt;

&lt;p&gt;These challenges highlight why monolithic architectures struggle with fluctuating loads and why organizations often turn to more flexible solutions like microservices, which offer better scalability and cost management capabilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Lots of Dependence(Rigid)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If too many developers are working on the same codebase, even making a small change can become problematic. Each change can impact other parts of the application, leading to conflicts and dependencies that need to be resolved. This often results in longer development times, as developers must coordinate closely, perform extensive testing, and handle merge conflicts. The interdependence of various components means that a small tweak by one developer might require adjustments or fixes in seemingly unrelated parts of the code, complicating the development process and slowing down progress.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Solution&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa90snjaxvk8wphi8x6xc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa90snjaxvk8wphi8x6xc.png" alt="monolithic to microservices architecture transition" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enter microservices:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And one of the pioneers in adopting microservices was the renowned media streaming platform, &lt;strong&gt;Netflix&lt;/strong&gt;. Originally built on a monolithic architecture, Netflix faced significant challenges as its user base grew exponentially. With millions of subscribers globally streaming movies and TV shows simultaneously, the monolithic approach struggled to handle the increasing traffic efficiently.&lt;/p&gt;

&lt;p&gt;This led Netflix to innovate and transition towards a microservices architecture, marking a pivotal shift in how modern applications are designed and operated. Today, Netflix operates using hundreds of microservices to power their application. This architectural shift has become a standard for high-traffic applications.&lt;/p&gt;

&lt;p&gt;Netflix’s adoption of microservices revolutionized the way large-scale applications handle scalability, flexibility, and user experience.&lt;/p&gt;

&lt;p&gt;For more info check out these blogs published by Netflix:&lt;br&gt;
&lt;a href="https://netflixtechblog.com/tagged/microservices" rel="noopener noreferrer"&gt;https://netflixtechblog.com/tagged/microservices&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similarly, Atlassian noted in their monolithic vs microservices blog:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In January 2016, we had about 15 total microservices. Now we have more than 1300. We moved 100K customers to the cloud, built a new platform along the way, transformed our culture, and ended up with new tools. We have happier, autonomous teams and a better DevOps culture.Microservices may not be for everyone. A legacy monolith may work perfectly well, and breaking it down may not be worth the trouble. But as organizations grow and the demands on their applications increase, microservices architecture can be worthwhile.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Reference:&lt;br&gt;
&lt;a href="https://www.atlassian.com/microservices/microservices-architecture/microservices-vs-monolith" rel="noopener noreferrer"&gt;https://www.atlassian.com/microservices/microservices-architecture/microservices-vs-monolith&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Microservices&lt;/strong&gt;
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;To sum up microservices in one phrase: don't put all your eggs in one basket.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In a microservices setup, we take a big application and break it down into smaller, manageable pieces, each handling a specific function. These smaller pieces, or services, operate independently, have their codebase, and can be developed and deployed on their own. This makes them loosely connected, allowing for greater flexibility and easier management.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftilk9ya1c439916ug9yj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftilk9ya1c439916ug9yj.png" alt="microservices architecture independent services diagram" width="800" height="575"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Microservices architecture is generally not adopted by small teams or small organizations. It is more commonly implemented by large companies with millions of users and thousands of developers, such as Amazon, Uber, Netflix, Airbnb, etc.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Deciding the Number of Microservices&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;When transitioning from a monolithic application to a microservices architecture, we need to divide the single, unified application into multiple smaller, independent services.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;But the question arises: how many independent services should a monolithic application be divided?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There's no exact answer or strict rule for this—it varies from company to company based on their specific business needs. For example, in our monolithic travel application, the company might choose to split it into smaller services like payments, hotel bookings, flight bookings, authentication, and train bookings. This way, the monolithic travel application becomes five separate microservices, each handling a specific part of the application and working together.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Benefits of Using Microservices&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Independent Deployment (Isolation development and Deployment)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;One of the key advantages of a microservices architecture is the ability to independently deploy individual services. The independent deployment results in major cost savings, lower downtime, and more time saved as we don't have to redeploy the whole application. In this approach, each microservice has its own:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Codebase&lt;/li&gt;
&lt;li&gt;Development team&lt;/li&gt;
&lt;li&gt;Database&lt;/li&gt;
&lt;li&gt;CI/CD pipeline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Independent deployment means you can update, modify, or scale a single service without affecting the entire application. Changes to one service don't require redeploying the whole system.&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Flexible Scaling (granular scaling)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Flight Booking Service:&lt;/strong&gt; During a flash sale on airline tickets...&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hotel Booking Service:&lt;/strong&gt; If it's the off-season...&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payment Service:&lt;/strong&gt; Increased activity...&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Authentication and Signup Service:&lt;/strong&gt; Moderate scaling...&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Train Booking Service:&lt;/strong&gt; Base capacity...&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Technology Flexibility&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Each service can use different technologies best suited for its needs.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;But how do microservices interact with each other?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There are three major ways for microservices to communicate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Synchronous Communication&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Asynchronous Communication&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Service Mesh&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Synchronous Communication&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcva411r51mzq4asluyha.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcva411r51mzq4asluyha.png" alt="synchronous communication microservices api request response" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;API Endpoints&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Request-Response Mechanism&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Real-Time Interaction&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Asynchronous Communication&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft2cccr1mamjy4vfipqhc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft2cccr1mamjy4vfipqhc.png" alt="asynchronous microservices message broker kafka rabbitmq" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Using Message Brokers&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Producer → Broker → Consumer&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Service Mesh: Brief overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A service mesh is a system that helps microservices communicate efficiently and securely using sidecar proxies.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Issues with Microservices&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Complex to Develop&lt;/strong&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Management Overhead&lt;/strong&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;High Infrastructure Cost&lt;/strong&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Because of these challenges, small teams or startups often prefer not to use microservice architecture.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Summary: Choosing Between Monolithic and Microservices&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;When to Use Monolithic Architecture:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simple Apps&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Small Teams&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lower Costs&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Quick Development&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Easy Management&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;When to Opt for Microservices:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Big and Complex Apps&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Need to Scale&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Multiple Teams&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Frequent Updates&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;High Reliability&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Different Tech Needs&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;This article is based on and adapted from content originally published by Unlogged.&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

&lt;p&gt;Happy Coding.&lt;/p&gt;

</description>
      <category>microservices</category>
      <category>systemdesign</category>
      <category>architecture</category>
      <category>backenddevelopment</category>
    </item>
    <item>
      <title>TOON: Token-Oriented Object Notation – A Complete Guide for LLM Data Efficiency</title>
      <dc:creator>Islam Hafez</dc:creator>
      <pubDate>Thu, 11 Dec 2025 12:19:14 +0000</pubDate>
      <link>https://dev.to/islamhafez0/toon-token-oriented-object-notation-a-complete-guide-for-llm-data-efficiency-1ng4</link>
      <guid>https://dev.to/islamhafez0/toon-token-oriented-object-notation-a-complete-guide-for-llm-data-efficiency-1ng4</guid>
      <description>&lt;p&gt;Token-Oriented Object Notation (TOON) is a compact, human-readable encoding of the JSON data model, specifically designed to minimize tokens and simplify structure for Large Language Models (LLMs). It acts as a &lt;strong&gt;drop-in, lossless representation of JSON&lt;/strong&gt;, allowing developers to use familiar JSON programmatically while converting to TOON for efficient AI input.&lt;/p&gt;

&lt;p&gt;TOON merges &lt;strong&gt;YAML’s indentation-based structure&lt;/strong&gt; for nested objects with &lt;strong&gt;CSV-style tabular arrays&lt;/strong&gt; for uniform data. Its primary strength is with &lt;strong&gt;uniform arrays of objects&lt;/strong&gt;—multiple fields per row with consistent structure—achieving compactness similar to CSV, while maintaining explicit schema information for reliable LLM parsing. For deeply nested or non-uniform data, standard JSON may remain more efficient.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why TOON?
&lt;/h3&gt;

&lt;p&gt;With AI becoming more accessible, context windows are expanding, but tokens still cost money. Standard JSON is verbose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"context"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"task"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Our favorite hikes together"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"location"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Boulder"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"season"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"spring_2025"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"friends"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"ana"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"luis"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sam"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hikes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Blue Lake Trail"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"distanceKm"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;7.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"elevationGain"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;320&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"companion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ana"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"wasSunny"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Ridge Overlook"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"distanceKm"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;9.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"elevationGain"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;540&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"companion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"luis"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"wasSunny"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Wildflower Loop"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"distanceKm"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;5.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"elevationGain"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"companion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sam"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"wasSunny"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TOON conveys the same information with fewer tokens, combining &lt;strong&gt;YAML-style indentation&lt;/strong&gt; and &lt;strong&gt;CSV-style tabular arrays&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;context:
  task: Our favorite hikes together
  location: Boulder
  season: spring_2025
friends[3]: ana,luis,sam
hikes[3]{id,name,distanceKm,elevationGain,companion,wasSunny}:
  1,Blue Lake Trail,7.5,320,ana,true
  2,Ridge Overlook,9.2,540,luis,false
  3,Wildflower Loop,5.1,180,sam,true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Key Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Token-Efficient &amp;amp; Accurate:&lt;/strong&gt; TOON achieves up to 74% accuracy versus JSON’s 70% while using ~40% fewer tokens in mixed-structure benchmarks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JSON-Compatible:&lt;/strong&gt; Encodes objects, arrays, and primitives with deterministic, lossless round-trips.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM-Friendly:&lt;/strong&gt; Explicit &lt;code&gt;[N]&lt;/code&gt; lengths and &lt;code&gt;{fields}&lt;/code&gt; headers provide clear schema information for reliable parsing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minimal Syntax:&lt;/strong&gt; Indentation instead of braces, minimal quoting, YAML-like readability with CSV compactness.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tabular Arrays:&lt;/strong&gt; Uniform arrays collapse into tables, declaring fields once and streaming row values line by line.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-Language Ecosystem:&lt;/strong&gt; Implementations exist in TypeScript, Python, Go, Rust, .NET, and more.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Media Type &amp;amp; File Extension
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;File extension:&lt;/strong&gt; &lt;code&gt;.toon&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Media type:&lt;/strong&gt; &lt;code&gt;text/toon&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Always UTF-8 encoded.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  When Not to Use TOON
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Deeply nested or non-uniform structures: JSON compact may use fewer tokens.&lt;/li&gt;
&lt;li&gt;Semi-uniform arrays: Token savings are reduced.&lt;/li&gt;
&lt;li&gt;Pure tabular data: CSV may remain slightly smaller than TOON.&lt;/li&gt;
&lt;li&gt;Latency-critical applications: Test performance against your specific model and setup.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Benchmarks
&lt;/h3&gt;

&lt;p&gt;TOON consistently reduces token usage while improving comprehension across four major LLMs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Efficiency Score:&lt;/strong&gt; Accuracy % ÷ Tokens × 1,000&lt;/li&gt;
&lt;li&gt;Mixed-Structure Track: TOON uses 39.6% fewer tokens while improving accuracy over standard JSON.&lt;/li&gt;
&lt;li&gt;Flat-Only Track: TOON slightly exceeds CSV token count (+6%) for added structure and reliability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Detailed per-model benchmarks show TOON outperforms JSON, YAML, and XML across varied datasets while remaining competitive with CSV on flat tabular data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation &amp;amp; Quick Start
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;CLI (no installation required):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @toon-format/cli input.json &lt;span class="nt"&gt;-o&lt;/span&gt; output.toon
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'{"name": "Ada", "role": "dev"}'&lt;/span&gt; | npx @toon-format/cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;TypeScript Library:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @toon-format/toon
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example usage:&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;encode&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@toon-format/toon&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;users&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="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;admin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Bob&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;// users[2]{id,name,role}:&lt;/span&gt;
&lt;span class="c1"&gt;//   1,Alice,admin&lt;/span&gt;
&lt;span class="c1"&gt;//   2,Bob,user&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Playgrounds &amp;amp; Editor Support
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Official Playground:&lt;/strong&gt; Convert JSON to TOON in real time, compare token counts, share experiments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Editor Support:&lt;/strong&gt; VS Code extension, Tree-sitter grammar, Neovim plugin, and YAML highlighting for other editors.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Using TOON with LLMs
&lt;/h3&gt;

&lt;p&gt;TOON’s structure is self-documenting. When prompting LLMs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wrap data in TOON code blocks.&lt;/li&gt;
&lt;li&gt;Provide &lt;code&gt;[N]&lt;/code&gt; lengths and &lt;code&gt;{fields}&lt;/code&gt; headers.&lt;/li&gt;
&lt;li&gt;Use tab delimiters for token efficiency.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Other Implementations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Official:&lt;/strong&gt; .NET, Dart, Go, Java, Julia, Python, Rust, Swift&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community:&lt;/strong&gt; Apex, C++, Clojure, Crystal, Elixir, Scala, Lua, OCaml, Perl, PHP, R, Ruby, Kotlin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TOON is stable, but still evolving. Contributions, feedback, and experimentation are encouraged.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Summary:&lt;/strong&gt;&lt;br&gt;
TOON provides a &lt;strong&gt;token-efficient, readable, LLM-friendly alternative to JSON&lt;/strong&gt;, especially for uniform arrays of objects. It reduces token costs, increases parsing reliability, and is easy to integrate with existing JSON workflows. For developers working with LLMs at scale, TOON is a &lt;strong&gt;powerful addition to the toolset&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>data</category>
      <category>performance</category>
      <category>llm</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
