File size: 21,859 Bytes
ee754bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# WidgeTDC Cloud Architecture
## "Operation Cloudborne" - Headless Ghost Deployment

**Version:** 1.0
**Dato:** 2025-12-13
**Status:** PRODUCTION LIVE

---

## 1. Arkitektur Oversigt

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         WIDGETDC CLOUD ARCHITECTURE                         β”‚
β”‚                          "Headless Ghost" Pattern                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                              β”‚   BRUGER/KLIENT  β”‚
                              β”‚  (Browser/App)   β”‚
                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚ HTTPS
                                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              FRONTEND LAYER                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                         VERCEL (CDN Edge)                              β”‚  β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚
β”‚  β”‚  β”‚  React 19 + Vite + Tailwind CSS v4                               β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  ────────────────────────────────────────                        β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β€’ Matrix UI (Cyber Terminal)                                    β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β€’ Widget System (Modular Components)                            β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β€’ Zustand State Management                                      β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β€’ PWA Support (Offline-capable)                                 β”‚  β”‚  β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚
β”‚  β”‚  URL: https://widge-tdc-matrix-frontend.vercel.app                     β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚
                                       β”‚ REST API + WebSocket
                                       β”‚ (CORS: origin: '*')
                                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              BACKEND LAYER                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                   HUGGING FACE SPACES (Docker)                         β”‚  β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚
β”‚  β”‚  β”‚  Node.js 20 + Express + TypeScript                               β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  ────────────────────────────────────────                        β”‚  β”‚  β”‚
β”‚  β”‚  β”‚                                                                  β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β”‚ MCP Engine  β”‚  β”‚  Cognitive  β”‚  β”‚   Agent     β”‚               β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β”‚ (63 Tools)  β”‚  β”‚   Layer     β”‚  β”‚ Orchestratorβ”‚               β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚  β”‚  β”‚
β”‚  β”‚  β”‚                                                                  β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β”‚  HyperLog   β”‚  β”‚  Ingestion  β”‚  β”‚  Security   β”‚               β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β”‚  (Events)   β”‚  β”‚  Pipeline   β”‚  β”‚   Layer     β”‚               β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚  β”‚  β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚
β”‚  β”‚  URL: https://kraft102-widgetdc-backend.hf.space                       β”‚  β”‚
β”‚  β”‚  Port: 7860 (HF Standard)                                              β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚                 β”‚                 β”‚
                     β–Ό                 β–Ό                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              DATA LAYER                                      β”‚
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”‚
β”‚  β”‚   REDIS CLOUD    β”‚  β”‚  NEO4J AURADB    β”‚  β”‚  NEON POSTGRES   β”‚           β”‚
β”‚  β”‚   (EU-North-1)   β”‚  β”‚   (Cloud)        β”‚  β”‚  (Serverless)    β”‚           β”‚
β”‚  β”‚  ───────────────  β”‚  β”‚  ───────────────  β”‚  β”‚  ───────────────  β”‚           β”‚
β”‚  β”‚  β€’ Hot Cache     β”‚  β”‚  β€’ Knowledge     β”‚  β”‚  β€’ Vector Store  β”‚           β”‚
β”‚  β”‚  β€’ Session State β”‚  β”‚    Graph         β”‚  β”‚    (pgvector)    β”‚           β”‚
β”‚  β”‚  β€’ Event Pub/Sub β”‚  β”‚  β€’ 4274 Nodes    β”‚  β”‚  β€’ Prisma ORM    β”‚           β”‚
β”‚  β”‚  β€’ Real-time     β”‚  β”‚  β€’ 5252 Rels     β”‚  β”‚  β€’ Structured    β”‚           β”‚
β”‚  β”‚    Messaging     β”‚  β”‚  β€’ Cypher Query  β”‚  β”‚    Data          β”‚           β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚
                                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              AI/LLM LAYER                                    β”‚
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚  β”‚   GEMINI     β”‚  β”‚   OPENAI     β”‚  β”‚  ANTHROPIC   β”‚  β”‚  DEEPSEEK    β”‚     β”‚
β”‚  β”‚   PRO        β”‚  β”‚   GPT-4      β”‚  β”‚   CLAUDE     β”‚  β”‚   V3         β”‚     β”‚
β”‚  β”‚  ──────────  β”‚  β”‚  ──────────  β”‚  β”‚  ──────────  β”‚  β”‚  ──────────  β”‚     β”‚
β”‚  β”‚  Primary AI  β”‚  β”‚  Fallback    β”‚  β”‚  Analysis    β”‚  β”‚  Code Gen    β”‚     β”‚
β”‚  β”‚  Reasoning   β”‚  β”‚  Provider    β”‚  β”‚  Tasks       β”‚  β”‚  Tasks       β”‚     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## 2. Komponent Detaljer

### 2.1 Frontend ("The Satellite")

| Attribut | Værdi |
|----------|-------|
| **Platform** | Vercel Edge Network |
| **Framework** | React 19 + Vite 5 |
| **Styling** | Tailwind CSS v4 |
| **State** | Zustand |
| **URL** | `https://widge-tdc-matrix-frontend.vercel.app` |

