How krishna99-tech/thingsnxtplatform works
ThingsNXT is a Python IoT backend for user, device, telemetry, dashboard, and administration workflows. A client reaches the FastAPI application through its gateway, authenticates, and uses device APIs to manage devices and submit telemetry; device routes apply rules, persist updates, and support live delivery. MQTT provides a device-facing bridge, while Kafka provides an authenticated telemetry feed. The source excerpts and index support the main routing and integration structure, but several modules were not sampled; their placement is shown without asserting unverified call paths.
Main entry points: device_routes.py Device and telemetry APIs · api_gateway.py API gateway · db.py MongoDB · websocket_routes.py WebSocket API
Components 22
API entry
- FastAPI app
main.py - API gateway
api_gateway.py
Identity and administration
- Authentication
auth_routes.py - Administration
admin_routes.py - App configuration
app_config_routes.py
IoT domain
- Device and telemetry APIs
device_routes.py - Access rules
rules_engine.py - IoT algorithms
iot_algorithms.py - Domain models
models.py - Request schemas
schemas.py
Live integrations
- MQTT bridge
mqtt_service.py - Kafka API
integrations_kafka_routes.py - Kafka service
kafka_service.py - Kafka live feed
kafka_feed_manager.py - WebSocket API
websocket_routes.py - WebSocket manager
websocket_manager.py - Event routes
events.py - SSE event manager
event_manager.py
Persistence
- MongoDB
db.py
Other components
- API clients
- MQTT broker
- Kafka broker
Connections 29
- API clients → FastAPI app: sends requests
- FastAPI app → API gateway: mounts routes
main.py - FastAPI app → Administration: mounts routes
main.py - API gateway → Authentication: registers routes
api_gateway.py - API gateway → Device and telemetry APIs: registers routes
api_gateway.py - API gateway → WebSocket API: registers routes
api_gateway.py - API gateway → Event routes: registers routes
api_gateway.py - API gateway → Kafka API: registers routes
api_gateway.py - Authentication → MongoDB: reads and writes
auth_routes.py - Administration → MongoDB: reads and writes
admin_routes.py - App configuration → MongoDB: uses database
app_config_routes.py - Device and telemetry APIs → MongoDB: reads and writes
device_routes.py - Device and telemetry APIs → Access rules: checks access
device_routes.py - Device and telemetry APIs → WebSocket manager: broadcasts updates
device_routes.py - Device and telemetry APIs → MQTT bridge: uses bridge
device_routes.py - Device and telemetry APIs → Kafka service: publishes telemetry
device_routes.py - Device and telemetry APIs → IoT algorithms: uses algorithms
device_routes.py - Device and telemetry APIs → Domain models: uses models
device_routes.py - Device and telemetry APIs → Request schemas: uses schemas
- MQTT bridge → MQTT broker: publishes and subscribes
mqtt_service.py - MQTT bridge → Device and telemetry APIs: forwards telemetry
mqtt_service.py - Kafka API → Authentication: requires authentication
integrations_kafka_routes.py - Kafka API → Kafka service: requests feed and stats
integrations_kafka_routes.py - Kafka service → Kafka broker: produces and consumes
kafka_service.py - Kafka service → Kafka live feed: broadcasts records
kafka_service.py - WebSocket API → Authentication: validates tokens
- WebSocket API → MongoDB: checks users
websocket_routes.py - WebSocket API → WebSocket manager: registers connections
websocket_routes.py - Event routes → SSE event manager: uses event stream