# singh-kuldeep/wisdombase architecture

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

- Interactive diagram: https://gitdiagram.com/singh-kuldeep/wisdombase
- Repository: https://github.com/singh-kuldeep/wisdombase

## Overview

WisdomBase is a mobile-first personal knowledge app: users create accounts, capture notes or import links/files, browse their entries, and ask questions answered from retrieved material. The frontend screens use a shared API client; the FastAPI backend handles ingestion and question answering, with Supabase storage and vector search. The README also documents onboarding, memory profiles, free-tier questions, and user-supplied model keys. Some endpoint internals are unsampled, so those capabilities are shown without speculative implementation links.

Main entry points: [`backend/main.py`](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/main.py) (Entry ingestion), [`frontend/lib/api.ts`](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/lib/api.ts) (API client), [`backend/rag.py`](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/rag.py) (Question answering), [`frontend/app/(app)/home.tsx`](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(app)/home.tsx) (Capture home)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Mobile app"]
  node_authscreens["Sign-in and signup<br/>[sign-in.tsx]"]
  node_onboarding["Brain-dump onboarding<br/>[index.tsx]"]
  node_home["Capture home<br/>[home.tsx]"]
  node_editor["Note editor"]
  node_ask["Ask screen<br/>[ask.tsx]"]
  node_chat["Chat messages<br/>[ChatMessage.tsx]"]
  node_browse["Browse entries<br/>[index.tsx]"]
  node_entrydetail["Entry detail<br/>[&#91;id&#93;.tsx]"]
  node_settings["Settings<br/>[settings.tsx]"]
  node_authstore["Auth state<br/>[authStore.ts]"]
  node_entrystore["Entry state<br/>[entryStore.ts]"]
  node_api["API client<br/>[api.ts]"]
end

subgraph group_capture["Knowledge capture"]
  node_webextract["Link extraction<br/>[web_extract.py]"]
  node_fileextract["File extraction<br/>[file_extract.py]"]
  node_chunker["Text chunking<br/>[chunker.py]"]
  node_embedder["Embedding generation<br/>[embedder.py]"]
end

subgraph group_backend["Backend workflows"]
  node_ingest["Entry ingestion<br/>[main.py]"]
  node_query["Question answering<br/>[rag.py]"]
  node_auth["Request authentication<br/>[auth.py]"]
end

subgraph group_services["Data and providers"]
  node_supabaseclient["Supabase client<br/>[supabase.ts]"]
  node_llm["Model adapters<br/>[llm.py]"]
  node_dbclient["Database access<br/>[db.py]"]
  node_supabase[("Supabase and pgvector")]
  node_email["Email delivery<br/>[email_service.py]"]
end

node_user(("App user"))
node_modelprovider["LLM providers"]

node_user -->|"signs up"| node_authscreens
node_user -->|"completes prompts"| node_onboarding
node_user -->|"captures thoughts"| node_home
node_user -->|"asks questions"| node_ask
node_user -->|"browses notes"| node_browse
node_user -->|"manages account"| node_settings
node_authscreens -->|"uses auth state"| node_authstore
node_authstore -->|"uses client"| node_supabaseclient
node_home -->|"opens editor"| node_editor
node_editor -->|"updates entry"| node_api
node_home -->|"calls backend"| node_api
node_ask -->|"submits questions"| node_api
node_ask -->|"renders replies"| node_chat
node_browse -->|"loads and deletes"| node_api
node_browse -->|"opens editor"| node_editor
node_entrydetail -->|"loads entry"| node_api
node_settings -->|"calls backend"| node_api
node_entrystore -->|"fetches entries"| node_api
node_api -->|"gets auth token"| node_supabaseclient
node_api -->|"sends API requests"| node_ingest
node_ingest -->|"checks user"| node_auth
node_ingest -->|"extracts URLs"| node_webextract
node_ingest -->|"extracts uploads"| node_fileextract
node_ingest -->|"chunks entries"| node_chunker
node_ingest -->|"creates vectors"| node_embedder
node_ingest -->|"stores entries"| node_dbclient
node_query -->|"embeds queries"| node_embedder
node_ingest -.->|"routes questions"| node_query
node_query -.->|"retrieves chunks"| node_dbclient
node_query -.->|"generates answers"| node_llm
node_llm -.->|"calls model"| node_modelprovider
node_dbclient -->|"reads and writes"| node_supabase
node_supabaseclient -->|"authenticates users"| node_supabase
node_ingest -.->|"sends account mail"| node_email

