<?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: Pradeep Kumar</title>
    <description>The latest articles on DEV Community by Pradeep Kumar (@pradeep_kumar_bc4e7e9f7ec).</description>
    <link>https://dev.to/pradeep_kumar_bc4e7e9f7ec</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%2F4020864%2F9a20ac40-321f-47f1-83b9-b0eff3c257d1.png</url>
      <title>DEV Community: Pradeep Kumar</title>
      <link>https://dev.to/pradeep_kumar_bc4e7e9f7ec</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pradeep_kumar_bc4e7e9f7ec"/>
    <language>en</language>
    <item>
      <title>The Best Open Source LLMs in August 2026: A Developer's Honest Guide</title>
      <dc:creator>Pradeep Kumar</dc:creator>
      <pubDate>Mon, 24 Aug 2026 05:14:00 +0000</pubDate>
      <link>https://dev.to/pradeep_kumar_bc4e7e9f7ec/the-best-open-source-llms-in-august-2026-a-developers-honest-guide-22f8</link>
      <guid>https://dev.to/pradeep_kumar_bc4e7e9f7ec/the-best-open-source-llms-in-august-2026-a-developers-honest-guide-22f8</guid>
      <description>&lt;h2&gt;
  
  
  The Frontier Has No Wall
&lt;/h2&gt;

&lt;p&gt;A year ago, self-hosting an LLM for serious development work usually meant accepting an obvious quality gap versus the closed frontier.&lt;/p&gt;

&lt;p&gt;That gap is now much smaller.&lt;/p&gt;

&lt;p&gt;The best open-weight models in August 2026 are competitive with proprietary systems on a growing number of reasoning, coding, and agentic workloads. On some evaluations, they are already ahead. The more useful question for a developer is no longer:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“Which model has the highest benchmark score?”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“Which model fits my workload, infrastructure, cost envelope, and legal requirements?”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That distinction matters because these models make very different trade-offs.&lt;/p&gt;

&lt;p&gt;Kimi K3 pushes toward maximum capability but requires serious infrastructure. GLM-5.2 and GLM-5.3 emphasize coding and throughput. DeepSeek V4-Pro makes economics a first-class feature. MiniMax M3 is differentiated by native video and multimodality. Qwen3 remains attractive for Apache 2.0 deployments. Muse Glimmer targets local agents. Gemma 4 pushes useful multimodal capability down into smaller hardware tiers.&lt;/p&gt;

