Replace Next.js/Supabase/Vercel stack with a self-hostable setup: Vite+React frontend, Fastify+Drizzle+PostgreSQL backend with own JWT auth, deploy via git pull + rsync + systemd (checkout/service separated, updates pulled from Gitea). Adds a reference auth route (register/login/me) as the canonical pattern for new routes. Updates all skills/rules/agents/docs to match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BMdBJfD9TT6XUU2NqGG1PN
1.8 KiB
1.8 KiB
Error Tracking Setup (Sentry, self-hosted friendly)
Track production errors automatically so you know about issues before your users report them. Sentry's SaaS free tier works fine even on a self-hosted app — it's just a DSN endpoint, no coupling to any specific host.
Setup (5 minutes)
1. Create Sentry Account
- Go to sentry.io (free tier available for small apps)
- Create a project of type "Node" for the backend and one of type "React" for the frontend (or one combined project)
2. Install SDKs
# backend/
npm install @sentry/node
# frontend/
npm install @sentry/react
3. Initialize
Backend (backend/src/server.ts, before anything else runs):
import * as Sentry from "@sentry/node";
Sentry.init({ dsn: process.env.SENTRY_DSN });
Frontend (frontend/src/main.tsx, before rendering):
import * as Sentry from "@sentry/react";
Sentry.init({ dsn: import.meta.env.VITE_SENTRY_DSN });
4. Add Environment Variables
Backend .env:
SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx
Frontend .env (baked in at build time, so rebuild after changing it):
VITE_SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx
5. Verify Setup
Trigger a test error and check the Sentry Dashboard:
// Temporary test - remove after verification
throw new Error("Sentry test error")
What You Get
- Automatic error capture (client + server)
- Stack traces with source maps (upload via
@sentry/vite-plugin/@sentry/esbuild-pluginin the build step) - Error grouping and deduplication
- Email alerts for new errors
- Performance monitoring (optional)
Alternative
Self-hosted GlitchTip — an open-source, Sentry-protocol-compatible error tracker you can run on your own server if sending errors to a third-party SaaS is not acceptable.