# manish-let-it-be/artifex architecture

> Architecture diagram of the GitHub repository manish-let-it-be/artifex, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manish-let-it-be/artifex
- Repository: https://github.com/manish-let-it-be/artifex

## Overview

CalcAI is a browser-based AI math and general-purpose assistant with a visual board, model selection, and a FastAPI backend. The documented-by-code workflow is browser route to a screen, then backend image solving or conversational assistance through provider dispatch. A separate payment API supports model access purchases and Stripe fulfillment. The sampled frontend does not show its API calls, and the main app excerpt does not register payment routes, so those connections are omitted; the README provides no further product detail.

Main entry points: [`CalcAI/src/App.tsx`](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/App.tsx) (Page routing), [`CalcAI_BE/apps/calculator/utils.py`](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/calculator/utils.py) (Image analysis), [`CalcAI_BE/apps/calculator/route.py`](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/calculator/route.py) (Image solver API), [`CalcAI_BE/main.py`](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/main.py) (FastAPI app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser experience"]
  node_browser["Web app<br/>[main.tsx]"]
  node_routes["Page routing<br/>[App.tsx]"]
  node_landing["Landing page<br/>[index.tsx]"]
  node_home["Assistant workspace<br/>[index.tsx]"]
  node_board["Visual board<br/>[index.tsx]"]
  node_modelpicker["Model picker<br/>[ModelPicker.tsx]"]
  node_authcontext["Auth context<br/>[AuthContext.tsx]"]
end

subgraph group_ai["AI services"]
  node_api["FastAPI app<br/>[main.py]"]
  node_calcroute["Image solver API<br/>[route.py]"]
  node_askroute["Ask API<br/>[route.py]"]
  node_solver["Image analysis<br/>[utils.py]"]
  node_tutor["Tutor prompting<br/>[utils.py]"]
  node_inputschema["Image request schema<br/>[schema.py]"]
end

subgraph group_payments["Access and payments"]
  node_paymentapi["Payment API<br/>[route.py]"]
end

subgraph group_state["Persistence"]
  node_db[("SQLite database<br/>[database.py]")]
end

node_user(("User"))
node_models{{"AI model providers"}}
node_ollama{{"Ollama service"}}
node_stripe{{"Stripe"}}

node_user -->|"uses"| node_browser
node_browser -->|"renders"| node_routes
node_routes -->|"routes to"| node_landing
node_routes -->|"routes to"| node_home
node_routes -->|"routes to"| node_board
node_api -->|"registers"| node_calcroute
node_api -->|"registers"| node_askroute
node_calcroute -->|"validates with"| node_inputschema
node_calcroute -->|"calls"| node_solver
node_askroute -->|"calls"| node_tutor
node_tutor -->|"dispatches through"| node_solver
node_solver -->|"dispatches to"| node_models
node_solver -->|"sends requests"| node_ollama
node_paymentapi -->|"creates sessions"| node_stripe
node_paymentapi -->|"reads and writes"| node_db

click node_browser "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/main.tsx"
click node_routes "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/App.tsx"
click node_landing "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/screens/landing/index.tsx"
click node_home "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/screens/home/index.tsx"
click node_board "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/screens/board/index.tsx"
click node_modelpicker "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/components/ModelPicker.tsx"
click node_authcontext "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/context/AuthContext.tsx"
click node_api "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/main.py"
click node_calcroute "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/calculator/route.py"
click node_askroute "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/ask/route.py"
click node_solver "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/calculator/utils.py"
click node_tutor "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/ask/utils.py"
click node_inputschema "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/schema.py"
click node_paymentapi "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/payment/route.py"
click node_db "https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/database.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_browser,node_routes,node_landing,node_home,node_board,node_modelpicker,node_authcontext,node_user toneBlue
class node_api,node_calcroute,node_askroute,node_solver,node_tutor,node_inputschema toneAmber
class node_paymentapi toneMint
class node_db toneRose
class node_models,node_ollama,node_stripe toneIndigo
```

## Components

### Browser experience

- [Web app](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/main.tsx): `CalcAI/src/main.tsx`
- [Page routing](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/App.tsx): `CalcAI/src/App.tsx`
- [Landing page](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/screens/landing/index.tsx): `CalcAI/src/screens/landing/index.tsx`
- [Assistant workspace](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/screens/home/index.tsx): `CalcAI/src/screens/home/index.tsx`
- [Visual board](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/screens/board/index.tsx): `CalcAI/src/screens/board/index.tsx`
- [Model picker](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/components/ModelPicker.tsx): `CalcAI/src/components/ModelPicker.tsx`
- [Auth context](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI/src/context/AuthContext.tsx): `CalcAI/src/context/AuthContext.tsx`

### AI services

- [FastAPI app](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/main.py): `CalcAI_BE/main.py`
- [Image solver API](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/calculator/route.py): `CalcAI_BE/apps/calculator/route.py`
- [Ask API](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/ask/route.py): `CalcAI_BE/apps/ask/route.py`
- [Image analysis](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/calculator/utils.py): `CalcAI_BE/apps/calculator/utils.py`
- [Tutor prompting](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/ask/utils.py): `CalcAI_BE/apps/ask/utils.py`
- [Image request schema](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/schema.py): `CalcAI_BE/schema.py`

### Access and payments

- [Payment API](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/apps/payment/route.py): `CalcAI_BE/apps/payment/route.py`

### Persistence

- [SQLite database](https://github.com/manish-let-it-be/artifex/blob/master/CalcAI_BE/database.py): `CalcAI_BE/database.py`

### Other components

- **User**
- **AI model providers**
- **Ollama service**
- **Stripe**

## Connections

- User → Web app: uses (evidence: `CalcAI/src/main.tsx`)
- Web app → Page routing: renders (evidence: `CalcAI/src/main.tsx`)
- Page routing → Landing page: routes to (evidence: `CalcAI/src/App.tsx`)
- Page routing → Assistant workspace: routes to (evidence: `CalcAI/src/App.tsx`)
- Page routing → Visual board: routes to (evidence: `CalcAI/src/App.tsx`)
- FastAPI app → Image solver API: registers (evidence: `CalcAI_BE/main.py`)
- FastAPI app → Ask API: registers (evidence: `CalcAI_BE/main.py`)
- Image solver API → Image request schema: validates with (evidence: `CalcAI_BE/apps/calculator/route.py`)
- Image solver API → Image analysis: calls (evidence: `CalcAI_BE/apps/calculator/route.py`)
- Ask API → Tutor prompting: calls (evidence: `CalcAI_BE/apps/ask/route.py`)
- Tutor prompting → Image analysis: dispatches through (evidence: `CalcAI_BE/apps/ask/utils.py`)
- Image analysis → AI model providers: dispatches to (evidence: `CalcAI_BE/apps/calculator/utils.py`)
- Image analysis → Ollama service: sends requests (evidence: `CalcAI_BE/apps/calculator/utils.py`)
- Payment API → Stripe: creates sessions (evidence: `CalcAI_BE/apps/payment/route.py`)
- Payment API → SQLite database: reads and writes (evidence: `CalcAI_BE/apps/payment/route.py`)