&lt;p&gt;The market is also moving fast. Kimi K3 launched in July, while &lt;a href="https://z.ai/blog/glm-5.3" rel="noopener noreferrer"&gt;GLM-5.3&lt;/a&gt;, &lt;a href="https://huggingface.co/Qwen/Qwen3.8-2.4T-A95B" rel="noopener noreferrer"&gt;Qwen3.8-Max&lt;/a&gt;, and &lt;a href="https://huggingface.co/Qwen/Qwen3.8-27B" rel="noopener noreferrer"&gt;Qwen3.8-27B&lt;/a&gt; all arrived in August before this article was published. DeepSeek changed V4 pricing during the same month (&lt;a href="https://api-docs.deepseek.com/" rel="noopener noreferrer"&gt;official API docs&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;So treat every benchmark and price in this article as a dated snapshot, not a permanent truth.&lt;/p&gt;

&lt;p&gt;One terminology point matters from the start: &lt;strong&gt;open-weight is not automatically the same thing as open source&lt;/strong&gt;. Public weights let you download, fine-tune, quantize, and deploy a model, but they do not necessarily expose the complete training data and reproducible training pipeline. For enterprise teams, that distinction can matter.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to Optimize For Before You Pick
&lt;/h2&gt;

&lt;h3&gt;
  
  
  License
&lt;/h3&gt;

&lt;p&gt;Start with the license, not the leaderboard.&lt;/p&gt;

&lt;p&gt;MIT and Apache 2.0 are straightforward starting points for commercial software. Custom licenses need closer reading because they may add attribution, usage, distribution, or scale-related conditions.&lt;/p&gt;

&lt;p&gt;Kimi K3, MiniMax M3, and Qwen3.8-Max should not be treated as equivalent to a plain MIT or Apache 2.0 model simply because their weights are downloadable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deployment scale
&lt;/h3&gt;

&lt;p&gt;Hardware eliminates models surprisingly quickly.&lt;/p&gt;

&lt;p&gt;A cluster-scale model and a 24GB local model may both be excellent, but they solve completely different problems. Before comparing benchmark scores, decide whether you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;a large multi-GPU cluster,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;a smaller GPU server,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;a workstation,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;or a single consumer GPU / Mac.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Context
&lt;/h3&gt;

&lt;p&gt;A 1M-token context window can materially change the architecture of an application that processes large repositories, long documents, or extended agent trajectories.&lt;/p&gt;

&lt;p&gt;But context length is only useful when the model, serving stack, and workload can use it efficiently. Do not confuse a headline context number with a practical production configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Modality
&lt;/h3&gt;

&lt;p&gt;If your application needs native video understanding, the shortlist changes immediately.&lt;/p&gt;

&lt;p&gt;If you only need text plus coding, several models become more attractive. If you need image or video input inside an agent loop, multimodality becomes a first-order selection criterion.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cost and throughput
&lt;/h3&gt;

&lt;p&gt;At scale, token price and output speed compound.&lt;/p&gt;

&lt;p&gt;A model that is slightly better but five times more expensive can be the wrong choice for a pipeline generating millions of tokens. Likewise, a cheaper model with much slower output can lose on wall-clock time when an agent makes many sequential calls.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick-Pick Decision Matrix
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Primary constraint&lt;/th&gt;
&lt;th&gt;Best fit&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;th&gt;Main trade-off&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Highest capability with public weights&lt;/td&gt;
&lt;td&gt;Kimi K3&lt;/td&gt;
&lt;td&gt;Top-tier independent composite score; strong coding profile&lt;/td&gt;
&lt;td&gt;Cluster-scale serving&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best API coding option&lt;/td&gt;
&lt;td&gt;GLM-5.3&lt;/td&gt;
&lt;td&gt;Current GLM flagship on API; strong coding focus&lt;/td&gt;
&lt;td&gt;Weights not yet available&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fast coding with downloadable weights&lt;/td&gt;
&lt;td&gt;GLM-5.2&lt;/td&gt;
&lt;td&gt;Strong quality + high throughput + MIT&lt;/td&gt;
&lt;td&gt;Large serving footprint&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost-sensitive frontier inference&lt;/td&gt;
&lt;td&gt;DeepSeek V4-Pro-0813&lt;/td&gt;
&lt;td&gt;Strong capability at materially lower cost than many frontier APIs&lt;/td&gt;
&lt;td&gt;Slower than GLM; pricing now tiered&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Native video + multimodal&lt;/td&gt;
&lt;td&gt;MiniMax M3&lt;/td&gt;
&lt;td&gt;Text, image, and video in one model&lt;/td&gt;
&lt;td&gt;Custom license&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Apache 2.0 large-model workhorse&lt;/td&gt;
&lt;td&gt;Qwen3 235B-A22B&lt;/td&gt;
&lt;td&gt;Strong capability/cost/licensing balance&lt;/td&gt;
&lt;td&gt;262K context; large memory footprint&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local agent on consumer hardware&lt;/td&gt;
&lt;td&gt;Muse Glimmer&lt;/td&gt;
&lt;td&gt;Strong MCP/tool-oriented profile&lt;/td&gt;
&lt;td&gt;Weaker on some computer-use/terminal benchmarks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local multimodal coding&lt;/td&gt;
&lt;td&gt;Qwen3.8-27B&lt;/td&gt;
&lt;td&gt;Apache 2.0 + image/video + 27B dense model&lt;/td&gt;
&lt;td&gt;Newer ecosystem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Smaller Apache 2.0 entry point&lt;/td&gt;
&lt;td&gt;Gemma 4&lt;/td&gt;
&lt;td&gt;Broad size range and strong local ecosystem&lt;/td&gt;
&lt;td&gt;Not frontier-class&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Frontier Benchmark Snapshot
&lt;/h2&gt;

&lt;p&gt;Artificial Analysis scores are useful here because they provide a consistent cross-model evaluation framework. They should still be read as one signal rather than a universal definition of intelligence.&lt;/p&gt;

&lt;p&gt;For the current August snapshot, the important story is the cluster at the top:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Intelligence Index&lt;/th&gt;
&lt;th&gt;Practical read&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Kimi K3&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;td&gt;Top weights-available option&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GLM-5.3&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;td&gt;Tied with K3 on the API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Qwen3.8 2.4T-A95B&lt;/td&gt;
&lt;td&gt;58&lt;/td&gt;
&lt;td&gt;High-end Qwen frontier contender&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DeepSeek V4-Pro-0813&lt;/td&gt;
&lt;td&gt;53&lt;/td&gt;
&lt;td&gt;Stronger than its preview release&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Qwen3.8-27B&lt;/td&gt;
&lt;td&gt;52&lt;/td&gt;
&lt;td&gt;Exceptional size/performance position&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GLM-5.2&lt;/td&gt;
&lt;td&gt;51&lt;/td&gt;
&lt;td&gt;Still highly competitive on coding&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MiniMax M3&lt;/td&gt;
&lt;td&gt;45&lt;/td&gt;
&lt;td&gt;More differentiated by modality than raw text score&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The point is not that 60 is “good” and 52 is “bad.” A 52-score model that fits on your hardware can be more valuable than a 60-score model that needs an accelerator cluster.&lt;/p&gt;




&lt;h2&gt;
  
  
  Kimi K3: The Benchmark Leader
&lt;/h2&gt;

&lt;p&gt;Kimi K3 is the clearest choice when the question is simply:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“What is the strongest open-weight model I can actually download today?”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is a 2.8T-parameter sparse MoE with 16 of 896 routed experts active per token, a 1M-token context window, and a public checkpoint released under a custom Kimi K3 license.&lt;/p&gt;

&lt;p&gt;Its architecture combines &lt;strong&gt;Kimi Delta Attention (KDA)&lt;/strong&gt;, &lt;strong&gt;Stable LatentMoE&lt;/strong&gt;, and &lt;strong&gt;Attention Residuals&lt;/strong&gt;. KDA is particularly important for long-context efficiency because it combines linear and full-attention patterns rather than treating every layer identically.&lt;/p&gt;

&lt;p&gt;Moonshot's &lt;a href="https://github.com/MoonshotAI/Kimi-K3" rel="noopener noreferrer"&gt;current Kimi K3 repository&lt;/a&gt; reports &lt;strong&gt;88.3 on Terminal-Bench 2.1&lt;/strong&gt;, alongside strong results on FrontierSWE, DeepSWE, ProgramBench, and GPQA Diamond. Artificial Analysis also places K3 at the top of its open-weight Intelligence Index snapshot at 60.&lt;/p&gt;

&lt;p&gt;That does not mean K3 wins every benchmark. It does not. The most important example is SWE-Bench Verified, where DeepSeek's published score is higher. Benchmark harness differences also matter, especially on coding-agent evaluations.&lt;/p&gt;

&lt;p&gt;The bigger practical problem is infrastructure.&lt;/p&gt;

&lt;p&gt;The official K3 checkpoint is around &lt;strong&gt;1.56 TB&lt;/strong&gt;. This is not a model you casually start on an eight-GPU box. Moonshot's serving guidance points toward large accelerator configurations, and production deployment is a cluster problem.&lt;/p&gt;

&lt;p&gt;The other consideration is the license. K3 is &lt;strong&gt;not MIT&lt;/strong&gt; and &lt;strong&gt;not Apache 2.0&lt;/strong&gt;. It uses a custom license with additional terms at very large commercial scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Kimi K3 when:&lt;/strong&gt; capability matters more than infrastructure simplicity, you can afford cluster-scale inference, and you want the strongest downloadable model in this comparison.&lt;/p&gt;




&lt;h2&gt;
  
  
  GLM-5.2 / GLM-5.3: The Production Coding Workhorse
&lt;/h2&gt;

&lt;p&gt;The GLM family is interesting because it separates two different needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GLM-5.2&lt;/strong&gt; is the practical weights-available option. &lt;strong&gt;GLM-5.3&lt;/strong&gt; is the newer API flagship.&lt;/p&gt;

&lt;p&gt;GLM-5.2 is a roughly 744B-parameter sparse MoE with about 40B active parameters per token and a 1M-token context. It is released under MIT and has built a strong reputation among coding-agent users.&lt;/p&gt;

&lt;p&gt;Its Artificial Analysis Intelligence Index score is 51. Z.ai reports &lt;strong&gt;62.1% on SWE-Bench Pro&lt;/strong&gt; and an output speed around &lt;strong&gt;168–200 tokens/second&lt;/strong&gt;. The exact throughput number should be treated as measurement-dependent, but the high-throughput positioning is real and important.&lt;/p&gt;

&lt;p&gt;GLM-5.3 changes the equation for teams that do not require public weights. Released in August, it is the current GLM API model and reaches an Artificial Analysis score of &lt;strong&gt;60&lt;/strong&gt;, tying Kimi K3 in the August snapshot.&lt;/p&gt;

&lt;p&gt;For coding agents, that makes GLM-5.3 especially interesting: you get the newer model without having to operate the enormous checkpoint yourself.&lt;/p&gt;

&lt;p&gt;The trade-off is obvious. GLM-5.3's weights were not yet public as of the article's publication date, so it should not be described as equivalent to K3 from a self-hosting perspective.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use GLM-5.2 when:&lt;/strong&gt; you want a strong coding model with public weights, MIT licensing, and high throughput.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use GLM-5.3 when:&lt;/strong&gt; API access is acceptable and you want the current GLM capability level without running the model yourself.&lt;/p&gt;




&lt;h2&gt;
  
  
  DeepSeek V4-Pro: The Cost-Sensitive Frontier Choice
&lt;/h2&gt;

&lt;p&gt;DeepSeek V4-Pro is the model to watch when economics matter as much as benchmark position.&lt;/p&gt;

&lt;p&gt;The original preview launched in April. The important August event is the &lt;strong&gt;V4-Pro-0813 GA release&lt;/strong&gt;, which improved the model's Artificial Analysis score from the earlier preview level to &lt;strong&gt;53&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The model is a 1.6T sparse MoE with about 49B active parameters, a 1M-token context window, and MIT licensing. It is text-only rather than multimodal.&lt;/p&gt;

&lt;p&gt;The most important change for production planning is pricing.&lt;/p&gt;

&lt;p&gt;The old flat &lt;strong&gt;$0.87/M output-token&lt;/strong&gt; figure is no longer current. DeepSeek moved V4-Pro to peak/off-peak pricing on August 16. That means any article comparing DeepSeek's economics using the old flat rate is already stale.&lt;/p&gt;

&lt;p&gt;The good news is that V4-Pro remains highly competitive on cost, especially for workloads that can take advantage of lower off-peak rates.&lt;/p&gt;

&lt;p&gt;The downside is throughput. Artificial Analysis measures the GA release at roughly &lt;strong&gt;77 tokens/second&lt;/strong&gt;, below the GLM family.&lt;/p&gt;

&lt;p&gt;For batch generation, classification, summarization, and structured generation, that can be a very attractive trade. For latency-sensitive multi-step agent loops, the economics may not be the only consideration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use DeepSeek V4-Pro when:&lt;/strong&gt; cost per generated token is one of your primary constraints and your workloads can tolerate its lower throughput or take advantage of off-peak pricing.&lt;/p&gt;




&lt;h2&gt;
  
  
  MiniMax M3: The Multimodal Specialist
&lt;/h2&gt;

&lt;p&gt;MiniMax M3 earns its place because it optimizes for something the other frontier models do not prioritize as strongly: &lt;strong&gt;native multimodal reasoning that includes video&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;M3 is a sparse MoE model with roughly 428B total parameters and around 23B active parameters per token. Its documented context is &lt;strong&gt;1M tokens&lt;/strong&gt;, with 512K functioning as an important guaranteed/billing threshold.&lt;/p&gt;

&lt;p&gt;It accepts &lt;strong&gt;text, image, and video input&lt;/strong&gt;. That makes it particularly interesting for applications that need to reason across screenshots, documents, images, and video frames without building separate modality pipelines.&lt;/p&gt;

&lt;p&gt;Artificial Analysis currently places M3 at 45 on its Intelligence Index, while its output speed is around 105 tokens/second.&lt;/p&gt;

&lt;p&gt;The important caveat is licensing. MiniMax uses its &lt;strong&gt;Community License&lt;/strong&gt;, not MIT or Apache 2.0. Commercial deployment therefore deserves a license review before you build around the model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use MiniMax M3 when:&lt;/strong&gt; video and multimodal reasoning are core requirements rather than nice-to-have features.&lt;/p&gt;




&lt;h2&gt;
  
  
  Qwen3 235B-A22B: The Apache Workhorse
&lt;/h2&gt;

&lt;p&gt;Qwen3 235B-A22B remains one of the most practical large open models for teams that care about licensing and self-hosting.&lt;/p&gt;

&lt;p&gt;It is a 235B sparse MoE with 22B active parameters per token, a 262K context window, and an &lt;strong&gt;Apache 2.0&lt;/strong&gt; license.&lt;/p&gt;

&lt;p&gt;Its appeal is not that it beats every frontier model. It is that the combination of capability, licensing, API economics, and deployment flexibility is unusually balanced.&lt;/p&gt;

&lt;p&gt;With INT4 quantization, the model can fit into a roughly 60GB-class VRAM budget, making it much more approachable than cluster-scale frontier checkpoints.&lt;/p&gt;

&lt;p&gt;The important distinction is that &lt;strong&gt;Qwen3 235B and Qwen3.8 are separate model families&lt;/strong&gt;. Qwen3.8 is newer and much larger at the top end, but the 235B model remains attractive when you specifically want a mature Apache 2.0 workhorse.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Qwen3 235B when:&lt;/strong&gt; Apache 2.0 matters, you want a large model you can actually deploy yourself, and you do not need the 1M-token context of the newest frontier systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  Muse Glimmer: The Local Agent
&lt;/h2&gt;

&lt;p&gt;Muse Glimmer answers a different question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“What capable agent model can I actually run on hardware I own?”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Meta's Glimmer is a roughly 30B-class dense model with a 131K context window and Apache 2.0 licensing. It accepts text and image inputs and is designed specifically around agentic workflows and tool use.&lt;/p&gt;

&lt;p&gt;Its strongest published results are on agent-oriented evaluations such as MCP Atlas and DeepSearch QA. Meta's own comparison tables also show areas where Qwen3.6-27B performs better, particularly on some computer-use and terminal evaluations.&lt;/p&gt;

&lt;p&gt;That is actually useful because it tells you what Glimmer is &lt;em&gt;for&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Glimmer's most interesting advantage is not being a universal benchmark winner. It is providing a capable local agent stack without requiring a giant cluster.&lt;/p&gt;

&lt;p&gt;Quantized builds can fit into a roughly 24GB-class GPU envelope, depending on the quantization and serving configuration. The model also has broad local-runtime support.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Muse Glimmer when:&lt;/strong&gt; privacy, local execution, and MCP/tool orchestration matter more than absolute benchmark leadership.&lt;/p&gt;




&lt;h2&gt;
  
  
  Gemma 4: The Entry Point
&lt;/h2&gt;

&lt;p&gt;Gemma 4 is not a frontier contender against Kimi K3 or GLM-5.3, and it does not need to be.&lt;/p&gt;

&lt;p&gt;Its strength is breadth.&lt;/p&gt;

&lt;p&gt;Google's family includes &lt;strong&gt;E2B, E4B, 12B Unified, 26B A4B MoE, and 31B Dense&lt;/strong&gt; variants, with Apache 2.0 licensing. The edge models offer 128K context, while the larger models support up to 256K.&lt;/p&gt;

&lt;p&gt;The family is multimodal, and the smaller variants extend into audio as well. That makes Gemma unusually flexible across edge, workstation, and larger local deployments.&lt;/p&gt;

&lt;p&gt;For developers getting started with self-hosted inference, the combination of a clean license, multiple model sizes, multimodal capability, and a large ecosystem is compelling.&lt;/p&gt;

&lt;p&gt;One hardware caveat is important: consumer-GPU deployment depends heavily on quantization and context length. A 31B model that fits on a 24GB card in one 4-bit configuration is not the same thing as saying every serving configuration fits into 24GB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Gemma 4 when:&lt;/strong&gt; you are getting started with local inference, need a smaller model family, want Apache 2.0, or want a mature ecosystem across several hardware tiers.&lt;/p&gt;




&lt;h2&gt;
  
  
  Three August Releases You Should Not Ignore
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Qwen3.8-Max
&lt;/h3&gt;

&lt;p&gt;Qwen3.8-Max is the most important omitted model from the original draft because it moves the Qwen family into the same conversation as the largest frontier open-weight systems.&lt;/p&gt;

&lt;p&gt;The open checkpoint is around &lt;strong&gt;2.4T parameters with roughly 95B active&lt;/strong&gt;, while the hosted version provides multimodal capabilities and a 1M-token context configuration.&lt;/p&gt;

&lt;p&gt;The key caveat is that the &lt;strong&gt;hosted API and downloadable checkpoint are not identical product experiences&lt;/strong&gt;. The public checkpoint has different modality/context characteristics and uses a custom Qwen3.8-Max license.&lt;/p&gt;

&lt;p&gt;At this scale, the open weights are a datacenter project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why watch it:&lt;/strong&gt; frontier capability without being tied to a closed model API, for organizations with the infrastructure to serve it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Qwen3.8-27B
&lt;/h3&gt;

&lt;p&gt;Qwen3.8-27B is much more relevant to ordinary developers.&lt;/p&gt;

&lt;p&gt;It is a dense &lt;strong&gt;27.78B&lt;/strong&gt; model under &lt;strong&gt;Apache 2.0&lt;/strong&gt;, with native multimodal input and a 262K context window, extendable with long-context techniques.&lt;/p&gt;

&lt;p&gt;Quantized builds can fit into a roughly 17GB-class memory envelope, putting it firmly into single-GPU territory.&lt;/p&gt;

&lt;p&gt;It is especially interesting because it fills the exact hole created by the original article's nonexistent “Gemma 4 27B” recommendation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why watch it:&lt;/strong&gt; Apache 2.0, multimodality, and serious capability in a model that is still realistic to run locally.&lt;/p&gt;

&lt;h3&gt;
  
  
  GLM-5.3
&lt;/h3&gt;

&lt;p&gt;GLM-5.3 deserves mention even though its weights were not yet public at publication.&lt;/p&gt;

&lt;p&gt;Its Artificial Analysis score of &lt;strong&gt;60&lt;/strong&gt; puts it alongside Kimi K3 in the August snapshot, and its coding-focused positioning makes it one of the most important API models to test if your workload is agentic software engineering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why watch it:&lt;/strong&gt; it changes the conclusion for teams that value API performance more than self-hosting.&lt;/p&gt;




&lt;h2&gt;
  
  
  Open-Weight vs. Open-Source
&lt;/h2&gt;

&lt;p&gt;This distinction is easy to ignore until it becomes important.&lt;/p&gt;

&lt;p&gt;An open-weight model gives you the model parameters. That can be enough for fine-tuning, local inference, quantization, private deployment, and serious product development.&lt;/p&gt;

&lt;p&gt;But it does not necessarily give you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;the complete training dataset,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the full preprocessing pipeline,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the exact training recipe,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;or the ability to reproduce the model from scratch.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That matters differently depending on the organization.&lt;/p&gt;

&lt;p&gt;For a startup shipping an internal coding assistant, it may be mostly academic.&lt;/p&gt;

&lt;p&gt;For a regulated enterprise, a research lab, or a company planning to maintain a model for years, it can affect reproducibility, legal review, procurement, and long-term risk.&lt;/p&gt;

&lt;p&gt;Also read the actual license. “Open weights” does not imply MIT or Apache 2.0.&lt;/p&gt;




&lt;h2&gt;
  
  
  Bottom Line
&lt;/h2&gt;

&lt;p&gt;The open-weight ecosystem has moved from “good enough if you accept compromises” to “choose according to your constraints.”&lt;/p&gt;

&lt;p&gt;That changes how you should evaluate models.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need the strongest downloadable frontier model?&lt;/strong&gt; Start with &lt;strong&gt;Kimi K3&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need the strongest current coding API in this group?&lt;/strong&gt; Test &lt;strong&gt;GLM-5.3&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need high-throughput coding with public weights?&lt;/strong&gt; &lt;strong&gt;GLM-5.2&lt;/strong&gt; remains compelling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need cost-sensitive frontier inference?&lt;/strong&gt; &lt;strong&gt;DeepSeek V4-Pro-0813&lt;/strong&gt; remains one of the strongest economic choices, but use current tiered pricing in your model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need native video understanding?&lt;/strong&gt; &lt;strong&gt;MiniMax M3&lt;/strong&gt; is the specialist.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need Apache 2.0 and a large self-hosted model?&lt;/strong&gt; &lt;strong&gt;Qwen3 235B-A22B&lt;/strong&gt; remains highly attractive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need a local agent on consumer hardware?&lt;/strong&gt; Evaluate &lt;strong&gt;Muse Glimmer&lt;/strong&gt; and &lt;strong&gt;Qwen3.8-27B&lt;/strong&gt; against your exact workload.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need an approachable local family with a clean license?&lt;/strong&gt; &lt;strong&gt;Gemma 4&lt;/strong&gt; is still one of the best starting points.&lt;/p&gt;

&lt;p&gt;The leaderboard will change again next week.&lt;/p&gt;

&lt;p&gt;Your hardware budget, latency target, license requirements, and workload will not.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://artificialanalysis.ai/" rel="noopener noreferrer"&gt;Artificial Analysis — Intelligence Index&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/MoonshotAI/Kimi-K3" rel="noopener noreferrer"&gt;Moonshot AI — Kimi K3 GitHub repository&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/MoonshotAI/Kimi-K3/blob/main/LICENSE" rel="noopener noreferrer"&gt;Moonshot AI — Kimi K3 license&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://z.ai/blog/glm-5.3" rel="noopener noreferrer"&gt;Z.ai — GLM-5.3 announcement&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://huggingface.co/zai-org/GLM-5.2" rel="noopener noreferrer"&gt;Hugging Face — GLM-5.2&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://api-docs.deepseek.com/" rel="noopener noreferrer"&gt;DeepSeek — API documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.minimax.io/models/text/m3" rel="noopener noreferrer"&gt;MiniMax — M3 model page&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.minimax.io/blog/minimax-m3" rel="noopener noreferrer"&gt;MiniMax — M3 technical/release post&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://huggingface.co/Qwen/Qwen3-235B-A22B-Instruct-2507" rel="noopener noreferrer"&gt;Hugging Face — Qwen3-235B-A22B-Instruct-2507&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://huggingface.co/Qwen/Qwen3.8-2.4T-A95B" rel="noopener noreferrer"&gt;Hugging Face — Qwen3.8-2.4T-A95B&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://huggingface.co/Qwen/Qwen3.8-27B" rel="noopener noreferrer"&gt;Hugging Face — Qwen3.8-27B&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://huggingface.co/meta-models/Muse-Glimmer-30B" rel="noopener noreferrer"&gt;Hugging Face — Muse Glimmer 30B&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://blog.google/innovation-and-ai/technology/developers-tools/gemma-4/" rel="noopener noreferrer"&gt;Google DeepMind — Gemma 4&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://zyvop.com/the-best-open-source-llms-in-august-2026-a-developer-s-honest-guide-ktrmx" rel="noopener noreferrer"&gt;ZyVOP&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;💡 For more articles like this, &lt;a href="https://zyvop.com/newsletter" rel="noopener noreferrer"&gt;subscribe to the ZyVOP newsletter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>aimodels</category>
      <category>opensourcemodels</category>
      <category>benchmarks</category>
      <category>opensourcemodelsaugust2026</category>
    </item>
    <item>
      <title>Caching Strategies Every Backend Developer Must Know</title>
      <dc:creator>Pradeep Kumar</dc:creator>
      <pubDate>Fri, 21 Aug 2026 07:10:14 +0000</pubDate>
      <link>https://dev.to/pradeep_kumar_bc4e7e9f7ec/caching-strategies-every-backend-developer-must-know-1588</link>
      <guid>https://dev.to/pradeep_kumar_bc4e7e9f7ec/caching-strategies-every-backend-developer-must-know-1588</guid>
      <description>&lt;p&gt;There is a reason Phil Karlton's 1990s quip — that the two hardest problems in computer science are cache invalidation and naming things — still surfaces in every engineering conversation. Caching is simple in theory and genuinely difficult in practice. Get it right and your API responds in single-digit milliseconds under load. Get it wrong and you ship corrupted data, stale reads, or a cache stampede that takes down your database at peak traffic.&lt;/p&gt;

&lt;p&gt;This guide cuts through the noise. You will learn the five core caching patterns, when to reach for each one, how eviction policies work, how to approach the invalidation problem, and what &lt;em&gt;not&lt;/em&gt; to cache. Every section includes working code you can apply today.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Caching Matters: The Numbers
&lt;/h2&gt;

&lt;p&gt;The performance gap between a database read and a cache read is not incremental — it is categorical. AWS benchmarks on RDS for MySQL 8.0 paired with ElastiCache &lt;a href="https://aws.amazon.com/blogs/database/optimize-cost-and-boost-performance-of-rds-for-mysql-using-amazon-elasticache-for-redis/" rel="noopener noreferrer"&gt;show average read latency dropping from 14 ms to 0.51 ms&lt;/a&gt; — a 27x improvement — with RDS CPU utilization falling from 78% to 32% and throughput increasing 34% simultaneously. A single Redis instance, per &lt;a href="https://redis.io/docs/latest/operate/oss_and_stack/management/optimization/benchmarks/" rel="noopener noreferrer"&gt;Redis's own benchmark documentation&lt;/a&gt;, can sustain over 1.8 million GET operations per second with pipelining enabled. The database cannot compete with RAM on raw throughput.&lt;/p&gt;

&lt;p&gt;The impact at scale is equally stark. Facebook's Memcached deployment, &lt;a href="https://www.usenix.org/conference/nsdi13/technical-sessions/presentation/nishtala" rel="noopener noreferrer"&gt;documented at USENIX NSDI '13&lt;/a&gt;, handles billions of requests per second across trillions of cached items — an architecture where the cache, not the database, is the primary read path for the world's largest social network. &lt;a href="https://pages.awscloud.com/Optimize-Amazon-RDS-and-Aurora-Costs-with-ElastiCache-for-Redis_2023_SN-0701-DAT_OD" rel="noopener noreferrer"&gt;AWS benchmarks&lt;/a&gt; further show caching RDS workloads can reduce infrastructure costs by up to 55%, because fewer read replicas are needed.&lt;/p&gt;

&lt;p&gt;The relationship between hit rate and database load is direct: at an 80% cache hit rate, 80% of your database reads are eliminated. The chart below shows how this scales:&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%2Ff2n07wrpzko9xiwctal2.webp" 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%2Ff2n07wrpzko9xiwctal2.webp" width="720" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The point is not that caching always helps — the sections below explain when it actively hurts. It is that ignoring it, at any meaningful scale, almost always leaves significant performance and cost on the table.&lt;/p&gt;




&lt;h2&gt;
  
  
  Core Terminology
&lt;/h2&gt;

&lt;p&gt;Get these four concepts locked in before the patterns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cache hit / cache miss&lt;/strong&gt; — A &lt;em&gt;hit&lt;/em&gt; means the requested key exists in cache and is returned directly. A &lt;em&gt;miss&lt;/em&gt; means it does not; the application must fetch from the source of truth (usually the database).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TTL (Time to Live)&lt;/strong&gt; — How long a cached entry lives before it expires automatically. Too short and you get high miss rates; too long and you risk serving stale data. The right TTL is almost always workload-specific and discovered through measurement, not intuition.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Eviction policy&lt;/strong&gt; — What happens when the cache runs out of memory. The cache must remove &lt;em&gt;something&lt;/em&gt; to make room. Your policy choice determines &lt;em&gt;what&lt;/em&gt; gets removed (covered in its own section below).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cache stampede (thundering herd)&lt;/strong&gt; — What happens when many requests simultaneously miss a key that just expired, all racing to repopulate it from the database at once. This is one of the most common ways caching makes an outage &lt;em&gt;worse&lt;/em&gt; rather than better.&lt;/p&gt;




&lt;h2&gt;
  
  
  Quick Decision Framework
&lt;/h2&gt;

&lt;p&gt;Before the deep dives, here is the pattern-selection map. Jump to whichever section applies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;Is&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="n"&gt;read&lt;/span&gt; &lt;span class="n"&gt;frequently&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;written&lt;/span&gt; &lt;span class="n"&gt;infrequently&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
  &lt;span class="err"&gt;└─&lt;/span&gt; &lt;span class="n"&gt;Yes&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="n"&gt;Cache&lt;/span&gt;&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="nf"&gt;Aside&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;or&lt;/span&gt; &lt;span class="n"&gt;Read&lt;/span&gt;&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Through&lt;/span&gt;

&lt;span class="n"&gt;Is&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="n"&gt;consistency&lt;/span&gt; &lt;span class="n"&gt;critical&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;every&lt;/span&gt; &lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
  &lt;span class="err"&gt;└─&lt;/span&gt; &lt;span class="n"&gt;Yes&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Through&lt;/span&gt;
  &lt;span class="err"&gt;└─&lt;/span&gt; &lt;span class="n"&gt;No&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;writes&lt;/span&gt; &lt;span class="n"&gt;are&lt;/span&gt; &lt;span class="n"&gt;very&lt;/span&gt; &lt;span class="n"&gt;frequent&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="nf"&gt;Behind&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;durable&lt;/span&gt; &lt;span class="n"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;Are&lt;/span&gt; &lt;span class="n"&gt;hot&lt;/span&gt; &lt;span class="n"&gt;keys&lt;/span&gt; &lt;span class="n"&gt;causing&lt;/span&gt; &lt;span class="n"&gt;stampedes&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;expiry&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
  &lt;span class="err"&gt;└─&lt;/span&gt; &lt;span class="n"&gt;Yes&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="n"&gt;Refresh&lt;/span&gt;&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Ahead&lt;/span&gt;

&lt;span class="n"&gt;Can&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;tolerate&lt;/span&gt; &lt;span class="n"&gt;eventual&lt;/span&gt; &lt;span class="nf"&gt;consistency&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;minutes&lt;/span&gt;&lt;span class="p"&gt;)?&lt;/span&gt;
  &lt;span class="err"&gt;└─&lt;/span&gt; &lt;span class="n"&gt;Yes&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="n"&gt;TTL&lt;/span&gt;&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="n"&gt;based&lt;/span&gt; &lt;span class="n"&gt;invalidation&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;sufficient&lt;/span&gt;

