Kraft102 Claude Opus 4.5 commited on
Commit
ee754bd
Β·
1 Parent(s): 3581748

docs: add complete cloud architecture documentation

Browse files

- Full system architecture diagram (ASCII art)
- Component details for Frontend, Backend, Data Layer
- API endpoints documentation
- Environment secrets reference
- Deployment pipeline guide
- Tech stack overview

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. docs/ARCHITECTURE_CLOUDBORNE.md +400 -0
docs/ARCHITECTURE_CLOUDBORNE.md ADDED
@@ -0,0 +1,400 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WidgeTDC Cloud Architecture
2
+ ## "Operation Cloudborne" - Headless Ghost Deployment
3
+
4
+ **Version:** 1.0
5
+ **Dato:** 2025-12-13
6
+ **Status:** PRODUCTION LIVE
7
+
8
+ ---
9
+
10
+ ## 1. Arkitektur Oversigt
11
+
12
+ ```
13
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
14
+ β”‚ WIDGETDC CLOUD ARCHITECTURE β”‚
15
+ β”‚ "Headless Ghost" Pattern β”‚
16
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
17
+
18
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
19
+ β”‚ BRUGER/KLIENT β”‚
20
+ β”‚ (Browser/App) β”‚
21
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
22
+ β”‚ HTTPS
23
+ β–Ό
24
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
25
+ β”‚ FRONTEND LAYER β”‚
26
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
27
+ β”‚ β”‚ VERCEL (CDN Edge) β”‚ β”‚
28
+ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
29
+ β”‚ β”‚ β”‚ React 19 + Vite + Tailwind CSS v4 β”‚ β”‚ β”‚
30
+ β”‚ β”‚ β”‚ ──────────────────────────────────────── β”‚ β”‚ β”‚
31
+ β”‚ β”‚ β”‚ β€’ Matrix UI (Cyber Terminal) β”‚ β”‚ β”‚
32
+ β”‚ β”‚ β”‚ β€’ Widget System (Modular Components) β”‚ β”‚ β”‚
33
+ β”‚ β”‚ β”‚ β€’ Zustand State Management β”‚ β”‚ β”‚
34
+ β”‚ β”‚ β”‚ β€’ PWA Support (Offline-capable) β”‚ β”‚ β”‚
35
+ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
36
+ β”‚ β”‚ URL: https://widge-tdc-matrix-frontend.vercel.app β”‚ β”‚
37
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
38
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
39
+ β”‚
40
+ β”‚ REST API + WebSocket
41
+ β”‚ (CORS: origin: '*')
42
+ β–Ό
43
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
44
+ β”‚ BACKEND LAYER β”‚
45
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
46
+ β”‚ β”‚ HUGGING FACE SPACES (Docker) β”‚ β”‚
47
+ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
48
+ β”‚ β”‚ β”‚ Node.js 20 + Express + TypeScript β”‚ β”‚ β”‚
49
+ β”‚ β”‚ β”‚ ──────────────────────────────────────── β”‚ β”‚ β”‚
50
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
51
+ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€οΏ½οΏ½β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚
52
+ β”‚ β”‚ β”‚ β”‚ MCP Engine β”‚ β”‚ Cognitive β”‚ β”‚ Agent β”‚ β”‚ β”‚ β”‚
53
+ β”‚ β”‚ β”‚ β”‚ (63 Tools) β”‚ β”‚ Layer β”‚ β”‚ Orchestratorβ”‚ β”‚ β”‚ β”‚
54
+ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚
55
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
56
+ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚
57
+ β”‚ β”‚ β”‚ β”‚ HyperLog β”‚ β”‚ Ingestion β”‚ β”‚ Security β”‚ β”‚ β”‚ β”‚
58
+ β”‚ β”‚ β”‚ β”‚ (Events) β”‚ β”‚ Pipeline β”‚ β”‚ Layer β”‚ β”‚ β”‚ β”‚
59
+ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚
60
+ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
61
+ β”‚ β”‚ URL: https://kraft102-widgetdc-backend.hf.space β”‚ β”‚
62
+ β”‚ β”‚ Port: 7860 (HF Standard) β”‚ β”‚
63
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
64
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
65
+ β”‚
66
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
67
+ β”‚ β”‚ β”‚
68
+ β–Ό β–Ό β–Ό
69
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
70
+ β”‚ DATA LAYER β”‚
71
+ β”‚ β”‚
72
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
73
+ β”‚ β”‚ REDIS CLOUD β”‚ β”‚ NEO4J AURADB β”‚ β”‚ NEON POSTGRES β”‚ β”‚
74
+ β”‚ β”‚ (EU-North-1) β”‚ β”‚ (Cloud) β”‚ β”‚ (Serverless) β”‚ β”‚
75
+ β”‚ β”‚ ─────────────── β”‚ β”‚ ─────────────── β”‚ β”‚ ─────────────── β”‚ β”‚
76
+ β”‚ β”‚ β€’ Hot Cache β”‚ β”‚ β€’ Knowledge β”‚ β”‚ β€’ Vector Store β”‚ β”‚
77
+ β”‚ β”‚ β€’ Session State β”‚ β”‚ Graph β”‚ β”‚ (pgvector) β”‚ β”‚
78
+ β”‚ β”‚ β€’ Event Pub/Sub β”‚ β”‚ β€’ 4274 Nodes β”‚ β”‚ β€’ Prisma ORM β”‚ β”‚
79
+ β”‚ β”‚ β€’ Real-time β”‚ β”‚ β€’ 5252 Rels β”‚ β”‚ β€’ Structured β”‚ β”‚
80
+ β”‚ β”‚ Messaging β”‚ β”‚ β€’ Cypher Query β”‚ β”‚ Data β”‚ β”‚
81
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
82
+ β”‚ β”‚
83
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
84
+ β”‚
85
+ β–Ό
86
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
87
+ β”‚ AI/LLM LAYER β”‚
88
+ β”‚ β”‚
89
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
90
+ β”‚ β”‚ GEMINI β”‚ β”‚ OPENAI β”‚ β”‚ ANTHROPIC β”‚ β”‚ DEEPSEEK β”‚ β”‚
91
+ β”‚ β”‚ PRO β”‚ β”‚ GPT-4 β”‚ β”‚ CLAUDE β”‚ β”‚ V3 β”‚ β”‚
92
+ β”‚ β”‚ ────────── β”‚ β”‚ ────────── β”‚ β”‚ ────────── β”‚ β”‚ ────────── β”‚ β”‚
93
+ β”‚ β”‚ Primary AI β”‚ β”‚ Fallback β”‚ β”‚ Analysis β”‚ β”‚ Code Gen β”‚ β”‚
94
+ β”‚ β”‚ Reasoning β”‚ β”‚ Provider β”‚ β”‚ Tasks β”‚ β”‚ Tasks β”‚ β”‚
95
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
96
+ β”‚ β”‚
97
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
98
+ ```
99
+
100
+ ---
101
+
102
+ ## 2. Komponent Detaljer
103
+
104
+ ### 2.1 Frontend ("The Satellite")
105
+
106
+ | Attribut | Værdi |
107
+ |----------|-------|
108
+ | **Platform** | Vercel Edge Network |
109
+ | **Framework** | React 19 + Vite 5 |
110
+ | **Styling** | Tailwind CSS v4 |
111
+ | **State** | Zustand |
112
+ | **URL** | `https://widge-tdc-matrix-frontend.vercel.app` |
113
+
114
+ **Funktioner:**
115
+ - Cyber Terminal UI med widget-baseret dashboard
116
+ - Real-time data via REST/WebSocket
117
+ - PWA-enabled (offline support)
118
+ - Responsive design
119
+
120
+ **Environment Variables:**
121
+ ```
122
+ VITE_API_URL=https://kraft102-widgetdc-backend.hf.space
123
+ VITE_WS_URL=wss://kraft102-widgetdc-backend.hf.space
124
+ ```
125
+
126
+ ---
127
+
128
+ ### 2.2 Backend ("The Ghost")
129
+
130
+ | Attribut | Værdi |
131
+ |----------|-------|
132
+ | **Platform** | Hugging Face Spaces (Docker) |
133
+ | **Runtime** | Node.js 20-slim |
134
+ | **Framework** | Express.js + TypeScript |
135
+ | **Port** | 7860 |
136
+ | **URL** | `https://kraft102-widgetdc-backend.hf.space` |
137
+
138
+ **Arkitektur Lag:**
139
+
140
+ ```
141
+ apps/backend/src/
142
+ β”œβ”€β”€ mcp/ # Model Context Protocol
143
+ β”‚ β”œβ”€β”€ cognitive/ # AI Engines
144
+ β”‚ β”‚ β”œβ”€β”€ UnifiedGraphRAG.ts
145
+ β”‚ β”‚ β”œβ”€β”€ AutonomousTaskEngine.ts
146
+ β”‚ β”‚ β”œβ”€β”€ HybridSearchEngine.ts
147
+ β”‚ β”‚ β”œβ”€β”€ StateGraphRouter.ts
148
+ β”‚ β”‚ └── AgentTeam.ts
149
+ β”‚ β”œβ”€β”€ autonomous/ # Self-directed Agents
150
+ β”‚ └── memory/ # Cognitive Memory Systems
151
+ β”œβ”€β”€ platform/ # Infrastructure Adapters
152
+ β”‚ β”œβ”€β”€ embeddings/ # Vector Embeddings
153
+ β”‚ β”œβ”€β”€ vector/ # Vector Stores
154
+ β”‚ β”œβ”€β”€ events/ # Redis Event Bus
155
+ β”‚ └── graph/ # Neo4j Adapter
156
+ β”œβ”€β”€ services/ # Business Logic
157
+ β”‚ β”œβ”€β”€ hyper-log.ts # Event Streaming
158
+ β”‚ β”œβ”€β”€ ingestion/ # Data Pipeline (20+ adapters)
159
+ β”‚ └── external/ # External Integrations
160
+ └── routes/ # API Endpoints
161
+ ```
162
+
163
+ **MCP Tools (63 registreret):**
164
+ - `cma.*` - Context Memory Access
165
+ - `srag.*` - Semantic RAG Queries
166
+ - `autonomous.*` - Agent Operations
167
+ - `vidensarkiv.*` - Knowledge Archive
168
+ - `widgets.*` - Widget Control
169
+ - `ingestion.*` - Data Ingestion
170
+ - `docgen.*` - Document Generation
171
+
172
+ ---
173
+
174
+ ### 2.3 Data Layer
175
+
176
+ #### Redis Cloud (Hot Data)
177
+ | Attribut | Værdi |
178
+ |----------|-------|
179
+ | **Region** | EU-North-1 (Stockholm) |
180
+ | **Host** | `redis-16522.crce175.eu-north-1-1.ec2.cloud.redislabs.com` |
181
+ | **Port** | 16522 |
182
+ | **FormΓ₯l** | Cache, Sessions, Pub/Sub |
183
+
184
+ #### Neo4j AuraDB (Knowledge Graph)
185
+ | Attribut | Værdi |
186
+ |----------|-------|
187
+ | **Type** | Cloud Graph Database |
188
+ | **URI** | `neo4j+s://054eff27.databases.neo4j.io` |
189
+ | **Nodes** | 4,274 |
190
+ | **Relationships** | 5,252 |
191
+ | **FormΓ₯l** | Knowledge Graph, Entity Relations |
192
+
193
+ #### Neon PostgreSQL (Vector Store)
194
+ | Attribut | Værdi |
195
+ |----------|-------|
196
+ | **Type** | Serverless Postgres |
197
+ | **Region** | US-East-2 |
198
+ | **Extensions** | pgvector |
199
+ | **ORM** | Prisma |
200
+ | **FormΓ₯l** | Structured Data, Vector Search |
201
+
202
+ ---
203
+
204
+ ### 2.4 AI/LLM Providers
205
+
206
+ | Provider | API Key Env | Anvendelse |
207
+ |----------|-------------|------------|
208
+ | Google Gemini | `GOOGLE_AI_API_KEY` | Primary reasoning |
209
+ | OpenAI GPT-4 | `OPENAI_API_KEY` | Fallback, embeddings |
210
+ | Anthropic Claude | `ANTHROPIC_API_KEY` | Analysis tasks |
211
+ | DeepSeek V3 | `DEEPSEEK_API_KEY` | Code generation |
212
+
213
+ ---
214
+
215
+ ## 3. Dataflow
216
+
217
+ ```
218
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
219
+ β”‚ Browser │────▢│ Vercel │────▢│ HF Space│────▢│ DBs β”‚
220
+ β”‚ Request β”‚ β”‚ CDN β”‚ β”‚ Backend β”‚ β”‚ β”‚
221
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
222
+ β”‚ β”‚ β”‚
223
+ β”‚ β–Ό β”‚
224
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
225
+ β”‚ β”‚ MCP Router β”‚ β”‚
226
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚
227
+ β”‚ β”‚ β”‚
228
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
229
+ β”‚ β–Ό β–Ό β–Ό
230
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
231
+ β”‚ β”‚ Cognitive β”‚ β”‚ Redis β”‚ β”‚ Neo4j β”‚
232
+ β”‚ β”‚ Engine β”‚ β”‚ Cache β”‚ β”‚ Graph β”‚
233
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
234
+ β”‚ β”‚
235
+ β”‚ β–Ό
236
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
237
+ β”‚ β”‚ AI/LLM β”‚
238
+ β”‚ β”‚ Providers β”‚
239
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
240
+ β”‚ β”‚
241
+ β—€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
242
+ Response
243
+ ```
244
+
245
+ ---
246
+
247
+ ## 4. API Endpoints
248
+
249
+ ### Health & Status
250
+ ```
251
+ GET /health # System health
252
+ GET /api/hyper/status # HyperLog status
253
+ GET /api/evolution/graph/stats # Graph statistics
254
+ ```
255
+
256
+ ### MCP Protocol
257
+ ```
258
+ GET /api/mcp/tools # List all tools (63)
259
+ POST /api/mcp/route # Execute MCP tool
260
+ WS /mcp/ws # WebSocket connection
261
+ ```
262
+
263
+ ### Agent Operations
264
+ ```
265
+ POST /api/team/delegate # Delegate task to agent
266
+ GET /api/team/tasks # List agent tasks
267
+ POST /api/team/plan # Create execution plan
268
+ GET /api/team/status # Agent team status
269
+ ```
270
+
271
+ ### Knowledge & Search
272
+ ```
273
+ POST /api/srag/query # Semantic RAG search
274
+ GET /api/knowledge/* # Knowledge endpoints
275
+ POST /api/vidensarkiv/search # Archive search
276
+ ```
277
+
278
+ ---
279
+
280
+ ## 5. Environment Secrets (HF Spaces)
281
+
282
+ | Secret | Status | FormΓ₯l |
283
+ |--------|--------|--------|
284
+ | `DATABASE_URL` | βœ… | Neon PostgreSQL connection |
285
+ | `NEO4J_URI` | βœ… | AuraDB endpoint |
286
+ | `NEO4J_USER` | βœ… | AuraDB username |
287
+ | `NEO4J_PASSWORD` | βœ… | AuraDB password |
288
+ | `REDIS_URL` | βœ… | Redis Cloud connection |
289
+ | `GOOGLE_AI_API_KEY` | βœ… | Gemini API |
290
+ | `OPENAI_API_KEY` | βœ… | OpenAI API |
291
+ | `ANTHROPIC_API_KEY` | βœ… | Claude API |
292
+ | `JWT_SECRET` | βœ… | Auth tokens |
293
+
294
+ ---
295
+
296
+ ## 6. Deployment Pipeline
297
+
298
+ ```
299
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
300
+ β”‚ GitHub │────▢│ Build │────▢│ Deploy β”‚
301
+ β”‚ Push β”‚ β”‚ (Docker) β”‚ β”‚ (HF/Vercel)β”‚
302
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
303
+ β”‚ β”‚ β”‚
304
+ β”‚ β”‚ β”‚
305
+ β–Ό β–Ό β–Ό
306
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
307
+ β”‚ Branch: hf-minimal β”‚
308
+ β”‚ ─────────────────── β”‚
309
+ β”‚ β€’ Backend β†’ push to 'hf' remote β†’ HF Spaces β”‚
310
+ β”‚ β€’ Frontend β†’ auto-deploy from GitHub β†’ Vercel β”‚
311
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
312
+ ```
313
+
314
+ ### Deploy Commands
315
+ ```bash
316
+ # Backend til HF Spaces
317
+ git push hf hf-minimal:main
318
+
319
+ # Frontend til Vercel (auto via GitHub)
320
+ git push origin hf-minimal
321
+ ```
322
+
323
+ ---
324
+
325
+ ## 7. Sikkerhed
326
+
327
+ ### CORS Configuration
328
+ ```typescript
329
+ app.use(cors({
330
+ origin: '*', // Γ…ben for alle origins (kan strammes)
331
+ methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
332
+ allowedHeaders: ['Content-Type', 'Authorization']
333
+ }));
334
+ ```
335
+
336
+ ### Authentication
337
+ - JWT-baseret authentication
338
+ - Bearer tokens via `Authorization` header
339
+ - Secret: `JWT_SECRET` environment variable
340
+
341
+ ### GDPR Compliance
342
+ - Data minimization i audit logs
343
+ - Kun IDs/metadata logges
344
+ - Retention policies implementeret
345
+
346
+ ---
347
+
348
+ ## 8. Monitorering
349
+
350
+ ### Health Checks
351
+ ```bash
352
+ # Backend health
353
+ curl https://kraft102-widgetdc-backend.hf.space/health
354
+
355
+ # Graph stats
356
+ curl https://kraft102-widgetdc-backend.hf.space/api/evolution/graph/stats
357
+
358
+ # MCP tools count
359
+ curl https://kraft102-widgetdc-backend.hf.space/api/mcp/tools
360
+ ```
361
+
362
+ ### HF Spaces Docker Health
363
+ ```dockerfile
364
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
365
+ CMD node -e "require('http').get('http://localhost:7860/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"
366
+ ```
367
+
368
+ ---
369
+
370
+ ## 9. Live URLs
371
+
372
+ | Komponent | URL | Status |
373
+ |-----------|-----|--------|
374
+ | Frontend | https://widge-tdc-matrix-frontend.vercel.app | βœ… LIVE |
375
+ | Backend | https://kraft102-widgetdc-backend.hf.space | βœ… LIVE |
376
+ | Health | https://kraft102-widgetdc-backend.hf.space/health | βœ… OK |
377
+ | API Docs | https://kraft102-widgetdc-backend.hf.space/api/mcp/tools | βœ… 63 tools |
378
+
379
+ ---
380
+
381
+ ## 10. Teknologi Stack Oversigt
382
+
383
+ ```
384
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
385
+ β”‚ WIDGETDC TECH STACK β”‚
386
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
387
+ β”‚ FRONTEND β”‚ React 19, Vite 5, Tailwind v4, Zustand β”‚
388
+ β”‚ BACKEND β”‚ Node.js 20, Express, TypeScript 5.8 β”‚
389
+ β”‚ DATABASES β”‚ PostgreSQL+pgvector, Neo4j 5, Redis 7 β”‚
390
+ β”‚ AI/LLM β”‚ Gemini, OpenAI, Claude, DeepSeek β”‚
391
+ β”‚ HOSTING β”‚ Vercel (FE), Hugging Face Spaces (BE) β”‚
392
+ β”‚ PROTOCOL β”‚ MCP (Model Context Protocol) β”‚
393
+ β”‚ ARCHITECTURE β”‚ Microservices, Event-Driven β”‚
394
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
395
+ ```
396
+
397
+ ---
398
+
399
+ *Genereret: 2025-12-13*
400
+ *Operation Cloudborne v1.0*