System architecture

How the desktop app, local API, stored records, and optional providers fit together.

Hamartia is a desktop application with a local web interface and a loopback-only backend. Study data is stored on the same computer; optional provider requests are separate outbound actions.

Desktop app and local API

The packaged app uses Electron to open the interface and start the bundled backend. The backend binds to a loopback address on a dynamically selected local port; it is not intended to be exposed to the public internet. The renderer talks to that local API for exam, question, practice, Clock, settings, and backup operations. Electron provides the desktop-only ChatGPT sign-in and restore flows.

Local records and files

The backend stores validated JSON documents under the current OS user's Hamartia data directory. Writes use per-file atomic replacement and locks for shared mutations. Question images and other uploaded data are stored under the same local data directory. The app does not automatically sync this data to a server.

Optional provider boundary

Most screens need no AI. Study Agent requests go to the explicitly selected ChatGPT subscription flow or configured OpenAI-compatible endpoint after consent. The configured URL may be remote. Question analysis is a distinct request: its local-only preview shows the sanitized host and port, local/remote class, scheme, model, text/image fields, and authentication-value category before each send. Only an explicit approval sends one request to the configured endpoint; cancel sends no provider request. See Study Agent and providers and Privacy and consent.

Backup boundary

The ZIP export captures validated study documents and referenced uploads as one point-in-time snapshot. It excludes the configured API key and ChatGPT sign-in credentials. Restore validates and stages the archive, preserves the current data directory as a snapshot, then replaces it. Clock timers restore paused and reminders disabled. See Backup and restore.