&lt;span class="n"&gt;Must&lt;/span&gt; &lt;span class="n"&gt;every&lt;/span&gt; &lt;span class="n"&gt;read&lt;/span&gt; &lt;span class="n"&gt;see&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;latest&lt;/span&gt; &lt;span class="n"&gt;write&lt;/span&gt; &lt;span class="n"&gt;immediately&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
  &lt;span class="err"&gt;└─&lt;/span&gt; &lt;span class="n"&gt;Yes&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="n"&gt;Do&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="n"&gt;cache&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The Five Core Caching Patterns
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Cache-Aside (Lazy Loading)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;The most common pattern.&lt;/strong&gt; The application owns all cache interaction logic. On a read, it checks the cache first. On a miss, it queries the database, stores the result in cache, and returns it to the caller.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Read&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;
     &lt;span class="err"&gt;│&lt;/span&gt;
     &lt;span class="err"&gt;▼&lt;/span&gt;
  &lt;span class="nc"&gt;Cache&lt;/span&gt; &lt;span class="n"&gt;hit&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="err"&gt;──&lt;/span&gt;&lt;span class="nc"&gt;Yes&lt;/span&gt;&lt;span class="err"&gt;──▶&lt;/span&gt; &lt;span class="k"&gt;Return&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;
     &lt;span class="err"&gt;│&lt;/span&gt;
     &lt;span class="nc"&gt;No&lt;/span&gt;
     &lt;span class="err"&gt;│&lt;/span&gt;
     &lt;span class="err"&gt;▼&lt;/span&gt;
  &lt;span class="nc"&gt;Query&lt;/span&gt; &lt;span class="n"&gt;database&lt;/span&gt;
     &lt;span class="err"&gt;│&lt;/span&gt;
     &lt;span class="err"&gt;▼&lt;/span&gt;
  &lt;span class="nc"&gt;Store&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;cache&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;with&lt;/span&gt; &lt;span class="no"&gt;TTL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
     &lt;span class="err"&gt;│&lt;/span&gt;
     &lt;span class="err"&gt;▼&lt;/span&gt;
  &lt;span class="k"&gt;Return&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Node.js / Redis example:&lt;/strong&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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createClient&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;redis&lt;/span&gt;&lt;span class="dl"&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;redis&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createClient&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;REDIS_URL&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&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;cacheKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`user:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// 1. Check cache first&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&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;cacheKey&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;cached&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;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// cache hit&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// 2. Miss — fetch from database&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SELECT * FROM users WHERE id = $1&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="nx"&gt;userId&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="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&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;// 3. Populate cache with a 10-minute TTL&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setEx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cacheKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&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;user&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;&lt;strong&gt;Python equivalent:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;

&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;REDIS_URL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_user_by_id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;cache_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;r&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="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT * FROM users WHERE id = %s&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;,)).&lt;/span&gt;&lt;span class="nf"&gt;fetchone&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cache_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt; Read-heavy workloads where data changes infrequently. The cache only populates on demand, so you never pre-warm stale entries. It is resilient to cache failures — if Redis goes down, the application still works (slower, but correctly).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trade-off:&lt;/strong&gt; The first request after a cache miss (or expiry) always hits the database. Under high concurrency this becomes the stampede problem. Add a distributed lock or use the refresh-ahead pattern to mitigate.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Read-Through
&lt;/h3&gt;

&lt;p&gt;Similar to cache-aside, but the &lt;strong&gt;cache itself fetches from the database&lt;/strong&gt; on a miss, rather than the application. The application &lt;em&gt;only ever talks to the cache&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="c1"&gt;// The cache client is configured with a loader function&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cache&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;CacheClient&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;async &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="o"&gt;=&amp;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;userId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&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="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SELECT * FROM users WHERE id = $1&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="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;ttl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Application code is now clean:&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&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;cache&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="s2"&gt;`user:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// miss handled internally&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt; When you want to keep cache interaction logic in one place and out of business code. Works well with managed caching services that support loader callbacks (e.g., Momento, AWS ElastiCache with data tiering).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trade-off:&lt;/strong&gt; Slightly less flexible than cache-aside — you cannot customize the miss flow per call site. The first-request miss penalty is identical.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Write-Through
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Every write goes to the cache &lt;em&gt;and&lt;/em&gt; the database simultaneously&lt;/strong&gt;, synchronously, before returning to the caller.&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;updateUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&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="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cacheKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`user:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// Write to database first (or transactionally with cache)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;updated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;UPDATE users SET name = $1, email = $2 WHERE id = $3 RETURNING *&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="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&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="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Immediately update cache&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setEx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cacheKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;updated&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;updated&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;&lt;strong&gt;When to use it:&lt;/strong&gt; When data consistency is critical and writes are not extremely frequent. The cache is always warm and always fresh. Read performance is excellent because entries exist immediately after a write — no cold-start miss.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trade-off:&lt;/strong&gt; Every write requires two round-trips (database + cache) before returning. For write-heavy workloads this compounds at scale. You also cache data that might never be read, wasting memory.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Write-Behind (Write-Back)
&lt;/h3&gt;

&lt;p&gt;The application writes &lt;strong&gt;to the cache only&lt;/strong&gt;, and a background process flushes dirty entries to the database asynchronously. The write returns immediately after the cache is updated.&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="c1"&gt;// Simplified write-behind with a queue&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;updateUserAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&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="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cacheKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`user:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// Write to cache immediately — caller gets fast response&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setEx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cacheKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&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="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;

  &lt;span class="c1"&gt;// Queue the database write for background processing&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lPush&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;db:write-queue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;users&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;userId&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="na"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Background worker (runs separately)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;processWriteQueue&lt;/span&gt;&lt;span class="p"&gt;()&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="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;brPop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;db:write-queue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// blocking pop&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;table&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;id&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="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`UPDATE &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;table&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; SET name=$1, email=$2 WHERE id=$3`&lt;/span&gt;&lt;span class="p"&gt;,&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="nx"&gt;name&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="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When to use it:&lt;/strong&gt; High write-throughput scenarios where sub-millisecond write latency is required and you can tolerate a small window of data loss. Session stores, analytics event pipelines, activity feeds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trade-off:&lt;/strong&gt; &lt;strong&gt;Risk of data loss.&lt;/strong&gt; If the cache node fails between the write and the flush, the database never gets updated. Always pair write-behind with Redis persistence (AOF or RDB) and durable queue infrastructure (e.g., Kafka, SQS) in production.&lt;/p&gt;




&lt;h3&gt;
  
  
  5. Refresh-Ahead (Proactive Refresh)
&lt;/h3&gt;

&lt;p&gt;The cache &lt;strong&gt;predicts which entries are about to expire&lt;/strong&gt; and refreshes them in the background &lt;em&gt;before&lt;/em&gt; they go cold — so the caller never experiences a miss.&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;const&lt;/span&gt; &lt;span class="nx"&gt;REFRESH_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// refresh when 20% of TTL remains&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserWithRefreshAhead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&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;cacheKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`user:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ttlRemaining&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="nx"&gt;redis&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;cacheKey&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ttl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cacheKey&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;cached&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;fullTtl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// your configured TTL&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;shouldRefresh&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ttlRemaining&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;fullTtl&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;REFRESH_THRESHOLD&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;shouldRefresh&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// Trigger background refresh without blocking the caller&lt;/span&gt;
      &lt;span class="nf"&gt;refreshUserCache&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="k"&gt;catch&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="nx"&gt;error&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;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Full miss — blocking refresh&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;refreshUserCache&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;refreshUserCache&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&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;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SELECT * FROM users WHERE id = $1&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="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setEx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`user:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&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;user&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;&lt;strong&gt;When to use it:&lt;/strong&gt; Frequently accessed, expensive-to-compute data where cache miss latency is unacceptable. Home page aggregations, pricing data, leaderboards. Eliminates the stampede problem entirely for hot keys.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trade-off:&lt;/strong&gt; You may refresh data that was never requested after its refresh — wasted compute. Requires good observability to tune the threshold correctly.&lt;/p&gt;




&lt;h2&gt;
  
  
  Eviction Policies: What Gets Dropped When Memory Is Full
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Policy&lt;/th&gt;
&lt;th&gt;Full Name&lt;/th&gt;
&lt;th&gt;How It Works&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;LRU&lt;/td&gt;
&lt;td&gt;Least Recently Used&lt;/td&gt;
&lt;td&gt;Evicts the entry accessed least recently&lt;/td&gt;
&lt;td&gt;General-purpose; good default&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LFU&lt;/td&gt;
&lt;td&gt;Least Frequently Used&lt;/td&gt;
&lt;td&gt;Evicts the entry accessed least often overall&lt;/td&gt;
&lt;td&gt;Workloads with stable hot-key distribution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FIFO&lt;/td&gt;
&lt;td&gt;First In First Out&lt;/td&gt;
&lt;td&gt;Evicts oldest entry regardless of access&lt;/td&gt;
&lt;td&gt;Simple queues; less common&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TTL&lt;/td&gt;
&lt;td&gt;Time-based&lt;/td&gt;
&lt;td&gt;Evicts based on expiry time&lt;/td&gt;
&lt;td&gt;All workloads; complements LRU/LFU&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Random&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;Evicts a random entry&lt;/td&gt;
&lt;td&gt;Rarely the right choice in production&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Redis default is&lt;/strong&gt; &lt;code&gt;noeviction&lt;/code&gt; — it throws an error when memory is full rather than silently dropping data. Switch to &lt;code&gt;allkeys-lru&lt;/code&gt; for most production workloads:&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;# In redis.conf or via CONFIG SET&lt;/span&gt;
maxmemory 2gb
maxmemory-policy allkeys-lru

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For workloads with clear hot-key skew (e.g., celebrity social media posts), &lt;code&gt;allkeys-lfu&lt;/code&gt; tends to outperform LRU because frequency is a better predictor of future access than recency. &lt;a href="https://www.usenix.org/system/files/conference/nsdi18/nsdi18-beckmann.pdf" rel="noopener noreferrer"&gt;USENIX NSDI '18 research&lt;/a&gt; shows that hit rate increases logarithmically as a function of cache capacity — meaning the eviction policy becomes &lt;em&gt;more&lt;/em&gt; important than raw memory size as you scale.&lt;/p&gt;




&lt;h2&gt;
  
  
  Cache Invalidation: The Hard Part
&lt;/h2&gt;

&lt;p&gt;Phil Karlton was right. Cache invalidation is hard because &lt;strong&gt;the cache and the source of truth can diverge&lt;/strong&gt;, and the application must detect and resolve that divergence without serving incorrect data or generating excessive database load.&lt;/p&gt;

&lt;p&gt;The three practical strategies:&lt;/p&gt;

&lt;h3&gt;
  
  
  TTL-based expiry
&lt;/h3&gt;

&lt;p&gt;Let entries expire automatically after a configured duration. Simple, predictable, eventually consistent.&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="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setEx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;product:123:price&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// 5 min&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Risk:&lt;/strong&gt; Stale reads for up to the full TTL window. For pricing data, a 5-minute stale price may be acceptable. For account balances, it is not.&lt;/p&gt;

&lt;h3&gt;
  
  
  Event-driven invalidation
&lt;/h3&gt;

&lt;p&gt;Invalidate (delete) a cache entry the moment the underlying data changes, rather than waiting for TTL expiry.&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="c1"&gt;// In your update endpoint&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;updateProduct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;productId&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="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;UPDATE products SET price = $1 WHERE id = $2&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="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;productId&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

  &lt;span class="c1"&gt;// Immediately purge — next read will miss and repopulate&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;del&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`product:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;productId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;:price`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Or pattern-delete all keys related to this product&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;keys&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`product:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;productId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;del&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;keys&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;&lt;strong&gt;Risk:&lt;/strong&gt; Delete-before-repopulate creates a brief window where all in-flight requests hit the database simultaneously. For high-traffic keys, use cache-aside with a distributed lock, or write-through instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Versioned keys
&lt;/h3&gt;

&lt;p&gt;Append a version number or hash to the cache key. Updates increment the version, making the old key unreachable without requiring an explicit delete.&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="c1"&gt;// Store the current version&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;product:123:version&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;v5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Cache key includes version&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;product:123:version&lt;/span&gt;&lt;span class="dl"&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;cacheKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`product:123:price:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;version&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// On update: bump version (old key becomes unreachable)&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;incr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;product:123:version&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the safest approach for multi-region or distributed caches where explicit delete propagation is unreliable. Old entries age out via TTL naturally.&lt;/p&gt;




&lt;h2&gt;
  
  
  Redis vs. Memcached: Which One?
&lt;/h2&gt;

