feat: rework starter kit for self-hosted deploy (Vite/React + Fastify/Drizzle/Postgres)

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
This commit is contained in:
patrickandClaude Sonnet 5 committed 2026-09-08 11:42:47 +02:00
1 parent a893084a88
commit 4a19335a1e
99 files changed
+8898 -9835

No files matched your search

+34 -18
View File
@@ -1,32 +1,48 @@
# Error Tracking Setup (Sentry)
# Error Tracking Setup (Sentry, self-hosted friendly)
Track production errors automatically so you know about issues before your users report them.
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](https://sentry.io) (free tier available for small apps)
- Create a new project and select "Next.js"
- Create a project of type "Node" for the backend and one of type "React" for the frontend (or one combined project)
### 2. Install Next.js Integration
### 2. Install SDKs
```bash
npx @sentry/wizard@latest -i nextjs
```
This automatically:
- Installs `@sentry/nextjs`
- Creates `sentry.client.config.ts` and `sentry.server.config.ts`
- Updates `next.config.ts` with Sentry webpack plugin
# backend/
npm install @sentry/node
### 3. Add Environment Variables
Add to `.env.local` (local) and Vercel Dashboard (production):
# frontend/
npm install @sentry/react
```
### 3. Initialize
Backend (`backend/src/server.ts`, before anything else runs):
```ts
import * as Sentry from "@sentry/node";
Sentry.init({ dsn: process.env.SENTRY_DSN });
```
Frontend (`frontend/src/main.tsx`, before rendering):
```ts
import * as Sentry from "@sentry/react";
Sentry.init({ dsn: import.meta.env.VITE_SENTRY_DSN });
```
### 4. Add Environment Variables
Backend `.env`:
```bash
SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx
NEXT_PUBLIC_SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx
SENTRY_AUTH_TOKEN=sntrys_xxx # For source maps upload
```
Frontend `.env` (baked in at build time, so rebuild after changing it):
```bash
VITE_SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx
```
### 4. Verify Setup
Trigger a test error and check Sentry Dashboard:
### 5. Verify Setup
Trigger a test error and check the Sentry Dashboard:
```typescript
// Temporary test - remove after verification
throw new Error("Sentry test error")
@@ -34,10 +50,10 @@ throw new Error("Sentry test error")
## What You Get
- Automatic error capture (client + server)
- Stack traces with source maps
- Stack traces with source maps (upload via `@sentry/vite-plugin` / `@sentry/esbuild-plugin` in the build step)
- Error grouping and deduplication
- Email alerts for new errors
- Performance monitoring (optional)
## Alternative
**Vercel Error Tracking** - Built-in, simpler, but fewer features. Available in Vercel Dashboard under "Monitoring".
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.