Revise diagrams and data flow for Happy and HAPI

Updated diagrams and data flow descriptions for Happy and HAPI models in WHY_NOT_HAPPY.md.
This commit is contained in:
weishu
2025-12-25 20:40:36 +08:00
committed by GitHub
parent 6dc80f14bc
commit d083a73cb0
+58 -58
View File
@@ -24,48 +24,48 @@ HAPI's local-first design simplifies everything:
```
┌─────────────────────────────────────────────────────────────────────────────────┐
│ PUBLIC INTERNET
│ ┌─────────────┐ ┌─────────────────────────────────┐
│ │ │ │
│ │ Mobile App │◄─────── E2EE ───────►│ Cloud Server
│ │ │ │
│ └─────────────┘ │ ┌───────────────────────────┐ │
│ │ │ │ │
│ │ │ Encrypted Database │ │
│ │ │ (server cannot read) │ │
│ │ │ │ │
│ │ └───────────────────────────┘ │
│ │
│ └────────────────┬────────────────┘
│ │
│ │ E2EE
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
│ PUBLIC INTERNET │
│ │
│ │
│ ┌─────────────┐ ┌─────────────────────────────────┐ │
│ │ │ │
│ │ Mobile App │◄─────── E2EE ───────►│ Cloud Server
│ │ │ │
│ └─────────────┘ │ ┌───────────────────────────┐ │ │
│ │ │ │ │ │
│ │ │ Encrypted Database │ │ │
│ │ │ (server cannot read) │ │ │
│ │ │ │ │ │
│ │ └───────────────────────────┘ │ │
│ │
│ └────────────────┬────────────────┘ │
│ │ │
│ │ E2EE │
│ │ │
└─────────────────────────────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────────┼─────────────────────┐
│ PRIVATE NETWORK │
│ │
│ ▼
┌──────────────────────────────────────────────────────────────┼─────────────────────┐
│ PRIVATE NETWORK │ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────┐ │
│ │ │ │
│ │ CLI │ │
│ │ │ │
│ │ │ │
│ │ CLI │ │
│ │ │ │
│ │ ┌────────────────────────────────────┐ │ │
│ │ │ Encryption Keys │ │ │
│ │ │ (only client holds the keys) │ │ │
│ │ │ Encryption Keys │ │ │
│ │ │ (only client holds the keys) │ │ │
│ │ └────────────────────────────────────┘ │ │
│ │ │ │
│ │ │ │
│ └──────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────────────┘
│ │
└──────────────────────────────────────────────────────────────────────────────────
Data Flow:
┌──────────────────────────────────────────────────────────────────────────────────┐
┌────────────────────────────────────────────────────────────────────────────────────
│ │
│ CLI ◄───────► Cloud Server ◄───────► App │
│ CLI ◄───────► Cloud Server ◄───────► App
│ │ │ │ │
│ │ (encrypt) │ (ciphertext) │ (decrypt) │
│ ▼ ▼ ▼ │
@@ -76,24 +76,24 @@ Data Flow:
│ encrypted blobs │
│ (zero knowledge) │
│ │
└──────────────────────────────────────────────────────────────────────────────────┘
└────────────────────────────────────────────────────────────────────────────────────
```
### HAPI: Local-First
```
┌──────────────────────────────────────────────────────────────────────────────────┐
┌────────────────────────────────────────────────────────────────────────────────────
│ PRIVATE NETWORK │
│ │
│ ┌────────────────────────────────────────────────────────────────────────┐ │
│ ┌──────────────────────────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ Single Process / Binary │ │
│ │ │ │
│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ CLI │◄──►│ Server │◄──►│ Web App │ │ │
│ │ │ │ │ │ │ (embedded) │ │ │
│ │ └──────────────┘ └──────┬───────┘ └──────────────┘ │ │
│ │ └──────────────┘ └──────┬───────┘ └──────────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌────────────────┐ │ │
@@ -103,37 +103,37 @@ Data Flow:
│ │ │ │ │ │
│ │ └────────────────┘ │ │
│ │ │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
│ └──────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ │ localhost │
└────────────────────────────────────────┼─────────────────────────────────────────┘
└────────────────────────────────────────┼───────────────────────────────────────────
┌────────────────────────────────────────────────────────────────────────────────┐
┌───────────────────────────────────────────────────────────────────────────────────
│ TUNNEL (Optional) │
│ │
│ localhost ────────► public URL (TLS) │
│ │
└────────────────────────────────────────┬────────────────────────────────────────┘
└────────────────────────────────────────┬──────────────────────────────────────────
┌────────────────────────────────────────────────────────────────────────────────┐
┌───────────────────────────────────────────────────────────────────────────────────
│ PUBLIC INTERNET │
│ │
│ ┌───────────────────────────────┐ │
│ ┌───────────────────────────────┐
│ │ │ │
│ │ Remote Clients │ │
│ │ (PWA / Mini App) │ │
│ │ │ │
│ └───────────────────────────────┘ │
│ └───────────────────────────────┘
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
└───────────────────────────────────────────────────────────────────────────────────
Data Flow:
┌──────────────────────────────────────────────────────────────────────────────────┐
┌────────────────────────────────────────────────────────────────────────────────────
│ │
│ CLI ◄────────► Server ◄────────► App │
│ CLI ◄────────► Server ◄────────► App
│ │ │
│ │ (same machine / process) │
│ ▼ │
@@ -145,7 +145,7 @@ Data Flow:
│ external access │
│ (TLS encryption) │
│ │
└──────────────────────────────────────────────────────────────────────────────────┘
└────────────────────────────────────────────────────────────────────────────────────
```
---
@@ -164,30 +164,30 @@ Data Flow:
```
Happy:
┌─────────────────────────────────────────────────────────────────────┐
┌───────────────────────────────────────────────────────────────────────
│ │
│ Distributed Services (4+ components) │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
│ │ Database │ │ Cache │ │ Storage │ │ Server │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘
│ │
│ Requires: Container orchestration, multiple config files │
│ │
└─────────────────────────────────────────────────────────────────────┘
└───────────────────────────────────────────────────────────────────────
HAPI:
┌─────────────────────────────────────────────────────────────────────┐
┌───────────────────────────────────────────────────────────────────────
│ │
│ Single Binary (everything bundled) │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ CLI + Server + Web App + Database (embedded)
│ └─────────────────────────────────────────────────────────────┘ │
│ ┌─────────────────────────────────────────────────────────────┐
│ │ CLI + Server + Web App + Database (embedded)
│ └─────────────────────────────────────────────────────────────┘
│ │
│ Requires: One command to run │
│ │
└─────────────────────────────────────────────────────────────────────┘
└───────────────────────────────────────────────────────────────────────
```
### 2.3 Security Approach