&lt;p&gt;This question comes up in every architecture discussion. The short answer for new projects: &lt;strong&gt;use Redis&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Redis&lt;/th&gt;
&lt;th&gt;Memcached&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Data types&lt;/td&gt;
&lt;td&gt;Strings, hashes, lists, sets, sorted sets, streams&lt;/td&gt;
&lt;td&gt;Strings only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Persistence&lt;/td&gt;
&lt;td&gt;RDB snapshots + AOF log&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Replication&lt;/td&gt;
&lt;td&gt;Built-in primary/replica&lt;/td&gt;
&lt;td&gt;External only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pub/Sub&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lua scripting&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max value size&lt;/td&gt;
&lt;td&gt;512 MB&lt;/td&gt;
&lt;td&gt;1 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multithreading&lt;/td&gt;
&lt;td&gt;Multi-threaded I/O (Redis 6+)&lt;/td&gt;
&lt;td&gt;Multi-threaded&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Nearly all production use cases&lt;/td&gt;
&lt;td&gt;Pure key/value, ultra-simple workloads&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Memcached's one genuine advantage is slightly lower memory overhead for pure string storage at extreme scale. Unless you are operating at hundreds of terabytes of cache data, this rarely matters. Redis's richer data types, persistence options, and Lua scripting make it the clear default.&lt;/p&gt;

&lt;p&gt;The benchmark comparison below is from real AWS infrastructure measurements — not synthetic lab tests:&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%2F4o4albedx8350dmi172w.webp" 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%2F4o4albedx8350dmi172w.webp" width="720" height="380"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What NOT to Cache
&lt;/h2&gt;

&lt;p&gt;Caching is not universally beneficial. These are situations where it actively causes harm:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Highly volatile data.&lt;/strong&gt; If a value changes more often than your TTL, you will serve stale data constantly while paying cache infrastructure overhead for essentially no hits. Financial ticker prices and live sports scores are common examples where a direct database or streaming feed is the right answer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unbounded key spaces.&lt;/strong&gt; If your cache key includes a user-supplied parameter with high cardinality (e.g., search query strings), you will generate millions of cache keys that each get accessed once. This consumes memory, produces near-zero hit rates, and degrades eviction efficiency. Apply caching only to keys with stable, bounded spaces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data that is cheaper to recompute than to cache.&lt;/strong&gt; Simple arithmetic or deterministic in-memory transformations have effectively zero cost. Routing them through a network call to Redis adds latency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data requiring real-time consistency.&lt;/strong&gt; If the application contract requires that every read reflects every write with zero lag — shopping cart totals, bank balances, inventory counts during flash sales — a cache introduces a consistency lag that your users will experience as bugs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Personally identifiable information you do not need to cache.&lt;/strong&gt; Every cached PII record is an additional attack surface. If the TTL benefits do not justify the exposure, leave it out of the cache.&lt;/p&gt;




&lt;h2&gt;
  
  
  Preventing the Cache Stampede
&lt;/h2&gt;

&lt;p&gt;When a hot key expires under heavy traffic, every concurrent request races to repopulate it. This is the stampede. Three proven defenses:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Probabilistic early expiry&lt;/strong&gt; — Each process individually decides whether to refresh before expiry, with probability increasing as expiry approaches. Simple to implement with no coordination overhead.&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;function&lt;/span&gt; &lt;span class="nf"&gt;shouldEarlyRefresh&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ttlRemaining&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;fullTtl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;beta&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="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Higher beta = more aggressive early refresh&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;ttlRemaining&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;fullTtl&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;beta&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;random&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;&lt;strong&gt;Distributed lock&lt;/strong&gt; — Only one process is permitted to repopulate the key at a time. All others wait or return a stale value.&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;const&lt;/span&gt; &lt;span class="nx"&gt;lock&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&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="s2"&gt;`lock:user:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1&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;NX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;EX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// only set if not exists, expire in 10s&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;lock&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// We won the lock — repopulate&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SELECT * FROM users WHERE id = $1&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="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setEx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`user:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;del&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`lock:user:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;user&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="c1"&gt;// Lost the lock — wait briefly and retry, or return a slightly stale value&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;getUserById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&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;&lt;strong&gt;Background refresh with stale-while-revalidate&lt;/strong&gt; — Serve the stale value immediately while a single background process refreshes asynchronously. This is the refresh-ahead pattern applied reactively.&lt;/p&gt;




&lt;h2&gt;
  
  
  Monitoring Cache Health
&lt;/h2&gt;

