Skip to content
sondresjolystPublic

About

Garge API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

554 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

garge-api

API for Garge, serving garge-app and garge-operator.

Stack

ASP.NET Core 11, PostgreSQL through EF Core and Npgsql, ASP.NET Identity with JWT, SignalR, Mapster, Serilog, PuppeteerSharp, Brevo.

Quick start

dotnet restore
dotnet run                  # needs a local Postgres, see appsettings.Development.json
                            # Swagger at /swagger

Pending migrations are applied at startup. Set Database__AutoMigrate=false to skip that and apply them yourself with dotnet ef database update. Startup takes no lock, so run a single replica while a migration is pending.

Environment

Production reads these from the cluster secret.

Variable Used for
ConnectionStrings__DefaultConnection PostgreSQL connection string
Jwt__Key, Jwt__Issuer JWT signing key and issuer. The key must match the app's GARGE_API_JWT_SECRET
BrevoSettings__ApiKey, BrevoSettings__SenderEmail, BrevoSettings__SenderName Transactional email
App__FrontendBaseUrl, App__ApiBaseUrl Used in links and callbacks
Vapid__PublicKey, Vapid__PrivateKey Web push
Vipps__* Payment, including the test merchant credentials
PUPPETEER_NO_SANDBOX Set to 1 in the cluster. Chrome's own sandbox cannot start in the pod
TrustedProxies CIDRs allowed to set X-Forwarded-For. Defaults to the cluster pod network (192.169.0.0/16, where the ingress runs) and the private ranges. A wildcard would let any caller forge the client IP the rate limiter reads

What it serves

Area Holds
Sensors Readings, history, battery health, activity
Switches and automations Threshold rules that switch power sockets
Electricity Spot prices and consumption
Shop Products, orders and invoices, with the invoice rendered to PDF
Push Web push subscriptions
Pairing and groups Device ownership
Accounts Sign-in, JWT and refresh tokens, password reset, roles
/hubs/devices SignalR hub the app and operator connect to

Browse /swagger on a running instance for the current surface.

Health

Path Reports
/health The process is up. No dependency checks, so a database outage does not restart the pod
/health/ready The database connection. Fails while Postgres is unreachable, which takes the pod out of its Service

Both are anonymous, and both are blocked at the ingress: only the kubelet reaches them, over the pod address.

PDF invoices

Services/PuppeteerPdfRenderer.cs launches the Chrome that the image installs and prints the invoice HTML. Chrome writes its profile and crash handler state under $HOME, so the pod mounts a volume at /home/app, and it needs PUPPETEER_NO_SANDBOX=1 because its own sandbox cannot start there. Without either, rendering produces no output.

Deployment

Image sondresjo/garge-api on Docker Hub, chart garge-api in garge, applied by Flux from tumo-flux to garge-dev and garge-prod.

The container runs as the non-root app user with a read-only root filesystem, so anything written at runtime needs a volume: /tmp and /home/app. Data protection keys are persisted to the database rather than the filesystem.

A push to main builds the dev tag. A release-please release builds vX.Y.Z, tags it latest and opens a chart bump against garge. Cluster secrets are created by scripts/garge/bootstrap.sh in tumo-platform.

License

Proprietary. Copyright (c) 2026 Sondre Sjølyst.

About

Garge API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages