# lottajavamike/eve-tracker architecture

> Architecture diagram of the GitHub repository lottajavamike/eve-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lottajavamike/eve-tracker
- Repository: https://github.com/lottajavamike/eve-tracker

## Overview

#### Purpose and Runtime
EVE Tracker is a single-user, local EVE Online project and industry tracker. It separates a React/Vite dashboard from a Node/Express API, with persistent local SQLite state and optional EVE SSO/ESI synchronization. Main runtime entry points are `backend/src/index.js` and `frontend/src/main.jsx`; the frontend composition root is `frontend/src/App.jsx`.

#### Backend API and Domain Boundary
The Express backend exposes domain-oriented HTTP routes for local tracking and synced character data. Projects and activity logs are handled by `backend/src/routes/projects.js` and `backend/src/routes/activities.js`; EVE-derived views are exposed through routes such as `backend/src/routes/industry.js`, `backend/src/routes/assets.js`, `backend/src/routes/blueprints.js`, `backend/src/routes/planets.js`, `backend/src/routes/skills.js`, and `backend/src/routes/dashboard.js`. This API is the boundary between UI state and all persistence/external EVE services.

#### Local Persistence
`backend/src/db.js` owns SQLite access and the local data model, stored in `data/eve-tracker.db` at runtime. It persists user-created projects, activities, manually entered or linked jobs, synchronized character data, wallet history, and OAuth tokens. Project deletion is intentionally non-destructive to related records: linked activity/job project references are cleared rather than deleting those records.

#### EVE Authentication and ESI Ingestion
Authentication is initiated and completed through `backend/src/routes/auth.js`, backed by `backend/src/esi/sso.js` and `backend/src/esi/token.js`. Tokens enable authenticated ESI requests through `backend/src/esi/client.js`. Sync pulls character industry jobs, blueprints, assets, planetary colonies, skill queue, and wallet data; it also resolves public universe metadata such as item, blueprint, and planet names, with process-local caching. ESI is optional: local projects and activities remain usable without a connected character.

#### Scheduled and On-Demand Sync Flow
`backend/src/jobs/syncScheduler.js` runs automatic refreshes every ten minutes after a character is connected. `backend/src/routes/sync.js` provides an explicit sync trigger for the Settings and Industry experiences. The control flow is ESI/SSO credentials → ESI client retrieval and enrichment → SQLite upsert/update → API routes/dashboard reads. Scheduler and manual sync share the same external-data boundary and should preserve resilience to missing scopes or disconnected accounts.

#### Industry Cost Calculation
The live calculation feature is exposed via `backend/src/routes/industryCost.js` and implemented in `backend/src/services/industryCost.js`. It combines blueprint/job inputs with ME-adjusted material requirements from EVE Ref and market prices from Fuzzwork, plus system cost data, to compute build cost, expected revenue, and margin. Unlike synced ESI data, these third-party results are calculated on request and are not persisted.

#### Frontend Presentation and API Flow
The Vite React client uses `frontend/src/api/client.js` as its backend communication boundary. Page-level views map closely to API domains: `frontend/src/pages/Dashboard.jsx`, `frontend/src/pages/Projects.jsx`, `frontend/src/pages/Industry.jsx`, `frontend/src/pages/Assets.jsx`, and `frontend/src/pages/PlanetaryInteraction.jsx`. `frontend/src/components/IndustryCostModal.jsx` drives the calculator interaction. The browser talks only to the local backend; the backend is responsible for SQLite, CCP ESI, EVE Ref, and Fuzzwork access.

