StoicBuilder

HandbookIII the CastraMonitoring and alerts

IIIthe Castra, Stay in control

Monitoring and alerts

1 min readUpdated 28 November

In plain words

Monitoring watches your live app for errors, slowdowns and downtime, and alerts message you when something crosses a line, so you hear about problems first.

Where you see it

Sentry emails you "TypeError: Cannot read properties of undefined (reading 'price')" along with the page, browser and user it happened to. An uptime checker like Better Stack or UptimeRobot texts you when Harbor stops responding at 3 a.m.

instrumentation-client.tsbrowser
import * as Sentry from "@sentry/nextjs"; Sentry.init({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, tracesSampleRate: 0.1, sendDefaultPii: false,});
A few lines send every uncaught browser error to one dashboard. The DSN is safe to expose.

What goes wrong

  1. Finding out from an angry customer

    Without monitoring, the first sign of a broken checkout is a refund request. Set up error tracking before launch, not after the first outage.

  2. Alerting on everything

    Fifty alerts a day teach you to ignore them all, including the one that matters. Alert on new errors and downtime, and read the rest weekly.

  3. Watching only the homepage

    An uptime check on / stays green while login, checkout and webhooks fail. Point it at an /api/health route that also queries the database.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Add Sentry error tracking to both the browser and server code with personal data turned off, and create an /api/health route that checks the database connection. Then tell me how to point an uptime monitor at that route and alert only on new errors.

Quick check

Sign in to earn +10 XP for it

Your uptime monitor says Harbor is up, but users can't log in. Why might it have missed that?

Got a prompt that touches monitoring and alerts?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.