Files
dead-man-switch-2.0/memory-bank/systemPatterns.md
T

43 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# System Patterns - Dead Man Switch 2.0
## Mimari
```
┌─────────────────────────────────────────────────┐
│ Next.js App │
├─────────────────┬───────────────────────────────┤
│ Frontend │ API Routes │
│ (React + RSC) │ (Auth, CRUD, Cron) │
└────────┬────────┴───────────────┬───────────────┘
│ │
│ Web Crypto API │ Prisma
│ (encrypt/decrypt) │
│ ▼
│ ┌─────────────────┐
│ │ PostgreSQL │
│ └─────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ Cloudflare R2 │ │ Nodemailer │
│ (encrypted │ │ (SMTP) │
│ files) │ └─────────────────┘
└─────────────────┘
```
## Veritabanı Şeması (Draft)
- **User**: id, email, password, role, createdAt
- **Message**: id, userId, title, encryptedContent, isEncrypted, checkInInterval, lastCheckIn, nextDeadline, status
- **Recipient**: id, messageId, email, name
- **Attachment**: id, messageId, r2Key, encryptedName, size
## Güvenlik Patterns
- Şifreleme client-side (AES-256-GCM)
- Şifre hash'i sunucuya gönderilmez
- Derived key PBKDF2 ile üretilir
- Salt her mesaj için unique
## API Patterns
- REST endpoints under `/api/*`
- NextAuth session-based auth
- Zod validation