# shanikn/smart_notes architecture

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

- Interactive diagram: https://gitdiagram.com/shanikn/smart_notes
- Repository: https://github.com/shanikn/smart_notes

## Overview

Smart Mind is a mobile notes app that resurfaces tasks by place and time. The main workflow is: a user creates or edits a note; the API stores and enriches it; the phone syncs notes and place data, then uses local alarms and geofences to notify the user, including while offline. The graph includes documented search, store-alert, account, and ranking capabilities. Several backend and mobile modules were not sampled, so their internal links are included only where the README or source index supports them.

Main entry points: [`api/main.py`](https://github.com/shanikn/smart_notes/blob/main/api/main.py) (FastAPI routes), [`mobile/src/api/client.ts`](https://github.com/shanikn/smart_notes/blob/main/mobile/src/api/client.ts) (API client), [`mobile/App.tsx`](https://github.com/shanikn/smart_notes/blob/main/mobile/App.tsx) (App navigation), [`agents/pipeline.py`](https://github.com/shanikn/smart_notes/blob/main/agents/pipeline.py) (Note enrichment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile_app["Mobile app"]
  node_app["App navigation<br/>[App.tsx]"]
  node_note_screens["Note screens"]
  node_settings["Settings<br/>[SettingsScreen.tsx]"]
  node_mobile_api["API client<br/>[client.ts]"]
  node_auth["Firebase auth<br/>[AuthContext.tsx]"]
  node_note_model["Note model<br/>[notes.ts]"]
end

subgraph group_mobile_alerts["Location and alerts"]
  node_location["Phone location<br/>[currentPosition.ts]"]
  node_address_search["Address search<br/>[addressSearch.ts]"]
  node_geofences["Place geofences<br/>[geofence.ts]"]
  node_store_alerts["Store alerts<br/>[storeAlerts.ts]"]
  node_arrival_alerts["Arrival notifications"]
  node_exact_alarms["Exact alarms"]
end

subgraph group_backend["Backend API"]
  node_api["FastAPI routes<br/>[main.py]"]
  node_places["Places and folders<br/>[places.py]"]
  node_geocoding["Geocoding<br/>[geocode.py]"]
  node_nearby_search["Nearby stores<br/>[nearby.py]"]
end

subgraph group_intelligence["Enrichment and ranking"]
  node_pipeline["Note enrichment<br/>[pipeline.py]"]
  node_categorizer["Category inference<br/>[categorizer.py]"]
  node_relevance["Semantic ranking<br/>[relevance.py]"]
end

subgraph group_data["User data"]
  node_mongo[("MongoDB<br/>[notepad.py]")]
  node_vectors[("ChromaDB vectors<br/>[embedding_model.py]")]
end

node_user(("User"))
node_firebase_service["Firebase Auth service"]
node_search_services["Google Places / OSM"]
node_phone_os["Phone OS services"]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_note_screens
node_app -->|"mounts"| node_auth
node_note_screens -.->|"syncs notes"| node_mobile_api
node_settings -.->|"manages data"| node_mobile_api
node_auth -->|"authenticates with"| node_firebase_service
node_auth -->|"provides tokens"| node_mobile_api
node_mobile_api -->|"requests API"| node_api
node_note_screens -.->|"uses"| node_note_model
node_api -->|"enriches notes"| node_pipeline
node_pipeline -->|"infers note fields"| node_categorizer
node_pipeline -->|"saves notes"| node_mongo
node_pipeline -->|"ingests embeddings"| node_vectors
node_api -->|"reads and writes"| node_mongo
node_api -->|"manages places"| node_places
node_api -->|"searches addresses"| node_geocoding
node_api -->|"finds nearby stores"| node_nearby_search
node_api -->|"ranks reminders"| node_relevance
node_relevance -.->|"uses embeddings"| node_vectors
node_address_search -->|"gets recent position"| node_location
node_address_search -->|"searches backend"| node_api
node_address_search -.->|"fallback search"| node_search_services
node_geocoding -->|"queries providers"| node_search_services
node_nearby_search -->|"queries OpenStreetMap"| node_search_services
node_geofences -->|"registers regions"| node_phone_os
node_geofences -->|"dispatches store events"| node_store_alerts
node_geofences -->|"dispatches place events"| node_arrival_alerts
node_store_alerts -.->|"fetches nearby data"| node_mobile_api
node_arrival_alerts -->|"fetches reminder notes"| node_mobile_api
node_exact_alarms -->|"schedules alarms"| node_phone_os
node_arrival_alerts -->|"shows notifications"| node_phone_os
node_app -->|"polls reminders"| node_arrival_alerts
node_app -->|"starts location monitoring"| node_geofences

click node_app "https://github.com/shanikn/smart_notes/blob/main/mobile/App.tsx"
click node_note_screens "https://github.com/shanikn/smart_notes/tree/main/mobile/src/screens"
click node_settings "https://github.com/shanikn/smart_notes/blob/main/mobile/src/screens/SettingsScreen.tsx"
click node_mobile_api "https://github.com/shanikn/smart_notes/blob/main/mobile/src/api/client.ts"
click node_auth "https://github.com/shanikn/smart_notes/blob/main/mobile/src/context/AuthContext.tsx"
click node_note_model "https://github.com/shanikn/smart_notes/blob/main/mobile/src/types/notes.ts"
click node_location "https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/currentPosition.ts"
click node_address_search "https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/addressSearch.ts"
click node_geofences "https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/geofence.ts"
click node_store_alerts "https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/storeAlerts.ts"
click node_arrival_alerts "https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/reminderNotifier.ts"
click node_exact_alarms "https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/scheduledReminders.ts"
click node_api "https://github.com/shanikn/smart_notes/blob/main/api/main.py"
click node_places "https://github.com/shanikn/smart_notes/blob/main/places.py"
click node_geocoding "https://github.com/shanikn/smart_notes/blob/main/geocode.py"
click node_nearby_search "https://github.com/shanikn/smart_notes/blob/main/nearby.py"
click node_pipeline "https://github.com/shanikn/smart_notes/blob/main/agents/pipeline.py"
click node_categorizer "https://github.com/shanikn/smart_notes/blob/main/agents/categorizer.py"
click node_relevance "https://github.com/shanikn/smart_notes/blob/main/agents/relevance.py"
click node_mongo "https://github.com/shanikn/smart_notes/blob/main/notepad.py"
click node_vectors "https://github.com/shanikn/smart_notes/blob/main/agents/embedding_model.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_note_screens,node_settings,node_mobile_api,node_auth,node_note_model,node_user toneBlue
class node_location,node_address_search,node_geofences,node_store_alerts,node_arrival_alerts,node_exact_alarms toneAmber
class node_api,node_places,node_geocoding,node_nearby_search toneMint
class node_pipeline,node_categorizer,node_relevance toneRose
class node_mongo,node_vectors,node_firebase_service,node_search_services,node_phone_os toneIndigo
```

## Components

### Mobile app

- [App navigation](https://github.com/shanikn/smart_notes/blob/main/mobile/App.tsx): `mobile/App.tsx`
- [Note screens](https://github.com/shanikn/smart_notes/tree/main/mobile/src/screens): `mobile/src/screens`
- [Settings](https://github.com/shanikn/smart_notes/blob/main/mobile/src/screens/SettingsScreen.tsx): `mobile/src/screens/SettingsScreen.tsx`
- [API client](https://github.com/shanikn/smart_notes/blob/main/mobile/src/api/client.ts): `mobile/src/api/client.ts`
- [Firebase auth](https://github.com/shanikn/smart_notes/blob/main/mobile/src/context/AuthContext.tsx): `mobile/src/context/AuthContext.tsx`
- [Note model](https://github.com/shanikn/smart_notes/blob/main/mobile/src/types/notes.ts): `mobile/src/types/notes.ts`

### Location and alerts

- [Phone location](https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/currentPosition.ts): `mobile/src/services/currentPosition.ts`
- [Address search](https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/addressSearch.ts): `mobile/src/services/addressSearch.ts`
- [Place geofences](https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/geofence.ts): `mobile/src/services/geofence.ts`
- [Store alerts](https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/storeAlerts.ts): `mobile/src/services/storeAlerts.ts`
- [Arrival notifications](https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/reminderNotifier.ts): `mobile/src/services/reminderNotifier.ts`
- [Exact alarms](https://github.com/shanikn/smart_notes/blob/main/mobile/src/services/scheduledReminders.ts): `mobile/src/services/scheduledReminders.ts`

### Backend API

- [FastAPI routes](https://github.com/shanikn/smart_notes/blob/main/api/main.py): `api/main.py`
- [Places and folders](https://github.com/shanikn/smart_notes/blob/main/places.py): `places.py`
- [Geocoding](https://github.com/shanikn/smart_notes/blob/main/geocode.py): `geocode.py`
- [Nearby stores](https://github.com/shanikn/smart_notes/blob/main/nearby.py): `nearby.py`

### Enrichment and ranking

- [Note enrichment](https://github.com/shanikn/smart_notes/blob/main/agents/pipeline.py): `agents/pipeline.py`
- [Category inference](https://github.com/shanikn/smart_notes/blob/main/agents/categorizer.py): `agents/categorizer.py`
- [Semantic ranking](https://github.com/shanikn/smart_notes/blob/main/agents/relevance.py): `agents/relevance.py`

### User data

- [MongoDB](https://github.com/shanikn/smart_notes/blob/main/notepad.py): `notepad.py`
- [ChromaDB vectors](https://github.com/shanikn/smart_notes/blob/main/agents/embedding_model.py): `agents/embedding_model.py`

### Other components

- **User**
- **Firebase Auth service**
- **Google Places / OSM**
- **Phone OS services**

## Connections

- User → App navigation: uses
- App navigation → Note screens: routes to (evidence: `mobile/App.tsx`)
- App navigation → Firebase auth: mounts (evidence: `mobile/App.tsx`)
- Note screens → API client: syncs notes
- Settings → API client: manages data
- Firebase auth → Firebase Auth service: authenticates with (evidence: `mobile/src/context/AuthContext.tsx`)
- Firebase auth → API client: provides tokens
- API client → FastAPI routes: requests API
- Note screens → Note model: uses
- FastAPI routes → Note enrichment: enriches notes (evidence: `api/main.py`)
- Note enrichment → Category inference: infers note fields (evidence: `agents/pipeline.py`)
- Note enrichment → MongoDB: saves notes (evidence: `agents/pipeline.py`)
- Note enrichment → ChromaDB vectors: ingests embeddings (evidence: `agents/pipeline.py`)
- FastAPI routes → MongoDB: reads and writes (evidence: `notepad.py`)
- FastAPI routes → Places and folders: manages places (evidence: `api/main.py`)
- FastAPI routes → Geocoding: searches addresses (evidence: `api/main.py`)
- FastAPI routes → Nearby stores: finds nearby stores (evidence: `api/main.py`)
- FastAPI routes → Semantic ranking: ranks reminders
- Semantic ranking → ChromaDB vectors: uses embeddings
- Address search → Phone location: gets recent position (evidence: `mobile/src/services/addressSearch.ts`)
- Address search → FastAPI routes: searches backend (evidence: `mobile/src/services/addressSearch.ts`)
- Address search → Google Places / OSM: fallback search (evidence: `mobile/src/services/addressSearch.ts`)
- Geocoding → Google Places / OSM: queries providers
- Nearby stores → Google Places / OSM: queries OpenStreetMap
- Place geofences → Phone OS services: registers regions (evidence: `mobile/src/services/geofence.ts`)
- Place geofences → Store alerts: dispatches store events (evidence: `mobile/src/services/geofence.ts`)
- Place geofences → Arrival notifications: dispatches place events (evidence: `mobile/src/services/geofence.ts`)
- Store alerts → API client: fetches nearby data
- Arrival notifications → API client: fetches reminder notes (evidence: `mobile/src/services/reminderNotifier.ts`)
- Exact alarms → Phone OS services: schedules alarms (evidence: `mobile/src/services/scheduledReminders.ts`)
- Arrival notifications → Phone OS services: shows notifications
- App navigation → Arrival notifications: polls reminders (evidence: `mobile/App.tsx`)
- App navigation → Place geofences: starts location monitoring (evidence: `mobile/App.tsx`)
