How Database Indexes Work and When to Add One

On a million-row table, the same SELECT can take fifty milliseconds or well under one. The only difference is whether the database reads every row to find the ones you asked for, or jumps straight to them. An index is what lets it jump, and you pay for it on every write. Concretely, an index is a second, sorted copy of one or more columns, stored next to the table and updated automatically whenever the table changes. The database uses it to reach matching rows without touching the rest. ...

September 27, 2026 · 9 min · 1764 words · SpaghettiCoder

What Is CORS and How to Fix CORS Errors

Your frontend runs on http://localhost:5173, your API on http://localhost:4000, and the fetch call that worked fine in Postman fails in the browser with a wall of red text: Access to fetch at 'http://localhost:4000/api/users' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Your server may well have handled that request and returned a 200. The browser refused to hand the response to your JavaScript. ...

September 26, 2026 · 8 min · 1575 words · SpaghettiCoder

What Is Spaghetti Code and How to Refactor It

You open a function to fix a one-line bug and forty minutes later you’re still tracing which branch sets which variable. Three unrelated jobs are welded into one block, and none of them has a name. Pull one thread and you can’t tell which others move. That is spaghetti code, and the name has nothing to do with indentation or naming style. It describes control flow: execution jumps between conditions the way one strand of pasta crosses every other strand in the bowl, and following a single path to its end means holding four levels of if in your head at once. ...

September 25, 2026 · 10 min · 1958 words · SpaghettiCoder

SSH Tunneling: Local, Remote, and Dynamic Port Forwarding

How do you reach a database that only listens on localhost? A Postgres instance on a remote server binds to 127.0.0.1 on purpose. Nothing on the network can reach it, only processes running on that same box. Your laptop is not that box, so psql -h remote-server -p 5432 fails before it gets anywhere near authentication. Opening the port to the world defeats the reason it was bound to loopback in the first place. ...

September 24, 2026 · 7 min · 1416 words · SpaghettiCoder

How CLI Coding Agents Work and How to Choose One

What makes one CLI coding agent different from another Ask a CLI coding agent to fix a failing test and it won’t reply with a suggestion. It reads the test output, opens the file, edits a line, reruns the test, and reports back once it passes. That loop is the product, not the chat window. The model inside the loop gets most of the attention, and it’s also the part that changes fastest: vendors swap in new ones every few months, and several agents let you pick. What stays put is the harness wrapped around the model — which tools it can reach, how it manages context, what it may run without asking, and where those commands execute. Two agents running the same model can behave very differently because of it. The harness is what you’re actually choosing. ...

September 23, 2026 · 8 min · 1527 words · SpaghettiCoder

How to Cache Dependencies in GitHub Actions

A workflow that runs npm ci on every push downloads the same few hundred packages from the registry each time, even when the lockfile hasn’t changed in a week. On a project with a real dependency tree that’s a minute or two gone before the first test starts, and you pay it again on every push and every pull request. actions/cache keeps those downloads between runs and hands them back when nothing relevant has changed. ...

September 23, 2026 · 6 min · 1167 words · SpaghettiCoder

How to Expose a Local Server with Cloudflare Tunnel

Why nobody outside your network can reach localhost A webhook provider needs a URL it can POST to, and your server is sitting on localhost:3000. Or a teammate wants to click through the branch you’re running, or your phone needs to hit the dev server to check a layout. The server is up. Nothing outside your network can reach it. Port forwarding on your router would work, but it exposes your home IP and needs admin access you often don’t have. Cloudflare Tunnel takes the other route. cloudflared, a small daemon you run next to your server, opens an outbound connection to Cloudflare’s edge, and Cloudflare sends traffic back through it. You open no inbound port and you don’t need a public IP. ...

September 23, 2026 · 7 min · 1383 words · SpaghettiCoder

How to Set Up Remote Debugging in Visual Studio

Debugging a bug that only happens on a machine without Visual Studio A bug reproduces on the test server and not on your laptop. The test server has no Visual Studio, and installing a full IDE there to set one breakpoint isn’t an option. Remote debugging is built for this case. A small standalone program runs on the target machine, your local Visual Studio connects to it over the network, and you get breakpoints and variable inspection on a process that isn’t running anywhere near your desk. ...

September 23, 2026 · 7 min · 1354 words · SpaghettiCoder

What Is a System One Model and When to Use One

Why so many LLM calls are really classification A lot of production LLM traffic returns one word. Escalate this ticket or not. Spam or not spam. Which of six handlers gets this event. To get that word, you send the whole prompt to a general-purpose model, wait while it decodes a reply token by token, and parse a JSON object out of the result. You pay the price and the latency of text generation, and what comes back is a decision that fits in an enum. ...

September 23, 2026 · 6 min · 1261 words · SpaghettiCoder

How to Use Git Bisect to Find a Broken Commit

The test suite has been green for three weeks. Today npm test fails on an assertion that has nothing to do with what you just changed, and git log v1.4.0..HEAD shows 340 commits from four people since the last release anyone is sure worked. Reading every diff costs you a day. Checking out commits at random is faster and still not a plan. git bisect turns that into a binary search. You give it one commit you know is good and one you know is bad; it checks out the commit halfway between them and waits while you test that single commit and report back. Each answer halves the range. 340 commits resolve in at most 9 tests, since 2^9 = 512. ...

September 22, 2026 · 6 min · 1104 words · SpaghettiCoder