-
Notifications
You must be signed in to change notification settings - Fork 1
Development Setup
delabrcd edited this page Jun 6, 2026
·
2 revisions
Just Docker + the Docker Compose plugin. You do not need Node, Postgres, or Playwright on your host — everything builds and runs in containers (the scraper needs Chromium + system libs that the Playwright base image already provides).
git clone https://github.com/delabrcd/ngrid-dashboard && cd ngrid-dashboard
cp .env.example .env # set NGRID_USER / NGRID_PASS and a DB_PASSWORD
# build locally instead of pulling the published image:
docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --buildOpen http://localhost:3000 and click Check for new bills (first run logs in, pulls your full history + PDFs — a couple of minutes).
The default
docker-compose.ymlis pull-only (it grabs the GHCR image). Use thedocker-compose.build.ymloverride above to build your working tree.
- UI: the "Check for new bills" button.
-
API:
curl -X POST http://localhost:3000/api/refresh→ returns arunId; pollGET /api/refresh/<id>. -
CLI (inside the container):
npm run scraperuns one collect+persist.
# DB shell
docker compose exec ngrid_postgres psql -U ngrid -d ngrid
# API
curl -s localhost:3000/api/overview | jq
curl -s localhost:3000/api/series | jq '.rows[-3:]'
curl -s localhost:3000/api/verify | jq '{ok,total,failed}' # cross-validation-
Postgres → Docker named volume
pgdata. -
Login session (sensitive auth tokens) → Docker named volume
session, file0600. If you don't setNGRID_SECRET_KEY, the auto-generated credential-store key is persisted here too assession/secret.key(0600). -
Bill PDFs → host directory,
./data/pdfsby default (setPDF_DIRin.envto relocate). -
Pre-upgrade DB backups → host directory,
./data/backupsby default (BACKUP_DIR).
Wipe everything: docker compose down -v (removes named volumes) and delete your PDF dir.
| Var | Purpose |
|---|---|
NGRID_USER / NGRID_PASS
|
Your National Grid login (read at runtime; never commit). |
DB_USER / DB_PASSWORD / DB_NAME / DATABASE_URL
|
Postgres + Prisma. |
PDF_DIR |
Host path for bill PDFs (default ./data/pdfs). |
APP_PORT |
Host port for the UI. |
TZ |
Timezone. |
SCHEDULER_ENABLED |
false disables auto-checks (also toggleable at runtime in Settings). |
NGRID_SECRET_KEY |
Key for the encrypted NgLogin store (AES-256-GCM). Optional — auto-generated + persisted under the session volume if unset. Never stored in the DB. See Accounts and Login. |
NOTIFY_CHANNEL + channel vars |
New-bill notifications (off by default): webhook/ntfy/smtp + their settings; APP_BASE_URL for the link. See Notifications. |
BACKUP_DIR / BACKUP_BEFORE_MIGRATE / BACKUP_RETENTION
|
Pre-upgrade DB backup (default ./data/backups, on, keep 10). See Backups and Migration-Safety. |
SCRAPE_DEBUG |
1 logs the GraphQL data keys each scrape captured — useful when the portal changes. |
Full annotated reference:
.env.example.
- Set
SCRAPE_DEBUG=1and watchdocker compose logs -f appfor[collect] gql keys: .... - The scraper writes login screenshots/HTML on failure (see
auth.ts). - If a dataset is empty, confirm which page it loads on and that
collect.tsvisits it — some queries (weather, per-fuel bill amounts) fire on the dashboard page.