Posts

Writing Web Push Notification Code With LLMs in November 2026: Ask for Permission After a Click, Store One Subscription per Device, and Delete the Ones That Come Back 410

Image
Web push notifications look like a small feature: ask the browser for permission, save something on the server, send a message later. Ask an LLM for "push notifications for my web app" and you will get a service worker, a subscribe call, and a send function in a few seconds. The code usually runs. The problems show up a week later: the permission prompt fires on page load and most people block it forever, the server keeps one subscription per user and silently loses every device but the last one, and a pile of dead subscriptions makes every send slower and noisier. This post walks through how to get an LLM to write web push code you can actually ship, using the standard Push API, the Notifications API, and VAPID keys. The examples use plain browser JavaScript and the web-push package for Node.js, but the same rules apply in any server language. How the pieces fit together Before you prompt anything, make sure you and the model agree on the moving parts. Mixed-up terms ...

Writing Subscription Billing Code With LLMs in November 2026: Let Webhooks Decide Access, Store the Provider's IDs, and Plan for Failed Payments

Image
Subscription billing looks like a weekend task. You add a checkout button, the payment provider takes the card, and you flip a flag that says the user is on the paid plan. Ask an LLM for "Stripe subscription code" and it will give you exactly that in a few seconds. The trouble is that the first version almost always treats billing as a single moment, the checkout, when it is really a long-running relationship with renewals, failed cards, upgrades, cancellations, refunds, and events that arrive late or twice. This post walks through how to get useful subscription code out of an LLM without shipping the usual mistakes. The examples use Stripe because it is common and well documented, but the same ideas apply to Paddle, Lemon Squeezy, Chargebee, and app store billing: the provider owns the money, and your app has to keep a faithful copy of what the provider says. A subscription is like a commuter pass: it is valid for a period, it has to be renewed, and the system that issue...

Writing Transactional Outbox Code With LLMs in November 2026: Save the Event in the Same Transaction, Relay It With a Separate Worker, and Make Every Consumer Handle Duplicates

Image
Ask a coding assistant to "send an order.created event to the queue after we save the order" and you will usually get something like this: insert the order, commit, then call queue.publish() . It looks fine and it works in every demo. It also has a gap. If the process crashes, the network drops, or the broker is down between the commit and the publish, the order exists and nobody downstream ever hears about it. Flip the order of the two steps and you get the opposite bug: an event for an order that was rolled back. The transactional outbox pattern closes that gap. Instead of talking to the broker inside your request, you write the event into an outbox table in the same database transaction as the business change. A separate relay process reads that table and publishes to the broker. This guide shows how to get correct outbox code out of an LLM: describe the failure you are preventing, design the table, write the relay carefully, and make consumers safe against the duplica...

Writing HTTP Caching Headers With LLMs in November 2026: Mark Personal Responses Private, Revalidate With ETags, and Fingerprint Static Files Before You Cache Them for a Year

Image
Ask a coding assistant to "make the site faster with caching" and you will usually get a few lines that set Cache-Control: public, max-age=86400 on everything. That one line can make a page load instantly. It can also serve one customer's account page to another customer through a shared CDN, or leave users stuck on a broken JavaScript bundle for a day after you shipped the fix. HTTP caching headers are short, but they are a contract between your server, every browser, and every proxy or CDN in between. LLMs are good at writing the syntax and weak at knowing which responses are personal, which files change, and what your CDN does by default. This guide walks through how to get correct caching code out of an assistant: classify your responses first, pick a header for each class, add revalidation with ETags, and test the result with real requests. Cache-Control max-age works like a date printed on a carton: until it passes, a cache may hand out the copy it already has ...

Writing Multi-Tenant Data Isolation Code With LLMs in November 2026: Put a Tenant ID on Every Row, Take It From the Session, and Back It Up With Row-Level Security

Image
If your app has "workspaces," "organizations," "teams," or "accounts," you are running a multi-tenant system. Many customers share one database, and the most important promise you make is that one customer never sees another customer's data. An LLM will happily write you a projects table and a GET /projects endpoint in seconds. What it will not do unless you ask is make that endpoint impossible to point at somebody else's projects. This guide covers the shared-database, shared-schema model, where every tenant's rows live in the same tables and a tenant_id column tells them apart. It is the most common setup for small SaaS products, and it is where generated code most often leaks. The examples use PostgreSQL and plain SQL so they translate to any stack. One building, many residents, and each mailbox opens with only its owner's key. A multi-tenant database should work the same way. Image: Mailboxes, France by Philippe Alès, ...

Writing Database Connection Pool Code With LLMs in November 2026: Create One Pool Per Process, Always Release in finally, and Size It Against Your Database's Connection Limit

Image
Ask an AI coding assistant to "connect to Postgres" and you will almost always get code that works on your laptop. The query runs, the test passes, and you move on. The trouble shows up later: under real traffic the app starts hanging, requests time out waiting for a connection, or the database starts refusing logins with "too many clients already." Almost every one of those failures traces back to how the connection pool was set up, and connection pool code is exactly the kind of thing LLMs get subtly wrong because it looks fine until there is load. This post walks through what a connection pool actually does, the specific mistakes generated code tends to make, and a short checklist you can hand to the model (and to yourself) before the code ships. Examples use Node.js with node-postgres and Python with SQLAlchemy, but the same ideas apply to HikariCP in Java, database/sql in Go, and most other drivers. What a connection pool is for Opening a database conne...