Skip to content

applications local web app

Douwe de Vries edited this page Jul 2, 2026 · 2 revisions

Local web app

Active contributors: Douwe de Vries

Purpose

The local web app serves the built React UI and Axum API from 127.0.0.1:3001. It is the browser-accessible runtime for the same comparison workflows used by desktop mode.

Directory layout

src/
├── main.rs
└── api/
    ├── app.rs
    ├── handlers.rs
    └── state.rs
frontend/dist/

Key abstractions

Name File Description
build_app src/api/app.rs Merges API routes and static file fallback.
build_api_router src/api/app.rs Registers health, sessions, load, mappings, compare, export, pair-order, and snapshot routes.
AppState src/api/state.rs Axum state wrapper around the shared session store.
run_session_workflow src/api/handlers.rs Runs blocking shared workflows and maps backend errors to HTTP responses.

How it works

src/main.rs initializes tracing, creates AppState, resolves frontend/dist with frontend_dist_path(), and starts Axum. src/api/app.rs gives API routes priority before the static fallback, so /api/... calls do not collide with frontend paths.

graph TD
    Main[src/main.rs] --> App[src/api/app.rs]
    App --> Handlers[src/api/handlers.rs]
    Handlers --> Workflows[src/backend/workflow.rs]
    App --> Static[frontend/dist]
Loading

Integration points

The frontend service layer calls routes from frontend/src/services/apiRoutes.ts through frontend/src/services/tauri.ts when __TAURI_INTERNALS__ is absent. API request and response shapes must match src/backend/requests.rs, src/presentation/responses.rs, and frontend/src/types/api.ts.

Entry points for modification

Add a new route constant and router entry in src/api/app.rs, implement the handler in src/api/handlers.rs, then call a shared workflow function from src/backend/workflow.rs. Update API and transport parity if the operation also exists in desktop mode.

Key source files

File Purpose
src/main.rs Local server bootstrap.
src/api/app.rs Route and static file server assembly.
src/api/handlers.rs HTTP handlers and response attachments.
src/api/state.rs Axum state wrapper.
frontend/src/services/apiRoutes.ts Browser route builders.

Clone this wiki locally