**Funktioner:**
- Cyber Terminal UI med widget-baseret dashboard
- Real-time data via REST/WebSocket
- PWA-enabled (offline support)
- Responsive design

**Environment Variables:**
```
VITE_API_URL=https://kraft102-widgetdc-backend.hf.space
VITE_WS_URL=wss://kraft102-widgetdc-backend.hf.space
```

---

### 2.2 Backend ("The Ghost")

| Attribut | Værdi |
|----------|-------|
| **Platform** | Hugging Face Spaces (Docker) |
| **Runtime** | Node.js 20-slim |
| **Framework** | Express.js + TypeScript |
| **Port** | 7860 |
| **URL** | `https://kraft102-widgetdc-backend.hf.space` |

**Arkitektur Lag:**

```
apps/backend/src/
β”œβ”€β”€ mcp/                    # Model Context Protocol
β”‚   β”œβ”€β”€ cognitive/          # AI Engines
β”‚   β”‚   β”œβ”€β”€ UnifiedGraphRAG.ts
β”‚   β”‚   β”œβ”€β”€ AutonomousTaskEngine.ts
β”‚   β”‚   β”œβ”€β”€ HybridSearchEngine.ts
β”‚   β”‚   β”œβ”€β”€ StateGraphRouter.ts
β”‚   β”‚   └── AgentTeam.ts
β”‚   β”œβ”€β”€ autonomous/         # Self-directed Agents
β”‚   └── memory/             # Cognitive Memory Systems
β”œβ”€β”€ platform/               # Infrastructure Adapters
β”‚   β”œβ”€β”€ embeddings/         # Vector Embeddings
β”‚   β”œβ”€β”€ vector/             # Vector Stores
β”‚   β”œβ”€β”€ events/             # Redis Event Bus
β”‚   └── graph/              # Neo4j Adapter
β”œβ”€β”€ services/               # Business Logic
β”‚   β”œβ”€β”€ hyper-log.ts        # Event Streaming
β”‚   β”œβ”€β”€ ingestion/          # Data Pipeline (20+ adapters)
β”‚   └── external/           # External Integrations
└── routes/                 # API Endpoints
```

**MCP Tools (63 registreret):**
- `cma.*` - Context Memory Access
- `srag.*` - Semantic RAG Queries
- `autonomous.*` - Agent Operations
- `vidensarkiv.*` - Knowledge Archive
- `widgets.*` - Widget Control
- `ingestion.*` - Data Ingestion
- `docgen.*` - Document Generation

---

### 2.3 Data Layer

#### Redis Cloud (Hot Data)
| Attribut | Værdi |
|----------|-------|
| **Region** | EU-North-1 (Stockholm) |
| **Host** | `redis-16522.crce175.eu-north-1-1.ec2.cloud.redislabs.com` |
| **Port** | 16522 |
| **FormΓ₯l** | Cache, Sessions, Pub/Sub |

#### Neo4j AuraDB (Knowledge Graph)
| Attribut | Værdi |
|----------|-------|
| **Type** | Cloud Graph Database |
| **URI** | `neo4j+s://054eff27.databases.neo4j.io` |
| **Nodes** | 4,274 |
| **Relationships** | 5,252 |
| **FormΓ₯l** | Knowledge Graph, Entity Relations |

#### Neon PostgreSQL (Vector Store)
| Attribut | Værdi |
|----------|-------|
| **Type** | Serverless Postgres |
| **Region** | US-East-2 |
| **Extensions** | pgvector |
| **ORM** | Prisma |
| **FormΓ₯l** | Structured Data, Vector Search |

---

### 2.4 AI/LLM Providers

| Provider | API Key Env | Anvendelse |
|----------|-------------|------------|
| Google Gemini | `GOOGLE_AI_API_KEY` | Primary reasoning |
| OpenAI GPT-4 | `OPENAI_API_KEY` | Fallback, embeddings |
| Anthropic Claude | `ANTHROPIC_API_KEY` | Analysis tasks |
| DeepSeek V3 | `DEEPSEEK_API_KEY` | Code generation |

---

## 3. Dataflow

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Browser │────▢│ Vercel  │────▢│ HF Space│────▢│   DBs   β”‚
β”‚ Request β”‚     β”‚   CDN   β”‚     β”‚ Backend β”‚     β”‚         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚                               β”‚               β”‚
     β”‚                               β–Ό               β”‚
     β”‚                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
     β”‚                        β”‚  MCP Router β”‚        β”‚
     β”‚                        β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜        β”‚
     β”‚                               β”‚               β”‚
     β”‚               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
     β”‚               β–Ό               β–Ό               β–Ό
     β”‚        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚        β”‚ Cognitive β”‚   β”‚   Redis   β”‚   β”‚   Neo4j   β”‚
     β”‚        β”‚  Engine   β”‚   β”‚   Cache   β”‚   β”‚   Graph   β”‚
     β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚               β”‚
     β”‚               β–Ό
     β”‚        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚        β”‚  AI/LLM   β”‚
     β”‚        β”‚ Providers β”‚
     β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚               β”‚
     β—€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
   Response