click node_authscreens "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(auth)/sign-in.tsx"
click node_onboarding "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/onboarding/index.tsx"
click node_home "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(app)/home.tsx"
click node_editor "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/components/NoteEditorModal.tsx"
click node_ask "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(app)/ask.tsx"
click node_chat "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/components/ChatMessage.tsx"
click node_browse "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(app)/browse/index.tsx"
click node_entrydetail "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(app)/browse/%5Bid%5D.tsx"
click node_settings "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(app)/settings.tsx"
click node_authstore "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/stores/authStore.ts"
click node_entrystore "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/stores/entryStore.ts"
click node_api "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/lib/api.ts"
click node_supabaseclient "https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/lib/supabase.ts"
click node_ingest "https://github.com/singh-kuldeep/wisdombase/blob/main/backend/main.py"
click node_webextract "https://github.com/singh-kuldeep/wisdombase/blob/main/backend/web_extract.py"
click node_fileextract "https://github.com/singh-kuldeep/wisdombase/blob/main/backend/file_extract.py"
click node_chunker "https://github.com/singh-kuldeep/wisdombase/blob/main/backend/chunker.py"
click node_embedder "https://github.com/singh-kuldeep/wisdombase/blob/main/backend/embedder.py"
click node_query "https://github.com/singh-kuldeep/wisdombase/blob/main/backend/rag.py"
click node_llm "https://github.com/singh-kuldeep/wisdombase/blob/main/backend/llm.py"
click node_auth "https://github.com/singh-kuldeep/wisdombase/blob/main/backend/auth.py"
click node_dbclient "https://github.com/singh-kuldeep/wisdombase/blob/main/backend/db.py"
click node_email "https://github.com/singh-kuldeep/wisdombase/blob/main/backend/email_service.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_authscreens,node_onboarding,node_home,node_editor,node_ask,node_chat,node_browse,node_entrydetail,node_settings,node_authstore,node_entrystore,node_api,node_user toneBlue
class node_webextract,node_fileextract,node_chunker,node_embedder toneAmber
class node_ingest,node_query,node_auth toneMint
class node_supabaseclient,node_llm,node_dbclient,node_supabase,node_email toneRose
class node_modelprovider toneIndigo
```

## Components

### Mobile app

- [Sign-in and signup](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(auth)/sign-in.tsx): `frontend/app/(auth)/sign-in.tsx`
- [Brain-dump onboarding](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/onboarding/index.tsx): `frontend/app/onboarding/index.tsx`
- [Capture home](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(app)/home.tsx): `frontend/app/(app)/home.tsx`
- [Note editor](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/components/NoteEditorModal.tsx): `frontend/components/NoteEditorModal.tsx`
- [Ask screen](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(app)/ask.tsx): `frontend/app/(app)/ask.tsx`
- [Chat messages](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/components/ChatMessage.tsx): `frontend/components/ChatMessage.tsx`
- [Browse entries](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(app)/browse/index.tsx): `frontend/app/(app)/browse/index.tsx`
- [Entry detail](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(app)/browse/%5Bid%5D.tsx): `frontend/app/(app)/browse/[id].tsx`
- [Settings](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/app/(app)/settings.tsx): `frontend/app/(app)/settings.tsx`
- [Auth state](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/stores/authStore.ts): `frontend/stores/authStore.ts`
- [Entry state](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/stores/entryStore.ts): `frontend/stores/entryStore.ts`
- [API client](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`

### Knowledge capture

- [Link extraction](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/web_extract.py): `backend/web_extract.py`
- [File extraction](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/file_extract.py): `backend/file_extract.py`
- [Text chunking](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/chunker.py): `backend/chunker.py`
- [Embedding generation](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/embedder.py): `backend/embedder.py`

### Backend workflows

- [Entry ingestion](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/main.py): `backend/main.py`
- [Question answering](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/rag.py): `backend/rag.py`
- [Request authentication](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/auth.py): `backend/auth.py`

### Data and providers

- [Supabase client](https://github.com/singh-kuldeep/wisdombase/blob/main/frontend/lib/supabase.ts): `frontend/lib/supabase.ts`
- [Model adapters](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/llm.py): `backend/llm.py`
- [Database access](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/db.py): `backend/db.py`
- **Supabase and pgvector**
- [Email delivery](https://github.com/singh-kuldeep/wisdombase/blob/main/backend/email_service.py): `backend/email_service.py`

### Other components

- **App user**
- **LLM providers**

## Connections

- App user → Sign-in and signup: signs up
- App user → Brain-dump onboarding: completes prompts
- App user → Capture home: captures thoughts
- App user → Ask screen: asks questions
- App user → Browse entries: browses notes
- App user → Settings: manages account
- Sign-in and signup → Auth state: uses auth state (evidence: `frontend/app/(auth)/sign-in.tsx`)
- Auth state → Supabase client: uses client (evidence: `frontend/stores/authStore.ts`)
- Capture home → Note editor: opens editor (evidence: `frontend/app/(app)/home.tsx`)
- Note editor → API client: updates entry (evidence: `frontend/components/NoteEditorModal.tsx`)
- Capture home → API client: calls backend (evidence: `frontend/app/(app)/home.tsx`)
- Ask screen → API client: submits questions (evidence: `frontend/app/(app)/ask.tsx`)
- Ask screen → Chat messages: renders replies (evidence: `frontend/app/(app)/ask.tsx`)
- Browse entries → API client: loads and deletes (evidence: `frontend/app/(app)/browse/index.tsx`)
- Browse entries → Note editor: opens editor (evidence: `frontend/app/(app)/browse/index.tsx`)
- Entry detail → API client: loads entry (evidence: `frontend/app/(app)/browse/[id].tsx`)
- Settings → API client: calls backend (evidence: `frontend/app/(app)/settings.tsx`)
- Entry state → API client: fetches entries (evidence: `frontend/stores/entryStore.ts`)
- API client → Supabase client: gets auth token (evidence: `frontend/lib/api.ts`)
- API client → Entry ingestion: sends API requests
- Entry ingestion → Request authentication: checks user (evidence: `backend/main.py`)
- Entry ingestion → Link extraction: extracts URLs (evidence: `backend/main.py`)
- Entry ingestion → File extraction: extracts uploads (evidence: `backend/main.py`)
- Entry ingestion → Text chunking: chunks entries (evidence: `backend/main.py`)
- Entry ingestion → Embedding generation: creates vectors (evidence: `backend/main.py`)
- Entry ingestion → Database access: stores entries (evidence: `backend/main.py`)
- Question answering → Embedding generation: embeds queries (evidence: `backend/rag.py`)
- Entry ingestion → Question answering: routes questions (evidence: `backend/main.py`)
- Question answering → Database access: retrieves chunks
- Question answering → Model adapters: generates answers
- Model adapters → LLM providers: calls model
- Database access → Supabase and pgvector: reads and writes (evidence: `backend/db.py`)
- Supabase client → Supabase and pgvector: authenticates users
- Entry ingestion → Email delivery: sends account mail (evidence: `backend/main.py`)