&lt;p&gt;A cache you cannot observe is a cache you cannot trust. Track these four metrics in production:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;What It Tells You&lt;/th&gt;
&lt;th&gt;Action Threshold&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hit rate&lt;/td&gt;
&lt;td&gt;Fraction of reads served from cache&lt;/td&gt;
&lt;td&gt;Investigate below 80%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Miss rate&lt;/td&gt;
&lt;td&gt;Fraction of reads falling through to DB&lt;/td&gt;
&lt;td&gt;Spikes indicate TTL or eviction issues&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Eviction rate&lt;/td&gt;
&lt;td&gt;Keys dropped due to memory pressure&lt;/td&gt;
&lt;td&gt;Any eviction = consider memory increase&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latency (p99)&lt;/td&gt;
&lt;td&gt;99th percentile cache round-trip&lt;/td&gt;
&lt;td&gt;Above 1 ms warrants investigation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Instrument your cache-aside reads&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&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;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&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;cacheKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`user:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;cached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&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;cacheKey&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;cached&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;metrics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache.hit&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;key_type&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="nx"&gt;metrics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;histogram&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache.latency_ms&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;start&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;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;metrics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache.miss&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;key_type&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SELECT * FROM users WHERE id = $1&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="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setEx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cacheKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&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;user&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;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Caching is one of the highest-leverage tools in backend engineering. The five core patterns map cleanly to distinct use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cache-Aside&lt;/strong&gt; — the safe, flexible default for read-heavy workloads&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Read-Through&lt;/strong&gt; — same as cache-aside but encapsulated inside the cache layer&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Write-Through&lt;/strong&gt; — strong consistency on writes, acceptable write latency&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Write-Behind&lt;/strong&gt; — maximum write throughput, requires durable queuing&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Refresh-Ahead&lt;/strong&gt; — eliminates miss latency for predictable hot keys&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Master cache invalidation — TTL, event-driven delete, and versioned keys — before worrying about exotic patterns. Most real-world caching problems come down to stale data or stampedes, and both have well-understood solutions.&lt;/p&gt;

&lt;p&gt;Start with Redis, instrument hit rate from day one, and set &lt;code&gt;allkeys-lru&lt;/code&gt; as your eviction policy. Everything else you can tune iteratively as traffic grows.&lt;/p&gt;




&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is a good cache hit rate?&lt;/strong&gt; In most production workloads, a hit rate above 80% is the practical target. At 80% hit rate, roughly 80% of your database reads are eliminated. Below 70%, TTL tuning and key design should be revisited. Note that hit rate increases logarithmically with cache capacity — so the eviction policy and key design matter more than raw memory at scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should I use Redis or a CDN for caching?&lt;/strong&gt; CDNs (Cloudflare, Fastly) cache at the network edge — ideal for static assets and API responses that are identical across users. Redis caches at the application layer — ideal for user-specific or frequently updated data. They are complementary, not alternatives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I invalidate cache entries across multiple services in a microservices architecture?&lt;/strong&gt; Use an event bus (Kafka, RabbitMQ, or Redis Pub/Sub). The service that owns the data publishes an invalidation event when it writes; all services that cache that data subscribe and delete their local entries. This is the event-driven invalidation pattern applied at scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can caching make my application slower?&lt;/strong&gt; Yes, in two scenarios: cache miss rate is so high that you are adding a network round-trip to every database call (net negative), or cache lookup latency exceeds the database query you were trying to skip (rare, but happens with misconfigured Redis in high-latency networks). Monitor before deploying caching and measure after.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a cold start / cold cache problem?&lt;/strong&gt; When your cache is empty — after a deployment, a restart, or provisioning a new node — all requests miss until entries are populated. For critical keys, pre-warm the cache at startup by reading from the database and populating keys before traffic is admitted.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://zyvop.com/caching-strategies-every-backend-developer-must-know-k6qkb" rel="noopener noreferrer"&gt;ZyVOP&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;💡 For more articles like this, &lt;a href="https://zyvop.com/newsletter" rel="noopener noreferrer"&gt;subscribe to the ZyVOP newsletter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>systemdesign</category>
      <category>caching</category>
      <category>redis</category>
      <category>backend</category>
    </item>
    <item>
      <title>Inside Claude's Brain: What Anthropic's Published System Prompts Reveal About the Future of AI Transparency</title>
      <dc:creator>Pradeep Kumar</dc:creator>
      <pubDate>Wed, 19 Aug 2026 05:34:23 +0000</pubDate>
      <link>https://dev.to/pradeep_kumar_bc4e7e9f7ec/inside-claudes-brain-what-anthropics-published-system-prompts-reveal-about-the-future-of-ai-2db0</link>
      <guid>https://dev.to/pradeep_kumar_bc4e7e9f7ec/inside-claudes-brain-what-anthropics-published-system-prompts-reveal-about-the-future-of-ai-2db0</guid>
      <description>&lt;h2&gt;
  
  
  The Page That Changed Everything
&lt;/h2&gt;

&lt;p&gt;In August 2024, a quiet page appeared on Anthropic's documentation site. No press release. No keynote. Just a URL — &lt;a href="https://platform.claude.com/docs/en/release-notes/system-prompts" rel="noopener noreferrer"&gt;platform.claude.com/docs/en/release-notes/system-prompts&lt;/a&gt; — and a simple promise: from now on, Anthropic would publish the system prompts that govern how Claude behaves on claude.ai and its mobile apps.&lt;/p&gt;

&lt;p&gt;The initial entries were dated &lt;strong&gt;July 12, 2024&lt;/strong&gt;, covering Claude 3 Haiku, Claude 3 Opus, and Claude 3.5 Sonnet.&lt;/p&gt;

&lt;p&gt;Two years later, that page has become one of the most discussed artifacts in the AI industry. It regularly trends on Hacker News with hundreds of upvotes. Researchers diff it like source code. Developers treat it as a masterclass in prompt engineering. And it stands as a singular act of voluntary transparency in an industry that treats system prompts like nuclear launch codes.&lt;/p&gt;

&lt;p&gt;This is the story of what's inside those prompts — and what they tell us about where AI is heading.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is a System Prompt, and Why Should You Care?
&lt;/h2&gt;

&lt;p&gt;Before we dive in, let's establish what we're actually talking about.&lt;/p&gt;

&lt;p&gt;Every time you open Claude (or ChatGPT, or Gemini), the AI doesn't start with a blank slate. Before you type a single word, a hidden set of instructions — the &lt;strong&gt;system prompt&lt;/strong&gt; — has already been loaded.&lt;/p&gt;

&lt;p&gt;Think of it as an operating manual handed to a new employee on their first day: it defines who they are, how they should behave, what they're allowed to do, and what's strictly off-limits.&lt;/p&gt;

&lt;p&gt;These prompts shape &lt;em&gt;everything&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Identity&lt;/strong&gt;: "You are Claude, created by Anthropic."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Temporal grounding&lt;/strong&gt;: The current date, so the model knows it's August 2026, not stuck in its training data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Knowledge boundaries&lt;/strong&gt;: What the model knows, and when to admit it doesn't.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Safety rails&lt;/strong&gt;: Hard lines around harmful content, illegal activities, and sensitive topics.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Personality&lt;/strong&gt;: Whether the AI sounds like a warm friend or a crisp professional.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tool usage&lt;/strong&gt;: When and how to use search, code execution, file editing, and other capabilities.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The system prompt is, in every meaningful sense, the AI's &lt;em&gt;constitution&lt;/em&gt;. And until Anthropic broke ranks, no major AI company had ever published theirs voluntarily.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Transparency Divide: Published vs. Leaked
&lt;/h2&gt;

&lt;p&gt;Here's where it gets interesting. Let's look at how the three major AI labs handle this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Anthropic (Claude)&lt;/th&gt;
&lt;th&gt;OpenAI (ChatGPT)&lt;/th&gt;
&lt;th&gt;Google (Gemini)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Strategy&lt;/td&gt;
&lt;td&gt;Voluntary publication&lt;/td&gt;
&lt;td&gt;Secrecy&lt;/td&gt;
&lt;td&gt;Secrecy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How prompts surface&lt;/td&gt;
&lt;td&gt;Official documentation&lt;/td&gt;
&lt;td&gt;Community leaks &amp;amp; prompt injection&lt;/td&gt;
&lt;td&gt;Community leaks &amp;amp; prompt injection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Update tracking&lt;/td&gt;
&lt;td&gt;Versioned release notes&lt;/td&gt;
&lt;td&gt;Reverse-engineered by researchers&lt;/td&gt;
&lt;td&gt;Reverse-engineered by researchers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Developer guidance&lt;/td&gt;
&lt;td&gt;High — prompt is the documentation&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;td&gt;High for developer tools, low for consumer&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;OpenAI and Google treat their system prompts as proprietary trade secrets. The only way the public sees them is through adversarial prompt injection — tricking the AI into repeating its hidden instructions.&lt;/p&gt;

&lt;p&gt;Alternatively, they surface through massive community-maintained GitHub repositories that have accumulated tens of thousands of stars.&lt;/p&gt;

&lt;p&gt;Anthropic simply... publishes them. On a public webpage. With a changelog.&lt;/p&gt;

&lt;p&gt;As Simon Willison, the prolific developer and AI commentator, put it: these published prompts are &lt;em&gt;"the secret missing manual"&lt;/em&gt; for the model. They reveal not just what Claude does, but &lt;em&gt;why&lt;/em&gt; it does it — which is information that developers working with ChatGPT or Gemini can only guess at.&lt;/p&gt;




&lt;h2&gt;
  
  
  Anatomy of a System Prompt: What's Actually in There
&lt;/h2&gt;

&lt;p&gt;So what does Claude's operating manual actually say?&lt;/p&gt;

&lt;p&gt;Based on Anthropic's published prompts (and community analysis of the more recent versions), the system prompt has grown from a relatively concise document into a comprehensive technical specification — often exceeding &lt;strong&gt;100,000 characters&lt;/strong&gt; in recent versions. It's organized into dozens of sections, typically 70 or more.&lt;/p&gt;

&lt;p&gt;Here's a breakdown of the major categories:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Identity &amp;amp; Grounding
&lt;/h3&gt;

&lt;p&gt;The prompt opens by establishing who Claude is and when "now" is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;The&lt;/span&gt; &lt;span class="n"&gt;assistant&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;Claude&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;made&lt;/span&gt; &lt;span class="k"&gt;by&lt;/span&gt; &lt;span class="n"&gt;Anthropic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="n"&gt;The&lt;/span&gt; &lt;span class="n"&gt;current&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;dynamically&lt;/span&gt; &lt;span class="n"&gt;injected&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This isn't just a formality. The date injection is critical for &lt;strong&gt;temporal grounding&lt;/strong&gt; — it lets Claude distinguish between events in its training data and events that happened after its knowledge cutoff.&lt;/p&gt;

&lt;p&gt;Without it, the model would confidently discuss the 2024 election as a future event.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Knowledge Boundaries
&lt;/h3&gt;

&lt;p&gt;The prompt explicitly instructs Claude on how to handle the gap between what it knows and what's happened since:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use internal knowledge for events within the training window.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use search tools for anything recent or uncertain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Never fabricate information to fill gaps — acknowledge limitations instead.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the "honest" in Anthropic's &lt;em&gt;helpful, harmless, and honest&lt;/em&gt; framework. Rather than hallucinating a plausible-sounding answer, Claude is instructed to say "I'm not sure" — and, where possible, search for the answer.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Safety &amp;amp; Ethics (The Hard Boundaries)
&lt;/h3&gt;

&lt;p&gt;This is the longest and most nuanced section. It covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Absolute refusals&lt;/strong&gt;: Weapons instructions, malware generation, CSAM, and other categories with zero exceptions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Contextual judgment&lt;/strong&gt;: For ambiguous requests, Claude is instructed to &lt;em&gt;assume positive, legal intent&lt;/em&gt; rather than reflexively refusing. This is a deliberate design choice to avoid the "sorry, I can't help with that" problem that plagued earlier AI models.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Child safety protocols&lt;/strong&gt;: If a conversation is flagged, the model applies "extreme caution" to all subsequent requests in that thread.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mental health&lt;/strong&gt;: Specific protocols for users expressing suicidal ideation or self-harm, including when to provide crisis resources.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Evenhandedness&lt;/strong&gt;: On politically controversial topics, Claude is instructed to present multiple perspectives without taking sides.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Formatting &amp;amp; Communication Style
&lt;/h3&gt;

&lt;p&gt;This is where the prompt gets surprisingly opinionated:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;No filler phrases&lt;/strong&gt;: Claude is explicitly told to avoid starting responses with "Certainly!", "Of course!", "Absolutely!" or similar sycophantic openers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Markdown by default&lt;/strong&gt;: Code should be formatted with syntax highlighting; complex answers should use headers and lists.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Conciseness&lt;/strong&gt;: Lead with the direct answer, then elaborate. Don't bury the lede.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Match the user's register&lt;/strong&gt;: If someone writes casually, respond casually. If they write formally, match their tone.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Tool Definitions &amp;amp; Capabilities
&lt;/h3&gt;

&lt;p&gt;In the consumer-facing claude.ai product, the system prompt contains detailed schemas for every tool Claude can use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Web search&lt;/strong&gt;: When to search, how to cite sources, how to handle copyright.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code execution&lt;/strong&gt;: Sandboxed environments for running Python, generating visualizations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;File handling&lt;/strong&gt;: Reading uploaded documents, processing images.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Specialized agents&lt;/strong&gt;: Browsing assistants, spreadsheet processors, presentation builders.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Community researchers note that tool definitions often consume the &lt;em&gt;majority&lt;/em&gt; of the system prompt's token budget — sometimes more than all the personality, safety, and formatting instructions combined.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. The "Meta" Instructions
&lt;/h3&gt;

&lt;p&gt;Perhaps the most fascinating section: instructions about the instructions themselves.&lt;/p&gt;

&lt;p&gt;Claude is told how to handle attempts to extract or manipulate its system prompt. It's instructed to be transparent about having a system prompt (it won't deny it exists), but not to reproduce it verbatim.&lt;/p&gt;

&lt;p&gt;It's also told to prioritize its core safety instructions even if a user's prompt contradicts them — establishing a clear hierarchy of authority.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Evolution: How the Prompts Have Changed Over Time
&lt;/h2&gt;

&lt;p&gt;One of the most valuable aspects of Anthropic's transparency is that it creates a &lt;strong&gt;public changelog&lt;/strong&gt; for AI behavior. Researchers like Simon Willison have exploited this brilliantly, using tools like &lt;code&gt;git diff&lt;/code&gt; to track exactly how Claude's personality and capabilities shift between versions.&lt;/p&gt;

&lt;p&gt;Here are some of the most notable evolutionary trends:&lt;/p&gt;

&lt;h3&gt;
  
  
  From Warm to Direct (2024 → 2025)
&lt;/h3&gt;

&lt;p&gt;Early Claude prompts emphasized warmth and empathy. The model was positioned as a &lt;em&gt;friendly brainstorming partner&lt;/em&gt;. By mid-2025, the tone had shifted: Claude became more of a &lt;em&gt;direct, opinionated expert&lt;/em&gt; — someone who gives you the answer rather than asking how you feel about it.&lt;/p&gt;

&lt;p&gt;This wasn't accidental. User feedback consistently showed that people preferred Claude when it was confident and direct, not when it hedged everything with qualifiers.&lt;/p&gt;

&lt;h3&gt;
  
  
  From Verbose to Lean (2025 → 2026)
&lt;/h3&gt;

&lt;p&gt;A surprising trend: Anthropic has been &lt;em&gt;reducing&lt;/em&gt; the length of its safety instructions in recent prompts. Not because they care less about safety, but because frontier models have internalized these behaviors through training.&lt;/p&gt;

&lt;p&gt;As Anthropic's own research has noted, the shift is from "prompt engineering" to &lt;strong&gt;"context engineering"&lt;/strong&gt; — recognizing that a model with deep constitutional training needs fewer explicit rules in its prompt and more contextual framing.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Tool Explosion (2024 → 2026)
&lt;/h3&gt;

&lt;p&gt;The most dramatic growth has been in tool definitions. The original prompts had minimal tool integration. By 2026, tool schemas for search, code execution, computer use, and specialized agents dominate the prompt. Claude has evolved from a text-in/text-out chatbot into an &lt;strong&gt;agentic system&lt;/strong&gt; that can browse the web, write and execute code, and interact with external services.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fable/Mythos Architecture (June 2026)
&lt;/h3&gt;

&lt;p&gt;The release of &lt;strong&gt;Claude Fable 5&lt;/strong&gt; and &lt;strong&gt;Claude Mythos 5&lt;/strong&gt; on June 9, 2026, introduced a new dimension to system prompt design: &lt;strong&gt;tiered safety classifiers&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Fable 5 and Mythos 5 are the same underlying model — the most capable Anthropic has ever released — but with different safety postures. Fable 5 includes safety classifiers that monitor for sensitive domains (cybersecurity, biology, chemistry); if triggered, it falls back to Claude Opus 4.8 for that response.&lt;/p&gt;

&lt;p&gt;Mythos 5 lifts those classifiers and is restricted to vetted partners through Anthropic's &lt;strong&gt;Project Glasswing&lt;/strong&gt; initiative.&lt;/p&gt;

&lt;p&gt;This architecture means the system prompt alone no longer tells the full story — the prompt now works in concert with external classifier layers that can override the model's output entirely.&lt;/p&gt;

&lt;p&gt;Just days after launch, both models were &lt;strong&gt;temporarily suspended globally&lt;/strong&gt; (June 12–July 1, 2026) due to a U.S. government export control directive.&lt;/p&gt;

&lt;p&gt;The incident was a stress test for Anthropic's transparency commitment: they documented the suspension and restoration publicly, rather than quietly limiting access. For a company that publishes its system prompts, this consistency mattered.&lt;/p&gt;

&lt;p&gt;The subsequent release of &lt;strong&gt;Claude Opus 5&lt;/strong&gt; on July 24, 2026 — designed to approach Fable 5's intelligence at a lower price point — further expanded the system prompt landscape across an increasingly diverse model lineup.&lt;/p&gt;

&lt;h3&gt;
  
  
  Child Safety Escalation
&lt;/h3&gt;

&lt;p&gt;Each prompt revision has strengthened child safety protocols. Recent versions implement a "ratcheting" mechanism: once a conversation triggers a safety flag, the model's caution level increases for &lt;em&gt;all subsequent messages in that thread&lt;/em&gt;, not just the flagged one.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Matters: Five Lessons From the System Prompts
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. The AI's "Personality" Is Engineered, Not Emergent
&lt;/h3&gt;

&lt;p&gt;When Claude gives you a thoughtful, nuanced answer, it's not because it spontaneously developed good judgment. It's because someone at Anthropic wrote instructions telling it to "present multiple perspectives on controversial topics" and "lead with the direct answer."&lt;/p&gt;

&lt;p&gt;The system prompt reveals that what feels like intelligence is, in part, careful UX design. This isn't a criticism — it's a feature. But it means we should evaluate AI responses knowing that they're shaped by editorial decisions, not just raw capability.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Safety Is Not a Binary Switch
&lt;/h3&gt;

&lt;p&gt;The prompts reveal a sophisticated, context-dependent approach to safety. Claude doesn't have a simple "allowed/not allowed" list. It has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Absolute prohibitions&lt;/strong&gt; (weapons, CSAM) — no context overrides these.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Contextual judgment&lt;/strong&gt; — assume positive intent for ambiguous requests.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Escalation protocols&lt;/strong&gt; — increase caution within flagged conversations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Domain-specific rules&lt;/strong&gt; — different handling for medical questions vs. legal questions vs. creative writing.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This multi-layered approach is far more nuanced than most people realize, and it's a template that other AI companies will likely adopt.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The Prompt Is a Product Specification
&lt;/h3&gt;

&lt;p&gt;Reading Claude's system prompt is like reading the product requirements document for a software application. It defines features, edge cases, error handling, and user experience guidelines. This reframes how we should think about AI development: the system prompt isn't an afterthought bolted onto the model — it's a core part of the product design.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Transparency Creates Accountability
&lt;/h3&gt;

&lt;p&gt;Once you publish your AI's instructions, you can be held to them. If Claude's system prompt says "present balanced perspectives on political topics," users can call out violations. If it says "don't start responses with 'Certainly!'" and then it does, that's a measurable bug.&lt;/p&gt;

&lt;p&gt;This is a radical departure from the black-box model, where AI companies can change behavior without anyone noticing. Anthropic has, in effect, given users a contract they can audit.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. The Industry Will Follow
&lt;/h3&gt;

&lt;p&gt;The EU AI Act and other global regulations are pushing toward mandatory transparency for high-risk AI systems. Open-source models like Llama and Mistral already publish their entire architectures. As public demand for AI accountability grows, the "publish your system prompt" approach will likely become the industry norm by 2027–2028.&lt;/p&gt;

&lt;p&gt;Anthropic got there first, and that matters.&lt;/p&gt;




&lt;h2&gt;
  
  
  What the Prompts Don't Tell You
&lt;/h2&gt;

&lt;p&gt;Transparency has limits, and it's worth acknowledging what Anthropic's published prompts leave out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tool definitions are omitted&lt;/strong&gt;: The published prompts strip out the detailed JSON schemas for tools like search and code execution. These are arguably the most technically interesting parts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;API prompts are not included&lt;/strong&gt;: The published prompts apply only to claude.ai and the mobile apps. If you use the Anthropic API, you're responsible for your own system prompt — and the API does not inject these instructions automatically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Claude Code has different prompts&lt;/strong&gt;: The CLI-based coding tool has its own, separately maintained (and not officially published) system prompt that's dynamically assembled from hundreds of conditional strings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Safety classifiers are separate&lt;/strong&gt;: With the Fable 5/Mythos 5 architecture, external safety classifiers can override model output independently of the system prompt. These classifier rules and thresholds are not published.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Training alignment isn't visible&lt;/strong&gt;: The system prompt is only one layer of Claude's behavior. The deeper layer — reinforcement learning from human feedback (RLHF) and constitutional AI training — is not captured in the prompt and isn't publicly visible.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These omissions are worth noting, but they don't diminish the significance of what &lt;em&gt;is&lt;/em&gt; published. The system prompt is the most legible, most auditable layer of AI behavior, and making it public is a meaningful act of trust.&lt;/p&gt;




&lt;h2&gt;
  
  
  For Developers: What You Can Learn From These Prompts
&lt;/h2&gt;

&lt;p&gt;If you're building with the Claude API (or any LLM), Anthropic's published prompts are a goldmine of prompt engineering patterns:&lt;/p&gt;

&lt;h3&gt;
  
  
  Structure with XML Tags
&lt;/h3&gt;

&lt;p&gt;Anthropic uses XML-style tags to organize different sections of the prompt (&lt;code&gt;&amp;lt;safety_guidelines&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;formatting_rules&amp;gt;&lt;/code&gt;, etc.). This helps the model parse complex instructions without confusion.&lt;/p&gt;

&lt;h3&gt;
  
  
  Be Specific About What NOT to Do
&lt;/h3&gt;

&lt;p&gt;The prompts don't just say "be helpful." They explicitly list anti-patterns: don't start with filler phrases, don't hedge when you're confident, don't refuse ambiguous requests without considering positive intent.&lt;/p&gt;

&lt;h3&gt;
  
  
  Set a Clear Instruction Hierarchy
&lt;/h3&gt;

&lt;p&gt;The prompts establish explicit priority: core safety &amp;gt; system prompt &amp;gt; user instructions. This prevents prompt injection attacks from overriding safety-critical behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inject Dynamic Context
&lt;/h3&gt;

&lt;p&gt;Rather than relying on the model's training data for temporal awareness, the prompt injects the current date at runtime. This pattern — dynamic context injection — is essential for any production AI application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Design for Edge Cases
&lt;/h3&gt;

&lt;p&gt;The prompts devote significant space to edge cases: what happens when a user is suicidal, when a conversation gets flagged, when a request is ambiguous. Production AI systems fail on edge cases, and Anthropic's prompts show how to handle them systematically.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Bigger Picture: AI's Open-Source Constitution
&lt;/h2&gt;

&lt;p&gt;There's something poetically fitting about an AI company publishing the rules that govern its AI. It's the software equivalent of a government publishing its constitution — an acknowledgment that the rules should be visible to the governed.&lt;/p&gt;

&lt;p&gt;Anthropic calls its approach &lt;strong&gt;Constitutional AI&lt;/strong&gt;, and the system prompt is where that constitution becomes operational.&lt;/p&gt;

&lt;p&gt;It's where abstract values like "helpful, harmless, and honest" get translated into concrete instructions: &lt;em&gt;this is what honest looks like when someone asks about a controversial politician; this is what harmless looks like when someone mentions self-harm; this is what helpful looks like when someone needs code reviewed.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As AI systems become more powerful and more autonomous — writing code, browsing the web, managing workflows — the question of "what rules is this thing following?" becomes not just academic but urgent.&lt;/p&gt;

&lt;p&gt;Anthropic's system prompts page is one answer to that question. It's imperfect, it's incomplete, but it exists.&lt;/p&gt;

&lt;p&gt;And in an industry where the default is to hide everything, existence is a radical act.&lt;/p&gt;




&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;What&lt;/strong&gt;: Anthropic publishes the system prompts for Claude on &lt;a href="https://platform.claude.com/docs/en/release-notes/system-prompts" rel="noopener noreferrer"&gt;platform.claude.com/docs/en/release-notes/system-prompts&lt;/a&gt; — the only major AI lab to do so voluntarily.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why it matters&lt;/strong&gt;: These prompts are Claude's operating manual — they define identity, safety rules, formatting preferences, tool usage, and personality.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;What's inside&lt;/strong&gt;: 70+ sections covering everything from "don't say Certainly!" to child safety escalation protocols and multi-layered tool definitions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;How they've evolved&lt;/strong&gt;: From warm-and-fuzzy to direct-and-expert, from minimal tools to a full agentic toolkit, from verbose safety rules to lean, training-aligned instructions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The industry impact&lt;/strong&gt;: OpenAI and Google keep their prompts secret; Anthropic's transparency sets a standard that regulation and competition will eventually force others to meet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;For developers&lt;/strong&gt;: The prompts are a masterclass in prompt engineering — study them for patterns in structure, safety, dynamic context injection, and edge case handling.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;The system prompts page is available at&lt;/em&gt; &lt;a href="https://platform.claude.com/docs/en/release-notes/system-prompts" rel="noopener noreferrer"&gt;&lt;em&gt;platform.claude.com/docs/en/release-notes/system-prompts&lt;/em&gt;&lt;/a&gt;&lt;em&gt;. For ongoing analysis, follow Simon Willison's blog at&lt;/em&gt; &lt;a href="https://simonwillison.net" rel="noopener noreferrer"&gt;&lt;em&gt;simonwillison.net&lt;/em&gt;&lt;/a&gt;&lt;em&gt;, where he tracks prompt changes with git-style diffs.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://zyvop.com/inside-claude-s-brain-what-anthropic-s-published-system-prompts-reveal-about-the-future-of-ai-transparency-yjkk5" rel="noopener noreferrer"&gt;ZyVOP&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;💡 For more articles like this, &lt;a href="https://zyvop.com/newsletter" rel="noopener noreferrer"&gt;subscribe to the ZyVOP newsletter&lt;/a&gt;!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Hide Your Backend VPS IP Behind Vercel Using Next.js Rewrites</title>
      <dc:creator>Pradeep Kumar</dc:creator>
      <pubDate>Tue, 18 Aug 2026 06:32:01 +0000</pubDate>
      <link>https://dev.to/pradeep_kumar_bc4e7e9f7ec/how-to-hide-your-backend-vps-ip-behind-vercel-using-nextjs-rewrites-1a5</link>
      <guid>https://dev.to/pradeep_kumar_bc4e7e9f7ec/how-to-hide-your-backend-vps-ip-behind-vercel-using-nextjs-rewrites-1a5</guid>
      <description>&lt;p&gt;If you host your frontend on Vercel and your backend on a custom VPS, your frontend usually makes API requests directly to the VPS's public IP address or domain. While this works, it exposes your backend server's true IP address to the world, making it vulnerable to direct DDoS attacks, port scanners, and malicious bots.&lt;/p&gt;

&lt;p&gt;By using &lt;strong&gt;Vercel Rewrites&lt;/strong&gt;, you can use Vercel's edge network as a shield. To the outside world, your API requests appear to be going to Vercel, while Vercel secretly fetches the data from your VPS behind the scenes.&lt;/p&gt;

&lt;p&gt;Here is how you can set up a secure API proxy in Next.js (App Router) and lock down your backend to reject any request that tries to bypass Vercel.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Architecture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequenceDiagram
    actor User
    participant Vercel as Vercel (Next.js)
    participant VPS as VPS (NestJS Backend)

    User-&amp;gt;&amp;gt;Vercel: Fetch /api-proxy/data
    Note over Vercel: Middleware injects secret header&amp;lt;br/&amp;gt;next.config.ts rewrites path
    Vercel-&amp;gt;&amp;gt;VPS: Fetch /data (with Secret Header)

    alt Valid Secret
        VPS--&amp;gt;&amp;gt;Vercel: 200 OK (Data)
        Vercel--&amp;gt;&amp;gt;User: 200 OK (Data)
    else Missing/Invalid Secret
        VPS--&amp;gt;&amp;gt;Vercel: 403 Forbidden
    end

    User-xVPS: Direct Request (Blocked 403)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 1: Configure Next.js Rewrites
&lt;/h2&gt;

&lt;p&gt;First, we need to tell Next.js to intercept requests made to a specific proxy path (e.g., &lt;code&gt;/api-proxy/*&lt;/code&gt;) and forward them to your VPS. We achieve this by adding a rewrite rule to &lt;code&gt;next.config.ts&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To ensure we don't accidentally create proxy loops, we will use a specific environment variable &lt;code&gt;BACKEND_URL&lt;/code&gt; solely for the rewrite destination.&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="c1"&gt;// next.config.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;rewrites&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// The true IP of your VPS, safely hidden in Vercel environment variables&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;apiUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;BACKEND_URL&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://localhost:4000&lt;/span&gt;&lt;span class="dl"&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="na"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api-proxy/:path*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
        &lt;span class="na"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;apiUrl&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/:path*`&lt;/span&gt; 
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Inject a Secret Header at the Edge
&lt;/h2&gt;

