mirror of
https://github.com/yusufipk/dead-man-switch-2.0.git
synced 2026-09-11 09:26:07 +00:00
43 lines
2.0 KiB
Markdown
43 lines
2.0 KiB
Markdown
# 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
|