Skip to content

NiceGUI dashboard for personal CGM monitoring insights. Connects to personal Nightscout instance, deploys with Docker.

License

Notifications You must be signed in to change notification settings

AlFontal/sugarboard

Repository files navigation

Sugarboard

Docker Ready Python 3.11 NiceGUI 2

Modern NiceGUI dashboard for personal Continuous Glucose Monitoring data powered by the Nightscout API. The project runs exclusively as a NiceGUI app and is designed to be deployed via Docker (compose or standalone).

sugarboard_screenshot

Quick Start (Docker Compose)

git clone https://github.com/AlFontal/sugarboard.git
cd sugarboard
docker-compose up -d --build

The NiceGUI server will be exposed on http://localhost:8080. Logs can be tailed with docker-compose logs -f sugarboard, and docker-compose down stops the stack. The compose file also mounts a named volume to persist cached CGM data between restarts.

Nightscout Credentials

When the dashboard loads, fill in the Nightscout Connection card with your base URL plus either:

  • Read token (recommended): create a read-only API token inside your Nightscout instance (Settings → API → Add Token). This grants GET access without exposing the master secret.
  • API secret: the classic admin secret string (we hash it and send it via the api-secret header). Only use this if you have tokens disabled.

Credentials stay on the server and are never rendered back to the browser. If you set the optional CGM_SITE environment variable, it simply pre-fills the base URL field for convenience.

Configuration

  • Runtime credentials: provided through the UI card described above.
  • STORAGE_SECRET: required for NiceGUI's secure server-side storage (set to any long random string).
  • RECENT_REQUEST_TIMEOUT: Nightscout API timeout in seconds (defaults to 60). Increase if your server responds slowly.
  • TZ: optional timezone for the container.
  • Cache persistence: by default a Docker volume named sugarboard-cache stores .cache/.
  • Credential persistence: another volume sugarboard-storage stores .nicegui/ so saved Nightscout credentials survive rebuilds.

Set the non-interactive settings in docker-compose.yml (see DOCKER.md for other deployment targets). The Nightscout token/secret should always be entered via the UI.

To keep secrets out of version control, place them in a local .env file (already git-ignored) and let Docker Compose load it:

python - <<'PY' > .env
from secrets import token_hex
print(f"STORAGE_SECRET={token_hex(32)}")
PY

Local Development (optional, without Docker)

If you still want to run it locally without containers, use the lightweight requirements file:

python -m venv venv
./venv/bin/pip install -r requirements.dev.txt
make run

The NiceGUI app binds to 0.0.0.0:8080. To use a different port, set PORT=9090 make run. Hot reload is enabled by default via the NICEGUI_RELOAD env var in the Makefile.

Developer tools

make lint        # black, isort, flake8
make test        # pytest + coverage (non-e2e)
make test-e2e    # e2e suite (requires running app)
make coverage    # serve coverage HTML report

The codebase no longer ships the historical Streamlit implementation. Check out an older branch/tag if you need it.

About

NiceGUI dashboard for personal CGM monitoring insights. Connects to personal Nightscout instance, deploys with Docker.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published