Main entry points: [`backend/src/index.js`](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/index.js) (Express server), [`backend/src/db.js`](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/db.js) (SQLite data model), [`backend/src/esi/client.js`](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/esi/client.js) (ESI client and enrichment), [`backend/src/esi/sso.js`](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/esi/sso.js) (SSO and token handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React dashboard"]
  node_vite["Vite entry<br/>React bootstrap<br/>[main.jsx]"]
  node_app["App composition<br/>React root<br/>[App.jsx]"]
  node_pages["Dashboard and domain pages<br/>React views<br/>[Dashboard.jsx]"]
  node_api_client["API client<br/>frontend boundary<br/>[client.js]"]
  node_cost_modal["Industry cost modal<br/>calculator UI"]
end

subgraph group_backend["Local API and services"]
  node_server["Express server<br/>API runtime<br/>[index.js]"]
  node_local_routes["Local tracking routes<br/>HTTP routes<br/>[projects.js]"]
  node_eve_routes["EVE data routes<br/>HTTP routes<br/>[industry.js]"]
  node_auth_routes["Auth routes<br/>HTTP routes<br/>[auth.js]"]
  node_sync_routes["Manual sync route<br/>HTTP route<br/>[sync.js]"]
  node_cost_routes["Industry cost route<br/>HTTP route<br/>[industryCost.js]"]
  node_sqlite_access[("SQLite data model<br/>persistence layer<br/>[db.js]")]
  node_sqlite_file[("Local tracker state<br/>SQLite database")]
  node_sso["SSO and token handling<br/>OAuth service<br/>[sso.js]"]
  node_esi_client["ESI client and enrichment<br/>external-data boundary<br/>[client.js]"]
  node_scheduler["Ten-minute sync scheduler<br/>background job<br/>[syncScheduler.js]"]
  node_cost_service["Cost calculation<br/>calculation service<br/>[industryCost.js]"]
end

subgraph group_external["EVE services"]
  node_esi{{"CCP ESI<br/>EVE API"}}
  node_eve_ref{{"EVE Ref<br/>blueprint data API"}}
  node_fuzzwork{{"Fuzzwork<br/>market price API"}}
end

node_vite -->|"mounts"| node_app
node_app -->|"composes"| node_pages
node_pages -->|"reads and mutates"| node_api_client
node_cost_modal -->|"requests calculation"| node_api_client
node_api_client -->|"local HTTP only"| node_server
node_server -->|"mounts"| node_local_routes
node_server -->|"mounts"| node_eve_routes
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_sync_routes
node_server -->|"mounts"| node_cost_routes
node_local_routes -->|"persists local tracking"| node_sqlite_access
node_eve_routes -->|"reads synced data"| node_sqlite_access
node_sqlite_access -->|"stores"| node_sqlite_file
node_auth_routes -->|"starts and completes login"| node_sso
node_sso -->|"stores tokens"| node_sqlite_access
node_sso -->|"OAuth authorization"| node_esi
node_sync_routes -->|"triggers"| node_esi_client
node_scheduler -->|"refreshes every 10 minutes"| node_esi_client
node_esi_client -->|"retrieves character and universe data"| node_esi
node_esi_client -->|"upserts synced data"| node_sqlite_access
node_cost_routes -->|"calculates on demand"| node_cost_service
node_cost_service -->|"gets material requirements"| node_eve_ref
node_cost_service -->|"gets market prices"| node_fuzzwork

click node_vite "https://github.com/lottajavamike/eve-tracker/blob/main/frontend/src/main.jsx"
click node_app "https://github.com/lottajavamike/eve-tracker/blob/main/frontend/src/App.jsx"
click node_pages "https://github.com/lottajavamike/eve-tracker/blob/main/frontend/src/pages/Dashboard.jsx"
click node_api_client "https://github.com/lottajavamike/eve-tracker/blob/main/frontend/src/api/client.js"
click node_cost_modal "https://github.com/lottajavamike/eve-tracker/blob/main/frontend/src/components/IndustryCostModal.jsx"
click node_server "https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/index.js"
click node_local_routes "https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/routes/projects.js"
click node_eve_routes "https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/routes/industry.js"
click node_auth_routes "https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/routes/auth.js"
click node_sync_routes "https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/routes/sync.js"
click node_cost_routes "https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/routes/industryCost.js"
click node_sqlite_access "https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/db.js"
click node_sso "https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/esi/sso.js"
click node_esi_client "https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/esi/client.js"
click node_scheduler "https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/jobs/syncScheduler.js"
click node_cost_service "https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/services/industryCost.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_vite,node_app,node_pages,node_api_client,node_cost_modal toneBlue
class node_server,node_local_routes,node_eve_routes,node_auth_routes,node_sync_routes,node_cost_routes,node_sqlite_access,node_sqlite_file,node_sso,node_esi_client,node_scheduler,node_cost_service toneAmber
class node_esi,node_eve_ref,node_fuzzwork toneMint
```

## Components

### React dashboard

- [Vite entry](https://github.com/lottajavamike/eve-tracker/blob/main/frontend/src/main.jsx): React bootstrap · `frontend/src/main.jsx`
- [App composition](https://github.com/lottajavamike/eve-tracker/blob/main/frontend/src/App.jsx): React root · `frontend/src/App.jsx`
- [Dashboard and domain pages](https://github.com/lottajavamike/eve-tracker/blob/main/frontend/src/pages/Dashboard.jsx): React views · Dashboard, projects, industry, assets, and planetary views. · `frontend/src/pages/Dashboard.jsx`
- [API client](https://github.com/lottajavamike/eve-tracker/blob/main/frontend/src/api/client.js): frontend boundary · `frontend/src/api/client.js`
- [Industry cost modal](https://github.com/lottajavamike/eve-tracker/blob/main/frontend/src/components/IndustryCostModal.jsx): calculator UI · `frontend/src/components/IndustryCostModal.jsx`

### Local API and services

- [Express server](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/index.js): API runtime · `backend/src/index.js`
- [Local tracking routes](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/routes/projects.js): HTTP routes · Projects and activity log endpoints. · `backend/src/routes/projects.js`
- [EVE data routes](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/routes/industry.js): HTTP routes · Serves industry, assets, blueprints, planets, skills, and dashboard data. · `backend/src/routes/industry.js`
- [Auth routes](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/routes/auth.js): HTTP routes · `backend/src/routes/auth.js`
- [Manual sync route](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/routes/sync.js): HTTP route · `backend/src/routes/sync.js`
- [Industry cost route](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/routes/industryCost.js): HTTP route · `backend/src/routes/industryCost.js`
- [SQLite data model](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/db.js): persistence layer · Keeps related records when a project is deleted by clearing project references. · `backend/src/db.js`
- **Local tracker state**: SQLite database · Projects, activities, jobs, synced character data, wallet history, and tokens.
- [SSO and token handling](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/esi/sso.js): OAuth service · `backend/src/esi/sso.js`
- [ESI client and enrichment](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/esi/client.js): external-data boundary · Authenticated retrieval plus cached public universe metadata resolution. · `backend/src/esi/client.js`
- [Ten-minute sync scheduler](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/jobs/syncScheduler.js): background job · Refreshes after a character is connected. · `backend/src/jobs/syncScheduler.js`
- [Cost calculation](https://github.com/lottajavamike/eve-tracker/blob/main/backend/src/services/industryCost.js): calculation service · Combines ME materials, prices, system costs, revenue, and margin without persistence. · `backend/src/services/industryCost.js`

### EVE services

- **CCP ESI**: EVE API
- **EVE Ref**: blueprint data API
- **Fuzzwork**: market price API

## Connections

- Vite entry → App composition: mounts
- App composition → Dashboard and domain pages: composes
- Dashboard and domain pages → API client: reads and mutates
- Industry cost modal → API client: requests calculation
- API client → Express server: local HTTP only
- Express server → Local tracking routes: mounts
- Express server → EVE data routes: mounts
- Express server → Auth routes: mounts
- Express server → Manual sync route: mounts
- Express server → Industry cost route: mounts
- Local tracking routes → SQLite data model: persists local tracking
- EVE data routes → SQLite data model: reads synced data
- SQLite data model → Local tracker state: stores
- Auth routes → SSO and token handling: starts and completes login
- SSO and token handling → SQLite data model: stores tokens
- SSO and token handling → CCP ESI: OAuth authorization
- Manual sync route → ESI client and enrichment: triggers
- Ten-minute sync scheduler → ESI client and enrichment: refreshes every 10 minutes
- ESI client and enrichment → CCP ESI: retrieves character and universe data
- ESI client and enrichment → SQLite data model: upserts synced data
- Industry cost route → Cost calculation: calculates on demand
- Cost calculation → EVE Ref: gets material requirements
- Cost calculation → Fuzzwork: gets market prices