&lt;p&gt;Now that the request is proxying through Vercel, we need a way for our backend to know that the request &lt;em&gt;actually&lt;/em&gt; came from Vercel. We do this by injecting a secret header.&lt;/p&gt;

&lt;p&gt;In Next.js, we can use Edge Middleware to intercept the request and inject the header before the &lt;code&gt;next.config.ts&lt;/code&gt; rewrite takes effect.&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="c1"&gt;// middleware.ts (or proxy.ts if you use a custom setup)&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;NextRequest&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;next/server&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;middleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;NextRequest&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;requestHeaders&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;Headers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&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;proxySecret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;VERCEL_PROXY_SECRET&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// Inject the secret key into the headers&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;proxySecret&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;requestHeaders&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;x-vercel-proxy-secret&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;proxySecret&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Pass the modified headers along to the Next.js rewrite engine&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;requestHeaders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;matcher&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api-proxy/:path*&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Lock Down the Backend
&lt;/h2&gt;

&lt;p&gt;If an attacker guesses your VPS IP, they could still bypass Vercel entirely. We need to configure the backend to reject any request that lacks the secret header.&lt;/p&gt;

&lt;p&gt;Here is an example of how to enforce this using a global hook in a &lt;strong&gt;NestJS + Fastify&lt;/strong&gt; backend:&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="c1"&gt;// backend/src/main.ts&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fastifyInstance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getHttpAdapter&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;getInstance&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;fastifyInstance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addHook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;onRequest&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="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reply&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;proxySecret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;VERCEL_PROXY_SECRET&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// Exclude localhost (127.0.0.1) so internal Docker health checks still work!&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isLocal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ip&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;127.0.0.1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ip&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;::1&lt;/span&gt;&lt;span class="dl"&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;proxySecret&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isLocal&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;incomingSecret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;x-vercel-proxy-secret&lt;/span&gt;&lt;span class="dl"&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;incomingSecret&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nx"&gt;proxySecret&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;reply&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;403&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Forbidden: Invalid proxy secret&lt;/span&gt;&lt;span class="dl"&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="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;done&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;blockquote&gt;
&lt;p&gt;[!TIP] &lt;strong&gt;Docker Health Checks:&lt;/strong&gt; Notice the &lt;code&gt;isLocal&lt;/code&gt; check. If you use Docker, your container's internal health check pinging &lt;code&gt;localhost&lt;/code&gt; won't have the secret header. Bypassing the check for local IPs prevents your deployments from rolling back due to failed health checks!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 4: Fixing Server-Side Rendering (SSR/SSG)
&lt;/h2&gt;

&lt;p&gt;There's one hidden "gotcha" with this setup. During the Next.js build process (&lt;code&gt;next build&lt;/code&gt;), Next.js generates static pages and makes fetch requests directly to your backend API.&lt;/p&gt;

&lt;p&gt;Because these requests originate from the build server and bypass your Next.js middleware, they &lt;strong&gt;will fail with a 403 Forbidden error&lt;/strong&gt; because they lack the &lt;code&gt;x-vercel-proxy-secret&lt;/code&gt; header.&lt;/p&gt;

