Ekler'in Supabase'den tam çıkış backend'i — NestJS 11 (Fastify) + Drizzle + Postgres.
Strangler-fig geçiş; master plan: ~/.claude/plans/selam-senle-uzun-soluklu-resilient-pumpkin.md.
packages/contracts @ekler/contracts — RN ile paylaşılan zod şemaları (envelope, error code, pagination, domain DTO). TEK zod v4 kopyası.
apps/api @ekler/api — NestJS/Fastify HTTP API (web process)
apps/worker @ekler/worker — BullMQ consumer + @nestjs/schedule cron (Phase 5+)
apps/admin @ekler/admin — AdminJS (ayrı Express process, Phase 5+)
- Response envelope:
{ data, meta:{cursor,has_more} }/ hata{ error:{code,message,details} }. - University-scope (anti-K-1): scoped tablolara TEK erişim
ScopedRepositoryüzerinden; CLS'tekiuniversityDomainher query/insert'e zorla enjekte edilir. Rawdbile scoped tabloya dokunmak yasak (lint +ScopedTablebrand). - Guard sırası (load-bearing): ClsGuard → AuthGuard → BanGuard → ThrottlerGuard.
- Hata kodları RN
services/ServiceError.tsile simetrik.
nvm use # node 22
corepack enable
pnpm install
cp .env.example apps/api/.env # değerleri doldur (en azından DATABASE_URL + SUPABASE_*)
pnpm dev:api # http://localhost:3010/v1/healthDrizzle DDL sahibi değildir; şema sahibi Supabase migration'larıdır. Tipleri çekmek için:
pnpm db:pull # DIRECT_DATABASE_URL'e bağlanır, apps/api/src/db/schema/* üretir
pnpm db:check # CI drift: pull çıktısı commit'le diff'lenirÜretilen şema per-domain dosyalara bölünür; composite PK / CHECK→TS union / MV-view .existing() elle eklenir; GIN/GIST/EXCLUDE index DDL strip edilir (sahibi migration).
openssl genpkey -algorithm ed25519 -out ed25519-private.pem
openssl pkey -in ed25519-private.pem -pubout -out ed25519-public.pem
# PEM içeriğini AUTH_JWT_PRIVATE_KEY / AUTH_JWT_PUBLIC_KEY env'lerine koy.| Servis | Ne için | Faz |
|---|---|---|
| Supabase (mevcut) | Geçişte PG/Auth/Storage kaynağı + JWKS | P0 |
| Upstash Redis | BullMQ + throttler + presence | P3/P5 |
| Cloudflare R2 | Object storage (5 bucket + ekler-exports) | P4 |
| Neon | Hedef PG host | P7 |
| Resend | OTP email | P8 |
| Fly.io | web + worker host | P0 deploy |
| Sentry | hata izleme | P0 |
- P0 (devam) — workspace + Nest/Fastify skeleton + CoreModule guard zinciri + Drizzle provider + ScopedRepository iskeleti + AuthGuard Supabase JWKS bridge.
- P1 auth bridge + read-only catalog/me · P2 read feeds · P3 writes+moderation · P4 storage · P5 edge/jobs/push · P6 realtime · P7 DB cutover · P8 auth cutover · P9 decommission.