Monitoring for Claude Code Apps
Adding monitoring to a Claude Code app
Claude Code works at the terminal level and can make big architectural changes in a single session. This is how to add error tracking and uptime monitoring with Upflag.
Where Claude Code apps break
You describe what you want and Claude Code builds it. It can scaffold an entire feature in one go — routes, components, database migrations, the works. The code is generally well-written, but the volume makes review hard.
The spots where new code connects to your existing code are where things break. Claude Code doesn't always know about your Stripe webhooks, your auth middleware, or your edge cases. It writes code that works in isolation but breaks a dependency you didn't think to mention.
Large sessions are the riskiest. You come back from a long Claude Code session with 20 files changed and everything seems to work. A week later you find out the contact form has been broken since that session. A component throws, the user gets a blank page, and there's nothing telling you it happened.
Background jobs and scheduled tasks are another blind spot. If Claude Code rewrites a cron handler or a queue worker, there's no visible symptom when it stops running. You find out when the data is stale or a report didn't send.
And then integrations. You ask Claude Code to restructure your API and it doesn't know your payment provider depends on that exact endpoint path. The app runs fine. Your revenue pipeline is broken.
Setup
1. Get your project key
Sign up at upflag.io and grab the project key from your dashboard.
2. Add two script tags
Add these two tags to your <head> — both are needed. The first buffers any errors that fire before the main snippet loads:
<script>window.__ufq=[];window.addEventListener("error",function(e){window.__ufq.push(e)});window.addEventListener("unhandledrejection",function(e){window.__ufq.push(e)})</script>
<script src="https://upflag.io/api/v1/snippet?key=uf_YOUR_KEY" defer></script>
Replace uf_YOUR_KEY with your key from the Upflag dashboard.
Or just run npx upflag init — Claude Code can do this for you. Ask it to "add upflag monitoring" and point it at the npx command.
It starts capturing JavaScript errors and page loads right away.
3. Set up alerts
In the Upflag dashboard, pick where you want notifications: email, Slack, or SMS. Alerts say what broke in plain English ("Your signup form started throwing errors") instead of a stack trace.
After setup
Upflag checks your URL every 60 seconds. Hosting goes down, DNS breaks, SSL expires, you'll know.
For Claude Code projects specifically, the biggest value is catching breakage after large sessions. You come out of a session with a ton of changes, push to production, and error tracking tells you if something went wrong that you didn't notice during review. Failed fetches, uncaught exceptions, components that stopped rendering.
After any session where you changed a lot, check that your important flows still work. Whatever your app needs to do to make money — signups, purchases, the core thing — verify those didn't break.
Using the MCP server
You can connect Upflag as an MCP server so Claude Code can see your production errors while it's working. Add it to your MCP configuration with your Upflag API key.
Once connected, you can tell Claude Code to "check upflag for recent errors and fix them" and it'll pull the error data directly. Instead of you describing what's broken, it already knows — which page threw, what the error was, how many users hit it. It goes straight to fixing the problem.
This doesn't replace the script tags. The tags capture errors in the browser. The MCP connection is what lets Claude Code read those errors back.