Skip to content

add uptime docs, structured logger, request ID middleware, and escrow…#822

Open
Andreschuks101 wants to merge 1 commit into
Ogstevyn:mainfrom
Andreschuks101:uptimedoc
Open

add uptime docs, structured logger, request ID middleware, and escrow…#822
Andreschuks101 wants to merge 1 commit into
Ogstevyn:mainfrom
Andreschuks101:uptimedoc

Conversation

@Andreschuks101
Copy link
Copy Markdown
Contributor

@Andreschuks101 Andreschuks101 commented May 29, 2026

Summary

  • Add docs/ops/uptime.md documenting UptimeRobot setup to monitor /api/health every 5 minutes with email and Slack alerts, including a simulated 6-minute downtime acceptance test procedure.
  • Add lib/logger.ts implementing structured JSON logging ({ level, message, timestamp, context }). In production only warn and above are emitted as JSON objects; in development output is pretty-printed.
  • Add middleware.ts at the project root as a Next.js Edge middleware that generates a x-request-id UUID per request, attaches it to the upstream request headers, and echoes it back in the response headers for all /api/* routes.
  • Add hooks/useArchivedEscrows.ts, a client-side hook that persists archived escrow IDs in localStorage and exposes archiveEscrow, unarchiveEscrow, and isArchived helpers.
  • Modify app/escrows/page.tsx to import useArchivedEscrows and render an Archive/Unarchive icon button on every released or expired escrow card. A "Show archived (N)" toggle button appears in the header when at least one escrow is archived and switches the list between active and archived views.

Test plan

  • In production mode (NODE_ENV=production), trigger an error path and confirm the console output is a valid JSON object with level, message, timestamp fields.
  • In development mode, confirm output is human-readable (pretty-printed).
  • Make a request to any /api/* route and confirm the x-request-id response header is present and is a valid UUID.
  • On the Escrows page, confirm Archive button appears only on released/expired escrow cards.
  • Click Archive on an escrow — confirm it disappears from the default list.
  • Click "Show archived" — confirm the archived escrow reappears.
  • Click the Unarchive button — confirm the escrow returns to the active list.
  • Reload the page — confirm archived state persists via localStorage.
  • Follow docs/ops/uptime.md setup steps in UptimeRobot and simulate a 6-minute downtime to verify alert delivery.

closes #727
closes #721
closes #719

@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@Andreschuks101 is attempting to deploy a commit to the Stephen's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@Andreschuks101 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant