# subrata-18/prismoffline architecture

> Architecture diagram of the GitHub repository subrata-18/prismoffline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/subrata-18/prismoffline
- Repository: https://github.com/subrata-18/prismoffline

## Overview

PrismOffline is an offline-first STEM solver with a React interface and FastAPI backend. Users submit a problem in Standard Mode; the backend routes it to local reasoning or exact computation, then returns a result for display. Guided Attempt establishes a verified solution before generating and validating progressive questions, with optional hints and lazy full solutions. Accounts and saved work persist locally. The README documents separate local planner and reasoning models plus a persistent Wolfram session; unsampled subsystem details are represented at directory level, and edges are limited to shown references or documented relationships.

Main entry points: [`backend/services/provider_router.py`](https://github.com/subrata-18/prismoffline/blob/main/backend/services/provider_router.py) (Provider router), [`frontend/src/App.tsx`](https://github.com/subrata-18/prismoffline/blob/main/frontend/src/App.tsx) (Application shell), [`backend/main.py`](https://github.com/subrata-18/prismoffline/blob/main/backend/main.py) (FastAPI routes), [`backend/services/reasoning_service.py`](https://github.com/subrata-18/prismoffline/blob/main/backend/services/reasoning_service.py) (Reasoning service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User interface"]
  node_app["Application shell<br/>[App.tsx]"]
  node_standard["Standard Mode<br/>[StandardMode.tsx]"]
  node_graphical["Graphical Mode<br/>[GraphicalMode.tsx]"]
  node_account["Account view<br/>[AccountView.tsx]"]
  node_authview["Authentication view<br/>[AuthView.tsx]"]
  node_api["Frontend API client<br/>[api.ts]"]
  node_render["Result rendering<br/>[ReasonResult.tsx]"]
  node_mathtext["Scientific notation<br/>[MathText.tsx]"]
  node_workspace["Solution text"]
end

subgraph group_backend["Backend API"]
  node_backendapi["FastAPI routes<br/>[main.py]"]
end

subgraph group_reason["Problem solving"]
  node_reasoning["Reasoning service"]
  node_execution["Execution service"]
  node_language["Language routing<br/>[router.py]"]
  node_computation["Exact computation"]
  node_normalizer["Expression normalization"]
end

subgraph group_guided["Guided learning"]
  node_guidedservice["Guided attempt service"]
  node_guidedlearning["Learning helpers"]
end

subgraph group_providers["Engines and storage"]
  node_providerrouter["Provider router<br/>[provider_router.py]"]
  node_localprovider["Local model provider<br/>[provider.py]"]
  node_plannerprovider["Planner provider<br/>[provider.py]"]
  node_wolframprovider["Wolfram provider<br/>[provider.py]"]
  node_sympyprovider["SymPy provider<br/>[provider.py]"]
  node_wolframengine["Wolfram session<br/>[wolfram_engine.py]"]
  node_authstorage[("Accounts and saved work<br/>[auth_storage.py]")]
end

node_user(("User"))
node_llamaserver["llama.cpp servers"]
node_wolfram["Wolfram Engine"]

node_user -->|"uses"| node_app
node_app -->|"selects"| node_standard
node_app -->|"selects"| node_graphical
node_app -->|"shows"| node_account
node_app -->|"shows"| node_authview
node_standard -->|"requests"| node_api
node_graphical -->|"requests"| node_api
node_authview -->|"authenticates"| node_api
node_account -->|"manages account"| node_api
node_api -->|"calls endpoints"| node_backendapi
node_backendapi -->|"invokes"| node_reasoning
node_backendapi -->|"invokes"| node_guidedservice
node_backendapi -->|"invokes"| node_computation
node_backendapi -->|"reads and writes"| node_authstorage
node_reasoning -->|"dispatches"| node_providerrouter
node_reasoning -->|"normalizes"| node_normalizer
node_reasoning -.->|"delegates"| node_execution
node_execution -->|"routes through"| node_language
node_computation -->|"selects provider"| node_providerrouter
node_computation -->|"normalizes"| node_normalizer
node_guidedservice -->|"uses models"| node_providerrouter
node_guidedservice -->|"gets solution"| node_reasoning
node_guidedservice -.->|"uses learning helpers"| node_guidedlearning
node_providerrouter -->|"generates"| node_localprovider
node_providerrouter -->|"plans"| node_plannerprovider
node_providerrouter -->|"calculates"| node_wolframprovider
node_providerrouter -->|"calculates"| node_sympyprovider
node_localprovider -.->|"requests inference"| node_llamaserver
node_plannerprovider -.->|"requests planning"| node_llamaserver
node_wolframprovider -->|"evaluates with"| node_wolframengine
node_wolframengine -->|"maintains session"| node_wolfram
node_standard -->|"displays results"| node_render
node_render -->|"renders solution text"| node_workspace
node_standard -->|"renders notation"| node_mathtext
node_workspace -->|"renders notation"| node_mathtext

click node_app "https://github.com/subrata-18/prismoffline/blob/main/frontend/src/App.tsx"
click node_standard "https://github.com/subrata-18/prismoffline/blob/main/frontend/src/modes/StandardMode.tsx"
click node_graphical "https://github.com/subrata-18/prismoffline/blob/main/frontend/src/modes/GraphicalMode.tsx"
click node_account "https://github.com/subrata-18/prismoffline/blob/main/frontend/src/components/AccountView.tsx"
click node_authview "https://github.com/subrata-18/prismoffline/blob/main/frontend/src/components/AuthView.tsx"
click node_api "https://github.com/subrata-18/prismoffline/blob/main/frontend/src/services/api.ts"
click node_render "https://github.com/subrata-18/prismoffline/blob/main/frontend/src/components/ReasonResult.tsx"
click node_mathtext "https://github.com/subrata-18/prismoffline/blob/main/frontend/src/components/MathText.tsx"
click node_workspace "https://github.com/subrata-18/prismoffline/blob/main/frontend/src/components/WorkspaceSolutionText.tsx"
click node_backendapi "https://github.com/subrata-18/prismoffline/blob/main/backend/main.py"
click node_reasoning "https://github.com/subrata-18/prismoffline/blob/main/backend/services/reasoning_service.py"
click node_execution "https://github.com/subrata-18/prismoffline/blob/main/backend/services/execution_service.py"
click node_language "https://github.com/subrata-18/prismoffline/blob/main/backend/services/language/router.py"
click node_computation "https://github.com/subrata-18/prismoffline/blob/main/backend/services/computation_service.py"
click node_normalizer "https://github.com/subrata-18/prismoffline/blob/main/backend/services/expression_normalizer.py"
click node_guidedservice "https://github.com/subrata-18/prismoffline/blob/main/backend/services/guided_attempt_service.py"
click node_guidedlearning "https://github.com/subrata-18/prismoffline/tree/main/backend/services/learning"
click node_providerrouter "https://github.com/subrata-18/prismoffline/blob/main/backend/services/provider_router.py"
click node_localprovider "https://github.com/subrata-18/prismoffline/blob/main/backend/providers/local_llm/provider.py"
click node_plannerprovider "https://github.com/subrata-18/prismoffline/blob/main/backend/providers/planner_llm/provider.py"
click node_wolframprovider "https://github.com/subrata-18/prismoffline/blob/main/backend/providers/wolfram/provider.py"
click node_sympyprovider "https://github.com/subrata-18/prismoffline/blob/main/backend/providers/sympy/provider.py"
click node_wolframengine "https://github.com/subrata-18/prismoffline/blob/main/backend/services/wolfram_engine.py"
click node_authstorage "https://github.com/subrata-18/prismoffline/blob/main/backend/services/auth_storage.py"

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_app,node_standard,node_graphical,node_account,node_authview,node_api,node_render,node_mathtext,node_workspace,node_user toneBlue
class node_backendapi toneAmber
class node_reasoning,node_execution,node_language,node_computation,node_normalizer,node_llamaserver toneMint
class node_guidedservice,node_guidedlearning toneRose
class node_providerrouter,node_localprovider,node_plannerprovider,node_wolframprovider,node_sympyprovider,node_wolframengine,node_authstorage,node_wolfram toneIndigo
```

## Components

### User interface

- [Application shell](https://github.com/subrata-18/prismoffline/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Standard Mode](https://github.com/subrata-18/prismoffline/blob/main/frontend/src/modes/StandardMode.tsx): `frontend/src/modes/StandardMode.tsx`
- [Graphical Mode](https://github.com/subrata-18/prismoffline/blob/main/frontend/src/modes/GraphicalMode.tsx): `frontend/src/modes/GraphicalMode.tsx`
- [Account view](https://github.com/subrata-18/prismoffline/blob/main/frontend/src/components/AccountView.tsx): `frontend/src/components/AccountView.tsx`
- [Authentication view](https://github.com/subrata-18/prismoffline/blob/main/frontend/src/components/AuthView.tsx): `frontend/src/components/AuthView.tsx`
- [Frontend API client](https://github.com/subrata-18/prismoffline/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Result rendering](https://github.com/subrata-18/prismoffline/blob/main/frontend/src/components/ReasonResult.tsx): `frontend/src/components/ReasonResult.tsx`
- [Scientific notation](https://github.com/subrata-18/prismoffline/blob/main/frontend/src/components/MathText.tsx): `frontend/src/components/MathText.tsx`
- [Solution text](https://github.com/subrata-18/prismoffline/blob/main/frontend/src/components/WorkspaceSolutionText.tsx): `frontend/src/components/WorkspaceSolutionText.tsx`

### Backend API

- [FastAPI routes](https://github.com/subrata-18/prismoffline/blob/main/backend/main.py): `backend/main.py`

### Problem solving

- [Reasoning service](https://github.com/subrata-18/prismoffline/blob/main/backend/services/reasoning_service.py): `backend/services/reasoning_service.py`
- [Execution service](https://github.com/subrata-18/prismoffline/blob/main/backend/services/execution_service.py): `backend/services/execution_service.py`
- [Language routing](https://github.com/subrata-18/prismoffline/blob/main/backend/services/language/router.py): `backend/services/language/router.py`
- [Exact computation](https://github.com/subrata-18/prismoffline/blob/main/backend/services/computation_service.py): `backend/services/computation_service.py`
- [Expression normalization](https://github.com/subrata-18/prismoffline/blob/main/backend/services/expression_normalizer.py): `backend/services/expression_normalizer.py`

### Guided learning

- [Guided attempt service](https://github.com/subrata-18/prismoffline/blob/main/backend/services/guided_attempt_service.py): `backend/services/guided_attempt_service.py`
- [Learning helpers](https://github.com/subrata-18/prismoffline/tree/main/backend/services/learning): `backend/services/learning`

### Engines and storage

- [Provider router](https://github.com/subrata-18/prismoffline/blob/main/backend/services/provider_router.py): `backend/services/provider_router.py`
- [Local model provider](https://github.com/subrata-18/prismoffline/blob/main/backend/providers/local_llm/provider.py): `backend/providers/local_llm/provider.py`
- [Planner provider](https://github.com/subrata-18/prismoffline/blob/main/backend/providers/planner_llm/provider.py): `backend/providers/planner_llm/provider.py`
- [Wolfram provider](https://github.com/subrata-18/prismoffline/blob/main/backend/providers/wolfram/provider.py): `backend/providers/wolfram/provider.py`
- [SymPy provider](https://github.com/subrata-18/prismoffline/blob/main/backend/providers/sympy/provider.py): `backend/providers/sympy/provider.py`
- [Wolfram session](https://github.com/subrata-18/prismoffline/blob/main/backend/services/wolfram_engine.py): `backend/services/wolfram_engine.py`
- [Accounts and saved work](https://github.com/subrata-18/prismoffline/blob/main/backend/services/auth_storage.py): `backend/services/auth_storage.py`

### Other components

- **User**
- **llama.cpp servers**
- **Wolfram Engine**

## Connections

- User → Application shell: uses
- Application shell → Standard Mode: selects (evidence: `frontend/src/App.tsx`)
- Application shell → Graphical Mode: selects (evidence: `frontend/src/App.tsx`)
- Application shell → Account view: shows (evidence: `frontend/src/App.tsx`)
- Application shell → Authentication view: shows (evidence: `frontend/src/App.tsx`)
- Standard Mode → Frontend API client: requests (evidence: `frontend/src/modes/StandardMode.tsx`)
- Graphical Mode → Frontend API client: requests (evidence: `frontend/src/modes/GraphicalMode.tsx`)
- Authentication view → Frontend API client: authenticates (evidence: `frontend/src/components/AuthView.tsx`)
- Account view → Frontend API client: manages account (evidence: `frontend/src/components/AccountView.tsx`)
- Frontend API client → FastAPI routes: calls endpoints (evidence: `frontend/src/services/api.ts`)
- FastAPI routes → Reasoning service: invokes (evidence: `backend/main.py`)
- FastAPI routes → Guided attempt service: invokes (evidence: `backend/main.py`)
- FastAPI routes → Exact computation: invokes (evidence: `backend/main.py`)
- FastAPI routes → Accounts and saved work: reads and writes (evidence: `backend/main.py`)
- Reasoning service → Provider router: dispatches (evidence: `backend/services/reasoning_service.py`)
- Reasoning service → Expression normalization: normalizes (evidence: `backend/services/reasoning_service.py`)
- Reasoning service → Execution service: delegates
- Execution service → Language routing: routes through (evidence: `backend/services/execution_service.py`)
- Exact computation → Provider router: selects provider (evidence: `backend/services/computation_service.py`)
- Exact computation → Expression normalization: normalizes (evidence: `backend/services/computation_service.py`)
- Guided attempt service → Provider router: uses models (evidence: `backend/services/guided_attempt_service.py`)
- Guided attempt service → Reasoning service: gets solution (evidence: `backend/services/guided_attempt_service.py`)
- Guided attempt service → Learning helpers: uses learning helpers
- Provider router → Local model provider: generates (evidence: `backend/services/provider_router.py`)
- Provider router → Planner provider: plans (evidence: `backend/services/provider_router.py`)
- Provider router → Wolfram provider: calculates (evidence: `backend/services/provider_router.py`)
- Provider router → SymPy provider: calculates (evidence: `backend/services/provider_router.py`)
- Local model provider → llama.cpp servers: requests inference
- Planner provider → llama.cpp servers: requests planning
- Wolfram provider → Wolfram session: evaluates with (evidence: `backend/providers/wolfram/provider.py`)
- Wolfram session → Wolfram Engine: maintains session
- Standard Mode → Result rendering: displays results (evidence: `frontend/src/modes/StandardMode.tsx`)
- Result rendering → Solution text: renders solution text (evidence: `frontend/src/components/ReasonResult.tsx`)
- Standard Mode → Scientific notation: renders notation (evidence: `frontend/src/modes/StandardMode.tsx`)
- Solution text → Scientific notation: renders notation
