Skip to content

How WattByte is built.

A high-level view of the architecture for people who want to know where their numbers come from and where they go.

Built like infrastructure, not a weekend prototype.

Measurement happens on the phone. The backend only holds accounts, optional daily totals and the AI gateway.

  1. Mobile

    • Flutter
    • Native Kotlin integration
    • Native Swift integration

    Reads system counters, builds charging sessions and keeps everything in local SQLite. Home-screen widgets on both platforms.

  2. Backend

    • Fastify
    • TypeScript
    • PostgreSQL
    • OpenAPI

    Accounts, optional cloud sync of per-day totals, device catalog and the electricity price cache. Every route is described by an OpenAPI schema.

  3. AI gateway

    • OpenAI
    • Anthropic
    • Google
    • xAI

    One interface over four providers with routing, retry, a single fallback and spend limits.

Design rules the code follows

The phone owns measurement
System counters, charging sessions, energy maths and local storage live in the app. The backend never calculates energy.
Sync is per-day totals, opt-in
One row per day: bytes, Wh, sessions, estimated cost. Raw samples and per-app usage never leave the phone.
Every route has a contract
Request and response schemas are validated at the edge and exported as OpenAPI; the mobile client is generated from that document.
Fail closed
A release build without a backend address does not compile. An unknown phone model shows "capacity unavailable" rather than a typical number.
AI reads, it does not compute
The gateway sends period totals, forbids calculation in the prompt, validates the structured answer and keeps provider keys on the server.
Public prices, cached
Household electricity prices come from Eurostat and are cached by the backend; a country without a public source gets a manual tariff instead of a guess.
Public API and developer documentationComing soon

Built to stay flexible.

The AI layer is a gateway, not a single model. Each request is routed to one configured provider; after an outage or a rate limit, at most one other provider is tried. Your totals are never sent to every provider at once.

  • Provider keys live on the server, never in the app
  • Requests carry period totals only; an e-mail, user id or token is rejected before a prompt exists
  • Prompts and answers are not stored by WattByte
  • Daily and monthly spend limits per provider
  1. WattByte app

    sends period totals

  2. WattByte API

    quota, validation, keys

  3. AI gateway

    routing, retry, one fallback

  4. OpenAIAnthropicGooglexAI

One provider is asked per request. Which one is a server setting, never a choice the app or a request can make.

Your device already generates the data. WattByte makes it useful.

Understand your battery, data and energy usage in one place.