&lt;p&gt;To fix this, you must manually inject the secret into your internal API client or Apollo Client configuration:&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="c1"&gt;// lib/apollo-server.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ApolloClient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;InMemoryCache&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;HttpLink&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;@apollo/client&lt;/span&gt;&lt;span class="dl"&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;API_URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;NEXT_PUBLIC_API_URL&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://localhost:4000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;apolloServerClient&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;ApolloClient&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;ssrMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;link&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;HttpLink&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; 
    &lt;span class="na"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;API_URL&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/graphql`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;VERCEL_PROXY_SECRET&lt;/span&gt; 
      &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;x-vercel-proxy-secret&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;VERCEL_PROXY_SECRET&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; 
      &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
  &lt;span class="p"&gt;}),&lt;/span&gt;
  &lt;span class="na"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;InMemoryCache&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;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;By combining Next.js rewrites, Edge middleware, and a simple backend validation check, you can successfully shield your custom VPS behind Vercel's robust infrastructure. Your true IP address remains a secret, and your API is locked down against direct unauthorized access!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://zyvop.com/how-to-hide-your-backend-vps-ip-behind-vercel-using-next-js-rewrites-iwb51" rel="noopener noreferrer"&gt;ZyVOP&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;💡 For more articles like this, &lt;a href="https://zyvop.com/newsletter" rel="noopener noreferrer"&gt;subscribe to the ZyVOP newsletter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>nestjs</category>
      <category>backend</category>
      <category>security</category>
    </item>
    <item>
      <title>Google Launches Gemini 3.7 Flash Three Weeks After 3.6 With 50% Introductory Pricing</title>
      <dc:creator>Pradeep Kumar</dc:creator>
      <pubDate>Mon, 17 Aug 2026 10:53:24 +0000</pubDate>
      <link>https://dev.to/pradeep_kumar_bc4e7e9f7ec/google-launches-gemini-37-flash-three-weeks-after-36-with-50-introductory-pricing-20b3</link>
      <guid>https://dev.to/pradeep_kumar_bc4e7e9f7ec/google-launches-gemini-37-flash-three-weeks-after-36-with-50-introductory-pricing-20b3</guid>
      <description>&lt;p&gt;Google DeepMind released &lt;strong&gt;Gemini 3.7 Flash on August 13, 2026&lt;/strong&gt;, just three weeks after Gemini 3.6 Flash. This is not a new model family or a full generational reset. Google describes it as the next iteration in the Gemini 3 line, based on Gemini 3.6 Flash with algorithmic improvements to its reasoning foundation.&lt;/p&gt;

&lt;p&gt;That distinction matters. The interesting question is not whether Gemini 3.7 Flash is simply “smarter.” It is whether Google has made a fast, relatively inexpensive model good enough to handle more real production work—especially coding, tool use, web development, and business workflows—without requiring the cost of a larger frontier model.&lt;/p&gt;

&lt;p&gt;Google is clearly positioning it that way. Its announcement calls 3.7 Flash its “most intelligent workhorse model yet” for coding and agents, while the model card emphasizes agentic workflows, coding tasks, and enterprise workflows as intended uses. &lt;a href="https://blog.google/innovation-and-ai/models-and-research/gemini-models/introducing-gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google&lt;/a&gt; &lt;a href="https://deepmind.google/models/model-cards/gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google DeepMind model card&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Changed in Gemini 3.7 Flash?
&lt;/h2&gt;

&lt;p&gt;Gemini 3.7 Flash is built on Gemini 3.6 Flash rather than being trained as a completely separate architecture. Google says the model introduces algorithmic improvements to its core reasoning foundation and supports customizable thinking configurations that let developers trade off quality, cost, and latency.&lt;/p&gt;

&lt;p&gt;The basic model envelope remains substantial: up to a &lt;strong&gt;1-million-token context window&lt;/strong&gt;, &lt;strong&gt;64K-token output&lt;/strong&gt;, and multimodal input across &lt;strong&gt;text, images, audio, and video&lt;/strong&gt;. The knowledge cutoff is &lt;strong&gt;March 2026&lt;/strong&gt;. &lt;a href="https://deepmind.google/models/model-cards/gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google DeepMind model card&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Gemini 3.7 Flash&lt;/th&gt;
&lt;th&gt;Gemini 3.6 Flash&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Context window&lt;/td&gt;
&lt;td&gt;1M tokens&lt;/td&gt;
&lt;td&gt;1M tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Maximum output&lt;/td&gt;
&lt;td&gt;64K tokens&lt;/td&gt;
&lt;td&gt;64K tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Input modalities&lt;/td&gt;
&lt;td&gt;Text, image, audio, video&lt;/td&gt;
&lt;td&gt;Text, image, audio, video&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Thinking&lt;/td&gt;
&lt;td&gt;Configurable&lt;/td&gt;
&lt;td&gt;Configurable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Knowledge cutoff&lt;/td&gt;
&lt;td&gt;March 2026&lt;/td&gt;
&lt;td&gt;January 2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Model dependency&lt;/td&gt;
&lt;td&gt;Based on 3.6 Flash&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;API model name&lt;/td&gt;
&lt;td&gt;gemini-3.7-flash&lt;/td&gt;
&lt;td&gt;gemini-3.6-flash&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The important change is not a larger context window or a radically different interface. It is getting &lt;strong&gt;more useful work out of the Flash model class&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Choosing the Thinking Level
&lt;/h3&gt;

&lt;p&gt;Configurable thinking gives developers control over the quality/cost/latency trade-off, which matters when one request can trigger multiple model calls and tool interactions. Think of it as an engineering choice rather than a simple “higher is better” switch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flowchart LR
    A([Incoming Request]) --&amp;gt; B{Primary priority?}
    B --&amp;gt;|Lower latency / cost| C[Use lighter thinking\nFast responses\nSimple classification\nRoutine tasks]
    B --&amp;gt;|Balanced| D[Use moderate thinking\nCoding\nAgent workflows\nGeneral tasks]
    B --&amp;gt;|Hard reasoning| E[Use deeper thinking\nComplex debugging\nMulti-step planning\nDifficult analysis]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exact settings available depend on the API and model configuration, so developers should treat thinking as a tunable resource rather than a universal preset.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Biggest Gains Are in Software Engineering
&lt;/h2&gt;

&lt;p&gt;Coding is where Gemini 3.7 Flash makes its clearest case.&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;FrontierCode 1.1 Main&lt;/strong&gt;, Google's published result is &lt;strong&gt;43.6%&lt;/strong&gt;, up from &lt;strong&gt;34.4%&lt;/strong&gt; for Gemini 3.6 Flash. On &lt;strong&gt;DeepSWE v1.1&lt;/strong&gt;, which measures long-horizon software engineering, 3.7 Flash reaches &lt;strong&gt;65.3%&lt;/strong&gt;, compared with &lt;strong&gt;48.6%&lt;/strong&gt; for 3.6 Flash.&lt;/p&gt;

&lt;p&gt;The competitive picture is more nuanced. Gemini 3.7 Flash is ahead of Claude Sonnet 5 on FrontierCode, but &lt;strong&gt;GPT-5.6 Terra remains ahead on DeepSWE at 69.6%&lt;/strong&gt;. That matters because long-horizon software engineering is closer to the kind of multi-file, multi-step work developers increasingly expect from coding agents. &lt;a href="https://deepmind.google/models/model-cards/gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google DeepMind model card&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Terminal evaluations tell a similar story. Gemini 3.7 Flash scores &lt;strong&gt;85.8% on Terminal-bench 2.1&lt;/strong&gt;, up from 78.0% for 3.6 Flash. On the harder &lt;strong&gt;Terminal-bench 3.0&lt;/strong&gt;, it reaches 14.9%, versus 5.4% for 3.6 Flash. GPT-5.6 Terra still leads Terminal-bench 3.0 at 20.8%.&lt;/p&gt;

&lt;p&gt;The takeaway is more useful than any single score: the model is getting better at &lt;strong&gt;doing engineering work through tools&lt;/strong&gt;, not just answering isolated coding questions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xychart-beta
    title "Gemini 3.7 Flash: Improvement Over 3.6 Flash"
    x-axis ["FrontierCode", "DeepSWE", "AutomationBench", "GDP.pdf", "LABBench2", "HLE"]
    y-axis "Improvement (percentage points)" 0 --&amp;gt; 20
    bar [9.2, 16.7, 13.4, 12.0, 6.0, 2.4]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Web Development and UI Generation
&lt;/h2&gt;

&lt;p&gt;Web development is another notable focus.&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;Code Arena's WebDev Arena&lt;/strong&gt;, Gemini 3.7 Flash scores &lt;strong&gt;1,588 Elo&lt;/strong&gt;, compared with &lt;strong&gt;1,538&lt;/strong&gt; for Gemini 3.6 Flash. It also ranks above Claude Sonnet 5 at 1,541 and GPT-5.6 Terra at 1,523 in Google's published comparison.&lt;/p&gt;

&lt;p&gt;Google says the model can produce more functional layouts and feature-complete applications in fewer prompts. It also highlights stronger adherence to reference designs, screenshots, and design systems.&lt;/p&gt;

&lt;p&gt;That matters for frontend developers because the useful benchmark is not “can the model write React?” Modern coding assistants already can. The harder problem is whether the model can translate a visual or product specification into a working interface without requiring a long sequence of corrective prompts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Documents, Legal Work, and Business Automation
&lt;/h2&gt;

&lt;p&gt;Gemini 3.7 Flash also makes a strong showing outside traditional coding benchmarks.&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;GDP.pdf&lt;/strong&gt;, a document-comprehension benchmark, it scores &lt;strong&gt;34.0%&lt;/strong&gt;, up from 22.0% for Gemini 3.6 Flash. On &lt;strong&gt;Harvey LAB-AA&lt;/strong&gt;, which evaluates complex legal workflows, it reaches &lt;strong&gt;90.7%&lt;/strong&gt;, narrowly ahead of Claude Sonnet 5 at 90.1%.&lt;/p&gt;

&lt;p&gt;The most striking number may be &lt;strong&gt;AutomationBench&lt;/strong&gt;. Gemini 3.7 Flash reaches &lt;strong&gt;30.4%&lt;/strong&gt;, compared with 17.0% for 3.6 Flash. Google's model card notes that AutomationBench is a private set, so the result should be interpreted primarily as a directional comparison rather than a universally reproducible leaderboard number.&lt;/p&gt;

&lt;p&gt;That distinction is important. Private benchmarks can tell us that a model improved relative to another model under a particular evaluation setup, but they do not give developers the same reproducibility as a public benchmark.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reasoning and Scientific Work
&lt;/h2&gt;

&lt;p&gt;The model's gains are not limited to business tasks.&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;HLE-Verified&lt;/strong&gt;, Gemini 3.7 Flash scores &lt;strong&gt;53.6%&lt;/strong&gt;, up from 51.2% for 3.6 Flash and above Claude Sonnet 5 at 31.0%. On &lt;strong&gt;LABBench2&lt;/strong&gt;, which evaluates biology research tasks, it reaches &lt;strong&gt;82.1%&lt;/strong&gt;, compared with 76.1% for its predecessor.&lt;/p&gt;

&lt;p&gt;There are regressions too. On &lt;strong&gt;CharXiv without tools&lt;/strong&gt;, 3.7 Flash scores 84.5%, slightly below 3.6 Flash at 85.2%. With tools enabled, 3.6 Flash also remains ahead, 89.4% to 88.7%.&lt;/p&gt;

&lt;p&gt;That is a useful reminder that “model improvement” is not a monotonic property. A release can improve substantially on coding and agentic workflows while moving backward on a narrower class of reasoning tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gemini 3.7 Flash vs the Competition
&lt;/h2&gt;

&lt;p&gt;Here is the more useful snapshot from Google's published evaluation table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Benchmark&lt;/th&gt;
&lt;th&gt;Gemini 3.7 Flash&lt;/th&gt;
&lt;th&gt;Gemini 3.6 Flash&lt;/th&gt;
&lt;th&gt;Claude Sonnet 5&lt;/th&gt;
&lt;th&gt;GPT-5.6 Terra&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;FrontierCode 1.1 Main&lt;/td&gt;
&lt;td&gt;43.6%&lt;/td&gt;
&lt;td&gt;34.4%&lt;/td&gt;
&lt;td&gt;42.7%&lt;/td&gt;
&lt;td&gt;41.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DeepSWE v1.1&lt;/td&gt;
&lt;td&gt;65.3%&lt;/td&gt;
&lt;td&gt;48.6%&lt;/td&gt;
&lt;td&gt;53.8%&lt;/td&gt;
&lt;td&gt;69.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WebDev / Code Arena&lt;/td&gt;
&lt;td&gt;1,588 Elo&lt;/td&gt;
&lt;td&gt;1,538&lt;/td&gt;
&lt;td&gt;1,541&lt;/td&gt;
&lt;td&gt;1,523&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Terminal-bench 2.1&lt;/td&gt;
&lt;td&gt;85.8%&lt;/td&gt;
&lt;td&gt;78.0%&lt;/td&gt;
&lt;td&gt;80.4%&lt;/td&gt;
&lt;td&gt;87.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Terminal-bench 3.0&lt;/td&gt;
&lt;td&gt;14.9%&lt;/td&gt;
&lt;td&gt;5.4%&lt;/td&gt;
&lt;td&gt;14.6%&lt;/td&gt;
&lt;td&gt;20.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AutomationBench&lt;/td&gt;
&lt;td&gt;30.4%&lt;/td&gt;
&lt;td&gt;17.0%&lt;/td&gt;
&lt;td&gt;10.7%&lt;/td&gt;
&lt;td&gt;23.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GDP.pdf&lt;/td&gt;
&lt;td&gt;34.0%&lt;/td&gt;
&lt;td&gt;22.0%&lt;/td&gt;
&lt;td&gt;28.0%&lt;/td&gt;
&lt;td&gt;24.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Harvey LAB-AA&lt;/td&gt;
&lt;td&gt;90.7%&lt;/td&gt;
&lt;td&gt;85.1%&lt;/td&gt;
&lt;td&gt;90.1%&lt;/td&gt;
&lt;td&gt;85.2%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HLE-Verified&lt;/td&gt;
&lt;td&gt;53.6%&lt;/td&gt;
&lt;td&gt;51.2%&lt;/td&gt;
&lt;td&gt;31.0%&lt;/td&gt;
&lt;td&gt;51.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OSWorld-2.0&lt;/td&gt;
&lt;td&gt;47.9%&lt;/td&gt;
&lt;td&gt;33.8%&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;50.2%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI Intelligence Index&lt;/td&gt;
&lt;td&gt;56&lt;/td&gt;
&lt;td&gt;52&lt;/td&gt;
&lt;td&gt;55&lt;/td&gt;
&lt;td&gt;57&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Source: &lt;a href="https://deepmind.google/models/model-cards/gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google DeepMind Gemini 3.7 Flash model card&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The table makes the central point clear: &lt;strong&gt;Gemini 3.7 Flash is not the universal benchmark leader. It wins important categories while remaining below the frontier on several of the hardest agentic evaluations.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Pricing Story May Matter More Than the Leaderboard
&lt;/h2&gt;

&lt;p&gt;For production systems, benchmark position is only half the equation. The other half is what it costs to run the model repeatedly.&lt;/p&gt;

&lt;p&gt;Google is launching Gemini 3.7 Flash at an introductory price of &lt;strong&gt;$0.75 per million input tokens and $3.75 per million output tokens&lt;/strong&gt; through December 31, 2026. Starting January 1, 2027, the price becomes &lt;strong&gt;$1.50 per million input tokens and $7.50 per million output tokens&lt;/strong&gt;. &lt;a href="https://blog.google/innovation-and-ai/models-and-research/gemini-models/introducing-gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google&lt;/a&gt; &lt;a href="https://deepmind.google/models/model-cards/gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google DeepMind model card&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is why the headline should be understood as &lt;strong&gt;50% introductory pricing relative to the original 3.6 Flash launch price&lt;/strong&gt;, not as a permanent price cut.&lt;/p&gt;

&lt;p&gt;For a simple 80/20 input-output workload, the blended cost is roughly:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input / 1M&lt;/th&gt;
&lt;th&gt;Output / 1M&lt;/th&gt;
&lt;th&gt;Approx. 80/20 blended cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.7 Flash — intro&lt;/td&gt;
&lt;td&gt;$0.75&lt;/td&gt;
&lt;td&gt;$3.75&lt;/td&gt;
&lt;td&gt;$1.35&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.7 Flash — from Jan. 2027&lt;/td&gt;
&lt;td&gt;$1.50&lt;/td&gt;
&lt;td&gt;$7.50&lt;/td&gt;
&lt;td&gt;$2.70&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 5&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;~$3.60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Terra&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$12.00&lt;/td&gt;
&lt;td&gt;~$4.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The real economic question is &lt;strong&gt;cost per successful task&lt;/strong&gt;. A cheaper model that needs more retries, tool calls, or human correction may not actually be cheaper. That is where 3.7 Flash’s coding and tool-use gains become commercially interesting.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;timeline
    title Gemini 3.7 Flash Pricing Lifecycle
    Aug 13 2026 : Introductory launch
               : $0.75 input / 1M
               : $3.75 output / 1M
    Dec 31 2026 : Introductory pricing expires
    Jan 1 2027  : Standard rate begins
               : $1.50 input / 1M
               : $7.50 output / 1M

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Where Gemini 3.7 Flash Still Trails
&lt;/h2&gt;

&lt;p&gt;The strongest case for Gemini 3.7 Flash is not that it dominates every benchmark. It doesn't.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Artificial Analysis Intelligence Index&lt;/strong&gt; puts Gemini 3.7 Flash at 56, behind GPT-5.6 Terra at 57. On DeepSWE, GPT-5.6 Terra retains a meaningful 4.3-point lead. GPT-5.6 Terra also leads Terminal-bench 2.1, Terminal-bench 3.0, and OSWorld-2.0 in Google's comparison.&lt;/p&gt;

&lt;p&gt;Those gaps matter for teams building agents that must operate across long, unpredictable sequences of actions. A 14.9% score on Terminal-bench 3.0 is dramatically better than 5.4% for the previous model, but it is still far from a solved problem.&lt;/p&gt;

&lt;p&gt;That is the more realistic way to view this release: &lt;strong&gt;Gemini 3.7 Flash moves the cheaper Flash tier closer to frontier capability, but it does not erase the gap between a fast workhorse model and the best-performing models on the hardest agentic tasks.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What the Release Means for Developers
&lt;/h2&gt;

&lt;p&gt;For developers, the appeal is straightforward: &lt;strong&gt;better coding without moving to a more expensive tier, cheaper agentic workflows, and broader production use across coding, documents, web development, and automation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That suggests a shift in how models should be evaluated. The better question is not “Which model has the highest benchmark score?” but “Which model can complete my workflow reliably at a cost I can scale?”&lt;/p&gt;

&lt;h2&gt;
  
  
  Availability
&lt;/h2&gt;

&lt;p&gt;Gemini 3.7 Flash is available through the &lt;strong&gt;Gemini API, Google AI Studio, Android Studio, Google Antigravity, Gemini Enterprise Agent Platform, and the Gemini Enterprise app&lt;/strong&gt;. Google also says Gemini Spark will use 3.7 Flash for Google AI Pro and Ultra subscribers in supported countries. &lt;a href="https://blog.google/innovation-and-ai/models-and-research/gemini-models/introducing-gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google&lt;/a&gt; &lt;a href="https://deepmind.google/models/model-cards/gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google DeepMind model card&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The model card lists the API, AI Studio, Antigravity, and enterprise channels explicitly. Developers should still check the current API documentation before migrating production workloads because model availability, parameters, and pricing can change.&lt;/p&gt;

&lt;h2&gt;
  
  
  Safety and Limitations
&lt;/h2&gt;

&lt;p&gt;Google says Gemini 3.7 Flash ships with updated safeguards targeting misuse in &lt;strong&gt;CBRN and cyber offense&lt;/strong&gt; domains. Its Frontier Safety assessment reports that the model did not reach tracked or critical capability thresholds, although it did reach the alert threshold for the Level 1 cybersecurity critical-capability category without crossing the capability threshold itself. &lt;a href="https://deepmind.google/models/model-cards/gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google DeepMind model card&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The model card also lists familiar foundation-model limitations, including hallucinations and possible slowness or timeouts. For high-stakes applications, developers still need application-level validation, permission boundaries, monitoring, and fallback paths.&lt;/p&gt;

&lt;h2&gt;
  
  
  What This Release Signals
&lt;/h2&gt;

&lt;p&gt;The timing may be as interesting as the benchmark numbers. Google shipped 3.7 Flash only three weeks after 3.6 Flash, reinforcing an increasingly iterative approach to its workhorse models.&lt;/p&gt;

&lt;p&gt;The bigger story is economic: a model capable enough to code, use tools, process documents, and automate business tasks can matter more than another leaderboard leader if developers can run it at scale.&lt;/p&gt;

&lt;p&gt;The real test comes after the introductory price expires on &lt;strong&gt;January 1, 2027&lt;/strong&gt;. If teams keep 3.7 Flash in production because it completes enough work with few enough retries, this release will have mattered for reasons that have little to do with benchmark headlines.&lt;/p&gt;

&lt;p&gt;For now, Gemini 3.7 Flash looks like &lt;strong&gt;a cheaper workhorse moving closer to frontier capability—and making production-scale agents easier to justify.&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://blog.google/innovation-and-ai/models-and-research/gemini-models/introducing-gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google — Introducing Gemini 3.7 Flash&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://deepmind.google/models/model-cards/gemini-3-7-flash/" rel="noopener noreferrer"&gt;Google DeepMind — Gemini 3.7 Flash Model Card&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.reuters.com/business/google-unveils-gemini-37-flash-ai-model-coding-agent-workflows-2026-08-13/" rel="noopener noreferrer"&gt;Reuters — Google unveils Gemini 3.7 Flash AI model for coding, agent workflows&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://zyvop.com/google-launches-gemini-3-7-flash-three-weeks-after-3-6-with-50-introductory-pricing-mgns7" rel="noopener noreferrer"&gt;ZyVOP&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;💡 For more articles like this, &lt;a href="https://zyvop.com/newsletter" rel="noopener noreferrer"&gt;subscribe to the ZyVOP newsletter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>llmpricing</category>
      <category>gemini37flash</category>
      <category>geminiapi</category>
      <category>gemini37flashbenchmarks</category>
    </item>
    <item>
      <title>The Rise of AI Trading Among Retail Investors</title>
      <dc:creator>Pradeep Kumar</dc:creator>
      <pubDate>Sat, 15 Aug 2026 14:28:59 +0000</pubDate>
      <link>https://dev.to/pradeep_kumar_bc4e7e9f7ec/the-rise-of-ai-trading-among-retail-investors-2e0j</link>
      <guid>https://dev.to/pradeep_kumar_bc4e7e9f7ec/the-rise-of-ai-trading-among-retail-investors-2e0j</guid>
      <description>&lt;p&gt;On May 27, 2026, Robinhood let customers connect Claude, ChatGPT, and other AI agents straight to their trading accounts. The agents can watch markets, rebalance a portfolio, and place real trades, wrapped in guardrails like a dedicated account, spending limits, and a one-tap kill switch. &lt;a href="https://www.coindesk.com/markets/2026/05/27/robinhood-is-letting-ai-trade-for-you-so-you-don-t-have-to-keep-checking-the-markets" rel="noopener noreferrer"&gt;Robinhood built the feature&lt;/a&gt; on top of the Model Context Protocol, the same standard developers use to wire agents into any other tool.&lt;/p&gt;

&lt;p&gt;That single launch says a lot about where retail investing landed this year. AI trading isn't a hedge fund exclusive anymore. It's a toggle in a consumer app.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Numbers Behind the Shift
&lt;/h2&gt;

&lt;p&gt;The AI trading platform market was worth $11.2 billion in 2024. &lt;a href="https://www.grandviewresearch.com/industry-analysis/ai-trading-platform-market-report" rel="noopener noreferrer"&gt;Grand View Research&lt;/a&gt; puts it at $16.2 billion in 2026, on track for $33.5 billion by 2030 at a 20% annual growth rate.&lt;/p&gt;

&lt;p&gt;Retail adoption is keeping pace. A &lt;a href="https://www.investing.com/blog/how-retail-investors-are-using-ai-in-2026-339" rel="noopener noreferrer"&gt;March 2026 Investing.com survey&lt;/a&gt; of 938 American investors found 65% of AI users say the technology improved their market performance. Most of the same respondents still cross-check AI output against other sources before they act on it, so trust is growing but it isn't blind.&lt;/p&gt;

&lt;p&gt;The shift isn't only American. &lt;a href="https://www.precedenceresearch.com/ai-trading-platform-market" rel="noopener noreferrer"&gt;Precedence Research&lt;/a&gt; notes that Chinese retail investors have started leaning on tools like DeepSeek to sharpen their trading decisions, and expects Asia-Pacific to grow fastest as India and China add retail traders every quarter.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Retail Investors Are Actually Using
&lt;/h2&gt;

&lt;p&gt;Three distinct layers have formed under the "AI trading" label. Each one asks for a different amount of technical comfort.&lt;/p&gt;

&lt;h3&gt;
  
  
  Brokerage-native tools
&lt;/h3&gt;

&lt;p&gt;Robinhood shipped Cortex and Robinhood Strategies before Agentic Trading arrived, and the feature now serves the company's &lt;a href="https://news.bitcoin.com/robinhood-launches-ai-agent-trading-for-27-million-customers-options-and-crypto-next/" rel="noopener noreferrer"&gt;27 million funded customers&lt;/a&gt;. In India, Zerodha's no-code Streak platform plugs directly into its Kite terminal, letting users build and backtest rule-based strategies without writing a line of code, and &lt;a href="https://gyaniturtle.com/agentic-ai-investing-india-trading-basics/" rel="noopener noreferrer"&gt;SEBI-registered advisors like Jarvis Invest&lt;/a&gt; now run algorithmic rebalancing on real client assets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Third-party bot platforms
&lt;/h3&gt;

&lt;p&gt;Crypto-focused products sit a level down from brokerage features. 3Commas and Cryptohopper let traders run grid or dollar-cost-averaging bots without touching an API, trading some flexibility for a much shorter setup.&lt;/p&gt;

&lt;h3&gt;
  
  
  API-first infrastructure
&lt;/h3&gt;

&lt;p&gt;This is the layer developers actually build on. &lt;a href="https://alpaca.markets/blog/alpaca-recognized-as-best-broker-for-algorithmic-trading-in-2026-by-brokerchooser/" rel="noopener noreferrer"&gt;Alpaca won BrokerChooser's 2026 award&lt;/a&gt; for Best Broker for Algorithmic Trading, and its &lt;a href="https://alpaca.markets/" rel="noopener noreferrer"&gt;Trading API ships official MCP servers&lt;/a&gt; so an agent running in Claude or ChatGPT can call the same endpoints that power live trading.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building Your Own: The Developer Path
&lt;/h2&gt;

&lt;p&gt;Here's roughly how one of these agentic pipelines works end to end, guardrails included.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flowchart LR
    A[Market Data Feed] --&amp;gt; B[Signal / Model]
    B --&amp;gt; C{AI Agent Decision}
    C --&amp;gt;|Within limits| D[Guardrails Check]
    C --&amp;gt;|Flagged| E[Human Review]
    D --&amp;gt; F[Order Execution]
    E --&amp;gt; F
    F --&amp;gt; G[(Broker: Alpaca / Robinhood)]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The mechanics behind that diagram are almost boring now. &lt;code&gt;alpaca-py&lt;/code&gt;, &lt;a href="https://pypi.org/project/alpaca-py/" rel="noopener noreferrer"&gt;Alpaca's official Python SDK&lt;/a&gt;, reduces "fetch data, check a condition, place an order" to about 20 lines, and paper trading means none of it touches real money until you flip one flag.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timedelta&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;alpaca.trading.client&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TradingClient&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;alpaca.trading.requests&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;MarketOrderRequest&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;alpaca.trading.enums&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OrderSide&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;TimeInForce&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;alpaca.data.historical&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;StockHistoricalDataClient&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;alpaca.data.requests&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;StockBarsRequest&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;alpaca.data.timeframe&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TimeFrame&lt;/span&gt;

&lt;span class="n"&gt;trading_client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TradingClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SECRET_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paper&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;data_client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;StockHistoricalDataClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SECRET_KEY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;bars&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_stock_bars&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;StockBarsRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;symbol_or_symbols&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AAPL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;timeframe&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;TimeFrame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;

&lt;span class="n"&gt;sma_20&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bars&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;close&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;tail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;last_close&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bars&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;close&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;iloc&lt;/span&gt;&lt;span class="p"&gt;[&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="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;last_close&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;sma_20&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;order&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;MarketOrderRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AAPL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;side&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;OrderSide&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BUY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;time_in_force&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;TimeInForce&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DAY&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;trading_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;submit_order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's a skeleton for wiring up the API, not a strategy worth running. Pair it with &lt;a href="https://alpaca.markets/sdks/python/" rel="noopener noreferrer"&gt;FinRL for reinforcement learning experiments or Backtrader for backtesting&lt;/a&gt;, and a solo developer now has most of what a small quant desk had a decade ago.&lt;/p&gt;

&lt;p&gt;The gap between "have an idea" and "have a working bot" has basically closed. That's most of the reason retail AI trading grew so fast this year.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Reality Check
&lt;/h2&gt;

&lt;p&gt;Easy to build doesn't mean easy to profit from. The clearest evidence comes from Alpha Arena, a live benchmark from startup Nof1 that hands frontier AI models real money and lets them trade in public.&lt;/p&gt;

&lt;p&gt;In its first season, six models each traded $10,000 in crypto perpetual contracts from October 17 to November 3, 2025. By the end, &lt;a href="https://protos.com/llm-crypto-trading-contest-finds-llms-cant-trade-crypto/" rel="noopener noreferrer"&gt;ChatGPT was down $6,267, Gemini was down $5,671, Grok was down $4,531, and Claude Sonnet was down $3,081&lt;/a&gt;; only DeepSeek and Qwen3 Max finished in the green, up $489 and $2,232.&lt;/p&gt;

&lt;p&gt;A later round moved the same idea to US tech stocks, and &lt;a href="https://www.fa-mag.com/news/ai-bots-auditioning-for-wall-street-trading-are-mostly-losing-86902.html" rel="noopener noreferrer"&gt;Bloomberg reported&lt;/a&gt; the results didn't improve. Across 32 total contest outcomes, a model finished in profit only six times, and the group lost close to a third of its combined capital. Two models given the exact same prompt still traded wildly differently: one placed 158 trades, the other 1,418.&lt;/p&gt;

&lt;p&gt;Nof1 founder Jay Azhang put it simply: current models can't generate returns on their own, they need serious surrounding infrastructure just to have a shot. Doug Clinton, who runs the LLM-driven fund Intelligent Alpha, described the models as having "personalities that you have to manage almost like a human analyst," since the same prompt can leave one model bullish and another bearish for no clear reason.&lt;/p&gt;

&lt;p&gt;Prediction markets add a useful caveat here. &lt;a href="https://www.coindesk.com/tech/2026/03/15/ai-agents-are-quietly-rewriting-prediction-market-trading" rel="noopener noreferrer"&gt;CoinDesk reported in March 2026&lt;/a&gt; that only 7% to 13% of human traders on Polymarket turn a consistent profit, a genuinely low bar. Olas co-founder David Minarsch told the outlet his firm's Polystrat agent saw over 37% of its wallets finish positive in its first month live, though that number is the company's own claim about its own product, not an independent audit, a distinction worth holding onto in a space full of impressive self-reported figures.&lt;/p&gt;

&lt;p&gt;Hidden costs explain part of every automated strategy's underperformance too. A system placing dozens of trades a day accumulates fees and slippage fast enough to turn a solid gross return into a net loss, and a backtest that looks strong across years of historical data can still blow through its stop-loss once real conditions shift underneath it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Regulators Are Paying Attention
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.finra.org/rules-guidance/guidance/reports/2026-finra-annual-regulatory-oversight-report/gen-ai" rel="noopener noreferrer"&gt;FINRA's December 2025 oversight report&lt;/a&gt; added a dedicated GenAI section for the first time, flagging autonomous AI agents as their own risk category. The concerns are specific: agents acting without human validation, agents operating past their intended scope, and generative tools producing fake news or coordinated social posts built to look like real retail enthusiasm.&lt;/p&gt;

&lt;p&gt;The SEC is pointing the same direction. Its &lt;a href="https://www.innreg.com/blog/sec-guidance-on-ai" rel="noopener noreferrer"&gt;2026 exam priorities&lt;/a&gt; now expect firms to explain what their AI systems do, who supervises them, and how risks get caught before they compound.&lt;/p&gt;

&lt;p&gt;Robinhood addresses this directly in its own disclosures. The company &lt;a href="https://robinhood.com/us/en/newsroom/robinhood-is-now-open-to-agents/" rel="noopener noreferrer"&gt;states plainly that it doesn't control, supervise, monitor, or audit&lt;/a&gt; third-party AI agents once they're connected, and that customers assume all risk for orders those agents place.&lt;/p&gt;

&lt;p&gt;India has taken a more structured path. &lt;a href="https://www.businesstoday.in/markets/top-story/story/sebi-proposes-to-open-up-algo-trading-for-retail-investors-to-improve-market-integrity-457242-2024-12-13" rel="noopener noreferrer"&gt;SEBI released a draft circular in December 2024&lt;/a&gt; opening algorithmic trading to retail investors through exchange-approved broker APIs, and finalized the framework in February 2025 with every order tagged by a unique Algo-ID for the audit trail. It's a middle ground between banning automation outright and leaving it unregulated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where This Goes
&lt;/h2&gt;

&lt;p&gt;None of this makes AI trading a fad. The infrastructure is real, from broker APIs to MCP servers to no-code builders, and it's improving fast.&lt;/p&gt;

&lt;p&gt;What the 2026 data actually supports is narrower than the hype suggests. Even Nof1, the startup running Alpha Arena, is building its actual business around helping retail traders assemble their own agents rather than betting on a model that trades unsupervised. AI helps most as a research and execution layer, and the accounts that hold up tend to keep a human setting the boundaries instead of handing over the keys entirely.&lt;/p&gt;

&lt;p&gt;For developers, that's the more interesting problem to build for anyway. A system that surfaces a signal and explains its reasoning is a harder, more useful thing to ship than one that just fires off trades in the dark.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://zyvop.com/the-rise-of-ai-trading-among-retail-investors-g1c2z" rel="noopener noreferrer"&gt;ZyVOP&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;💡 For more articles like this, &lt;a href="https://zyvop.com/newsletter" rel="noopener noreferrer"&gt;subscribe to the ZyVOP newsletter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>python</category>
      <category>regulation</category>
      <category>fintech</category>
      <category>aitrading</category>
    </item>
    <item>
      <title>AI Doesn't Ship Software. You Still Do.</title>
      <dc:creator>Pradeep Kumar</dc:creator>
      <pubDate>Sat, 01 Aug 2026 16:09:38 +0000</pubDate>
      <link>https://dev.to/pradeep_kumar_bc4e7e9f7ec/ai-doesnt-ship-software-you-still-do-5a5a</link>
      <guid>https://dev.to/pradeep_kumar_bc4e7e9f7ec/ai-doesnt-ship-software-you-still-do-5a5a</guid>
      <description>&lt;p&gt;&lt;em&gt;AI made the easy 90% of software instant. The hard 90% is still yours.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You type one sentence into a prompt box. Ninety seconds later, there's a running app.&lt;/p&gt;

&lt;p&gt;A form. A database. A chart that updates when you submit it. It looks done.&lt;/p&gt;

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

&lt;p&gt;Open two browser tabs. Log in as the same user in both.&lt;/p&gt;

&lt;p&gt;Submit the same form twice, fast — the way a nervous user does when the button doesn't visibly respond.&lt;/p&gt;

&lt;p&gt;Leave the thing running for a week instead of a five-minute demo.&lt;/p&gt;

&lt;p&gt;Somewhere in there, the wheels come off. A race condition nobody wrote a test for. A query that's instant at 40 rows and takes 40 seconds at 4 million. A webhook handler that isn't &lt;a href="https://stripe.com/docs/idempotency" rel="noopener noreferrer"&gt;idempotent&lt;/a&gt;, so a single retried request charges someone twice. A rate limiter that doesn't exist, so one flaky client retrying in a loop quietly takes the whole service down.&lt;/p&gt;

&lt;p&gt;Pull up the git history. There's a decent chance an API key is sitting in a commit from three days ago, in plain text, one &lt;code&gt;git push&lt;/code&gt; from being public forever.&lt;/p&gt;

&lt;p&gt;None of this means the model failed. It built exactly what you asked for: something that runs.&lt;/p&gt;

&lt;p&gt;Whether it survives real users, real load, and real time was never the question it was answering.&lt;/p&gt;

&lt;h2&gt;
  
  
  An old joke that's suddenly relevant again
&lt;/h2&gt;

&lt;p&gt;In 1985, a Bell Labs programmer named Tom Cargill coined a line that Jon Bentley made famous in a &lt;em&gt;Communications of the ACM&lt;/em&gt; column.&lt;/p&gt;

&lt;p&gt;The first 90 percent of a project's code takes 90 percent of the time. The remaining 10 percent takes the other 90 percent.&lt;/p&gt;

&lt;p&gt;Bentley called it, only half-jokingly, the &lt;a href="https://en.wikipedia.org/wiki/Ninety%E2%80%93ninety_rule" rel="noopener noreferrer"&gt;"Rule of Credibility"&lt;/a&gt; — a warning to anyone tempted to trust a schedule from someone who'd never shipped anything to production.&lt;/p&gt;

&lt;p&gt;Forty years later, the joke lands harder than it used to.&lt;/p&gt;

&lt;p&gt;AI collapsed exactly the part of the timeline the rule isn't about. Scaffolding an app — the login form, the CRUD boilerplate — used to eat real days. Now it's minutes.&lt;/p&gt;

&lt;p&gt;What Cargill was pointing at was always the second 90 percent: migrations that can't safely run twice, and the edge case where a deleted user's session token quietly keeps working for six more hours because nobody thought to invalidate it.&lt;/p&gt;

&lt;p&gt;That part hasn't gotten any faster. It was never a typing problem to begin with.&lt;/p&gt;

&lt;h2&gt;
  
  
  Judgment was always the expensive part
&lt;/h2&gt;

&lt;p&gt;Ask an engineer with ten years of on-call scars what they think about while reviewing a pull request. It's rarely the syntax.&lt;/p&gt;

&lt;p&gt;It's this: What happens under load? What's the blast radius if this throws at 3 a.m. and pages someone? Where does this leak a secret, a connection, or a customer's data?&lt;/p&gt;

&lt;p&gt;Those aren't questions you answer by reading more code. They're questions you answer by having watched systems break before, and having built a mental model of why.&lt;/p&gt;

&lt;p&gt;A language model doesn't have that model. It has, at enormous scale, a very good sense of what competent code &lt;em&gt;looks like&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;That's genuinely useful. It's also not the same thing as knowing what competent code &lt;em&gt;does under pressure&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Ask it for an authentication flow and you'll get something clean, conventional, and quietly wrong — in a way that won't surface until one specific, unlucky sequence of events happens in production.&lt;/p&gt;

&lt;p&gt;At which point it's not a code review comment anymore. It's an incident.&lt;/p&gt;

&lt;h2&gt;
  
  
  This isn't an argument against learning to code
&lt;/h2&gt;

&lt;p&gt;It's the opposite, actually. Worth saying plainly, because a lot of people are drawing the wrong conclusion from how good the tools have gotten.&lt;/p&gt;

&lt;p&gt;The part AI is genuinely eating is the mechanical translation of a spec into syntax — which was always the least interesting part of the job anyway.&lt;/p&gt;

&lt;p&gt;Junior work that amounted to "implement this ticket exactly as written" is getting cheaper by the month. It's not coming back.&lt;/p&gt;

&lt;p&gt;But the value of understanding how a database index actually works, or why two requests hitting the same row in the same millisecond corrupt data, hasn't dropped.&lt;/p&gt;

&lt;p&gt;If anything, it's gone up. That understanding is now the only thing standing between a working demo and an outage.&lt;/p&gt;

&lt;p&gt;The engineers pulling ahead right now aren't the ones who avoided AI. They're the ones using it the way you'd use a very fast, very confident junior developer: delegate the boilerplate, then read every line that comes back like it's a pull request from someone you've never worked with before.&lt;/p&gt;

&lt;p&gt;What is it assuming about the input? What happens if this function gets called twice at once? Is the error actually handled, or just caught and silently swallowed?&lt;/p&gt;

&lt;p&gt;None of that is a new skill. It's the same one code review has always demanded, aimed now at a collaborator that writes fast and never once says "I'm not sure about this part."&lt;/p&gt;

&lt;p&gt;The engineers falling behind aren't the ones without AI access — everyone has AI access. It's the ones who ship what it hands them without being able to explain why it works, and who have no idea where to even start once it stops.&lt;/p&gt;

&lt;p&gt;That's the actual gap AI hasn't closed. It never set out to.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This piece was sparked by&lt;/em&gt; &lt;a href="https://weeraman.com/the-prototype-isnt-the-product/" rel="noopener noreferrer"&gt;&lt;em&gt;Anuradha Weeraman's essay on the same gap&lt;/em&gt;&lt;/a&gt; &lt;em&gt;— worth the five minutes.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://zyvop.com/ai-doesn-t-ship-software-you-still-do-so4q8" rel="noopener noreferrer"&gt;ZyVOP&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;💡 For more articles like this, &lt;a href="https://zyvop.com/newsletter" rel="noopener noreferrer"&gt;subscribe to the ZyVOP newsletter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>careeradvice</category>
      <category>aicoding</category>
      <category>productdevelopment</category>
    </item>
  </channel>
</rss>
