How nightscoutfoundation/xdrip works
Overview
Nightscout xDrip is a multi-module Android data hub and processor for glucose, treatment, insulin, activity, and device data. The README documents support for numerous CGMs, glucose meters, pumps, insulin pens, watches, follower phones, Nightscout, Tidepool, MongoDB, InfluxDB, AndroidAPS, and other companion apps. The repository is primarily an Android phone application with a separate Wear OS application and reusable integration modules.
Core components
• Android application shell and UI — app/src/main/java/com/eveningoutpost/dexdrip
Activities, services, receivers, widgets, preferences, notifications, and web-service endpoints form the main Android entry surface. app/src/main/AndroidManifest.xml defines the platform-facing component boundary.
• Domain models and local persistence — app/src/main/java/com/eveningoutpost/dexdrip/models
Domain records include glucose readings, calibrations, sensors, treatments, insulin, profiles, alerts, and device state. Database-facing tables are organized under app/src/main/java/com/eveningoutpost/dexdrip/tables; schema migrations are stored in app/src/main/assets/migrations. Preferences and key/value state are separately represented under app/src/main/java/com/eveningoutpost/dexdrip/store and app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels.
• Device acquisition and protocol adapters — app/src/main/java/com/eveningoutpost/dexdrip/services
Collection services and protocol packages cover Dexcom/G5/G6/G7, Libre, Medtrum, glucose meters, NFC, USB, and other Bluetooth devices. Supporting wire formats and protocol state are organized in cgm, g5model, glucosemeter, nfc, and importedlibraries.
• Processing, calibration, alerts, and therapy logic — app/src/main/java/com/eveningoutpost/dexdrip/calibrations
Calibration implementations, smoothing/filtering, glucose-quality evaluators, predictive behavior, alert polling, insulin curves, and treatment calculations are separated into the calibration, processing, evaluators, alert, and insulin packages.
• Cloud, follower, upload, and local-network interfaces — app/src/main/java/com/eveningoutpost/dexdrip/cloud
This area contains backup, peer/cloud messaging, and NightLite functionality. Related packages implement CareLink, Nightscout, Dexcom Share, web-follow, deposit, Tidepool, InfluxDB, Nocturne, and local web services. These are alternative external integrations rather than one mandatory backend.
• Wear companion — wear/src/main/java/com/eveningoutpost/dexdrip
The Wear module provides watch activities, watch faces, alerts, charts, collection services, persistent records, and phone synchronization. It contains overlapping domain and protocol code so supported watches can display or collect data independently where documented.
• Extension and integration modules — ipluginda/src/main/java/com/eveningoutpost/dexdrip/plugin
Separate modules provide a plugin interface, Locale/Tasker API support, GluPro BLE support, and Keks protocol code. These are optional integration boundaries, distinct from the main application path.
Relationships
Android lifecycle components expose the app to users and platform events, while acquisition services and external-follow clients provide incoming device or network data. Models and table/state packages own the durable representation of that data. Processing and calibration packages provide domain transformations used by presentation, alerts, and uploads. Cloud, web, broadcast, Tasker, and plugin packages expose selected data or commands to external actors. The Wear application is a companion consumer/producer connected through the repository’s wear-integration and message areas; exact call order is not established by the tree alone.
Public entry points and boundaries
Runtime entry points are Android manifest-declared activities, services, broadcast receivers, content/web-service components, widgets, and Wear components. External actors include CGM meters and pumps, companion apps, watches, Nightscout/Tidepool/cloud servers, and user automation tools. Configuration, credentials, permissions, and device availability are application/deployment inputs; this repository owns the adapters and processing implementations but not those external systems.
Main entry points: dexdrip Android shell and UI · models Domain models · calibrations Processing and therapy logic · cloud Cloud and network interfaces
Components 12
Android app
- Android shell and UI · Manifest-declared activities, services, receivers, widgets, notifications, and web endpoints.
app/src/main/java/com/eveningoutpost/dexdrip - Domain models
app/src/main/java/com/eveningoutpost/dexdrip/models - Tables and local persistence
app/src/main/java/com/eveningoutpost/dexdrip/tables - Preferences and state
app/src/main/java/com/eveningoutpost/dexdrip/store - Device acquisition · Collection services and device protocol adapters for glucose and related data.
app/src/main/java/com/eveningoutpost/dexdrip/services - Processing and therapy logic
app/src/main/java/com/eveningoutpost/dexdrip/calibrations - Cloud and network interfaces · Alternative upload, follower, backup, and local-network integrations.
app/src/main/java/com/eveningoutpost/dexdrip/cloud
Wear companion
- Wear application · Watch UI, collection, records, alerts, charts, and phone synchronization.
wear/src/main/java/com/eveningoutpost/dexdrip
Extensions
- Plugin integrations · Plugin, Locale/Tasker, GluPro BLE, and Keks integration boundaries.
ipluginda/src/main/java/com/eveningoutpost/dexdrip/plugin
External actors
- Devices and pumps
- Cloud and companion services
- Users and automation tools
Connections 13
- Devices and pumps → Device acquisition: sends data
- Cloud and companion services → Cloud and network interfaces: exchanges data
- Device acquisition → Domain models: produces records
- Domain models → Tables and local persistence: persists as
- Android shell and UI → Preferences and state: reads and writes
- Domain models → Processing and therapy logic: feeds
- Processing and therapy logic → Android shell and UI: supports presentation
- Processing and therapy logic → Cloud and network interfaces: supports uploads
- Android shell and UI → Users and automation tools: exposes interfaces
- Cloud and network interfaces → Cloud and companion services: uploads and follows
- Wear application → Android shell and UI: synchronizes with
- Plugin integrations → Android shell and UI: extends
- Plugin integrations → Users and automation tools: integrates with