> For the complete documentation index, see [llms.txt](https://docs.kiloiot.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kiloiot.io/kilo-docs-de/kilo-center/kilo-mioty-service-center/getting-started/architecture-and-components.md).

# Architektur und Komponenten

KiloCenter-Architektur — vier Dienste (KC-Core, KC-Identity, KC-Gateway, KC-Web) plus Infrastruktur.

### Laufzeitdienste

KiloCenter läuft als vier zusammenarbeitende Dienste plus Infrastrukturabhängigkeiten:

* **KC-Core** -- MIOTY-Service-Center-Engine. Behandelt BSSCI (Basisstationsprotokoll) und SCACI (Anwendungszentrumsprotokoll), verarbeitet Uplink-/Downlink-Daten und stellt eine interne gRPC-API bereit.
* **KC-Identity** -- Identitäts- und Organisationsdienst. Bietet Benutzerauthentifizierung, Organisationsverwaltung, API-Schlüsselverwaltung und Mandantentrennung.
* **KC-Gateway** -- Externer API-Eingang. Bietet gRPC- und gRPC-web-Zugriff für KC-Web und externe Clients. Leitet Anfragen an KC-Core und KC-Identity weiter.
* **KC-Web** -- Browserbasierte Bedienoberfläche zur Verwaltung von Basisstationen, Endpunkten und zur Überwachung des Datenverkehrs. Im Container-Modus von nginx bereitgestellt.

### Bibliotheksmodule

Diese Module werden in die oben genannten Laufzeitdienste kompiliert und nicht als separate Container bereitgestellt:

* **KC-DB** -- Persistenzmodul, das von KC-Core und KC-Identity verwendet wird. Enthält Datenmodelle, Repository-Schnittstellen und PostgreSQL-Migrationen.
* **KC-MQTT** -- MQTT-Integrationsmodul, das von KC-Core verwendet wird. Veröffentlicht Uplink-Daten und Geräteereignisse auf MQTT-Themen.

### Infrastrukturabhängigkeiten

Alle Editionen erfordern:

* **PostgreSQL** -- primärer Datenspeicher für Nachrichten, Endpunktstatus und Konfiguration
* **Redis** -- Zwischenspeicherung und Sitzungspeicherung
* **Mosquitto** -- MQTT-Broker für Echtzeit-Datenstreaming an externe Verbraucher

### Komponentenbaum

```
KiloCenter
└── kilocenter-modules/
    ├── KC-Core/            - MIOTY-Service-Center-Engine
    ├── KC-Gateway/         - Externes gRPC-web-API-Gateway
    ├── KC-Web/             - Browser-Bedienoberfläche
    ├── KC-DB/              - Datenmodelle, Repositories, Migrationen
    ├── KC-MQTT/            - MQTT-Topic- und Dispatch-Integration
    ├── config/             - Laufzeit-Konfigurationsdateien
    ├── docker-compose.yml  - Container-Laufzeitdefinitionen
    └── deployments/docker/ - Mosquitto-, nginx- und Docker-Unterstützungsressourcen
```

### Datenpfad

1. MIOTY-Endpunkte übertragen Daten drahtlos.
2. Basisstationen empfangen Funkrahmen und verbinden sich über BSSCI (TCP mit TLS auf Port 5000) mit KC-Core.
3. KC-Core validiert Protokollrahmen, verwaltet Sitzungen und speichert Nachrichten dauerhaft über KC-DB.
4. KC-Gateway stellt die gRPC-web-API auf Port 9090 bereit und leitet Anfragen an KC-Core weiter.
5. KC-Web verbindet sich für alle Bediener-Workflows mit KC-Gateway (Container-Modus: nginx auf Port 80 leitet gRPC-web an KC-Gateway weiter).
6. Externe Systeme konsumieren Daten über gRPC (via KC-Gateway) oder MQTT (via Mosquitto).

### Dienst-Ports

| Dienst                         | Port  | Protokoll | Beschreibung                                      |
| ------------------------------ | ----- | --------- | ------------------------------------------------- |
| KC-Core (intern)               | 50051 | gRPC      | Interne API (nur KC-Gateway)                      |
| KC-Core (Health)               | 8086  | HTTP      | Health und Prometheus-Metriken                    |
| KC-Core (BSSCI)                | 5000  | TCP/TLS   | Ingress des Basisstationsprotokolls               |
| KC-Core (SCACI)                | 5001  | TCP/TLS   | Anwendungszentrumsprotokoll                       |
| KC-Identity (gRPC)             | 50052 | gRPC      | Nur intern (KC-Core/Gateway)                      |
| KC-Identity (Health)           | 8088  | HTTP      | Health des Identitätsdienstes                     |
| KC-Gateway                     | 9090  | gRPC-web  | Externer API-Ingress                              |
| KC-Gateway (Health)            | 8087  | HTTP      | Health-Endpunkt des Gateways                      |
| KC-Web (Container)             | 80    | HTTP      | nginx — stellt die SPA bereit, leitet gRPC weiter |
| KC-Web (Quellcode-Entwicklung) | 5173  | HTTP      | Vite-Entwicklungsserver                           |
| PostgreSQL                     | 5433  | TCP       | Datenbank (Docker-Host-Zuordnung)                 |
| Redis                          | 6379  | TCP       | Cache                                             |
| Mosquitto                      | 1883  | TCP       | MQTT-Broker                                       |

### Lokale Bereitstellungsmodi

* **Container-Modus** (empfohlen): `docker compose up --build -d` führt alle Dienste in Containern aus. KC-Web wird von nginx unter `http://localhost/`bereitgestellt. Keine Host-Toolchain außer Docker erforderlich.
* **Quellcode-Entwicklungsmodus**: Docker für Infrastrukturabhängigkeiten (postgres, redis, mosquitto); KC-Core, KC-Gateway und KC-Web werden aus dem Quellcode erstellt und ausgeführt. KC-Web verfügbar unter `http://localhost:5173`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kiloiot.io/kilo-docs-de/kilo-center/kilo-mioty-service-center/getting-started/architecture-and-components.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