```

---

## 4. API Endpoints

### Health & Status
```
GET  /health                    # System health
GET  /api/hyper/status          # HyperLog status
GET  /api/evolution/graph/stats # Graph statistics
```

### MCP Protocol
```
GET  /api/mcp/tools             # List all tools (63)
POST /api/mcp/route             # Execute MCP tool
WS   /mcp/ws                    # WebSocket connection
```

### Agent Operations
```
POST /api/team/delegate         # Delegate task to agent
GET  /api/team/tasks            # List agent tasks
POST /api/team/plan             # Create execution plan
GET  /api/team/status           # Agent team status
```

### Knowledge & Search
```
POST /api/srag/query            # Semantic RAG search
GET  /api/knowledge/*           # Knowledge endpoints
POST /api/vidensarkiv/search    # Archive search
```

---

## 5. Environment Secrets (HF Spaces)

| Secret | Status | FormΓ₯l |
|--------|--------|--------|
| `DATABASE_URL` | βœ… | Neon PostgreSQL connection |
| `NEO4J_URI` | βœ… | AuraDB endpoint |
| `NEO4J_USER` | βœ… | AuraDB username |
| `NEO4J_PASSWORD` | βœ… | AuraDB password |
| `REDIS_URL` | βœ… | Redis Cloud connection |
| `GOOGLE_AI_API_KEY` | βœ… | Gemini API |
| `OPENAI_API_KEY` | βœ… | OpenAI API |
| `ANTHROPIC_API_KEY` | βœ… | Claude API |
| `JWT_SECRET` | βœ… | Auth tokens |

---

## 6. Deployment Pipeline

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   GitHub    │────▢│   Build     │────▢│  Deploy     β”‚
β”‚   Push      β”‚     β”‚   (Docker)  β”‚     β”‚  (HF/Vercel)β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                   β”‚                   β”‚
       β”‚                   β”‚                   β”‚
       β–Ό                   β–Ό                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Branch: hf-minimal                                 β”‚
β”‚  ───────────────────                                β”‚
β”‚  β€’ Backend β†’ push to 'hf' remote β†’ HF Spaces        β”‚
β”‚  β€’ Frontend β†’ auto-deploy from GitHub β†’ Vercel      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

### Deploy Commands
```bash
# Backend til HF Spaces
git push hf hf-minimal:main

# Frontend til Vercel (auto via GitHub)
git push origin hf-minimal
```

---

## 7. Sikkerhed

### CORS Configuration
```typescript
app.use(cors({
  origin: '*',  // Γ…ben for alle origins (kan strammes)
  methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
  allowedHeaders: ['Content-Type', 'Authorization']
}));
```

### Authentication
- JWT-baseret authentication
- Bearer tokens via `Authorization` header
- Secret: `JWT_SECRET` environment variable

### GDPR Compliance
- Data minimization i audit logs
- Kun IDs/metadata logges
- Retention policies implementeret

---

## 8. Monitorering

### Health Checks
```bash
# Backend health
curl https://kraft102-widgetdc-backend.hf.space/health

# Graph stats
curl https://kraft102-widgetdc-backend.hf.space/api/evolution/graph/stats

# MCP tools count
curl https://kraft102-widgetdc-backend.hf.space/api/mcp/tools
```

### HF Spaces Docker Health
```dockerfile
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
    CMD node -e "require('http').get('http://localhost:7860/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"
```

---

## 9. Live URLs

| Komponent | URL | Status |
|-----------|-----|--------|
| Frontend | https://widge-tdc-matrix-frontend.vercel.app | βœ… LIVE |
| Backend | https://kraft102-widgetdc-backend.hf.space | βœ… LIVE |
| Health | https://kraft102-widgetdc-backend.hf.space/health | βœ… OK |
| API Docs | https://kraft102-widgetdc-backend.hf.space/api/mcp/tools | βœ… 63 tools |

---

## 10. Teknologi Stack Oversigt

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    WIDGETDC TECH STACK                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ FRONTEND          β”‚ React 19, Vite 5, Tailwind v4, Zustand β”‚
β”‚ BACKEND           β”‚ Node.js 20, Express, TypeScript 5.8    β”‚
β”‚ DATABASES         β”‚ PostgreSQL+pgvector, Neo4j 5, Redis 7  β”‚
β”‚ AI/LLM            β”‚ Gemini, OpenAI, Claude, DeepSeek       β”‚
β”‚ HOSTING           β”‚ Vercel (FE), Hugging Face Spaces (BE)  β”‚
β”‚ PROTOCOL          β”‚ MCP (Model Context Protocol)           β”‚
β”‚ ARCHITECTURE      β”‚ Microservices, Event-Driven            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

*Genereret: 2025-12-13*
*Operation Cloudborne v1.0*