How dsanh14/ai_secondbrain works
AI Second Brain turns user-provided knowledge into summaries, extracted tasks, searchable answers with citations, and semantically linked notes. The main workflow runs from the frontend’s upload and note interfaces through FastAPI routes to LLM, retrieval, and persistence services; the graph view presents stored note relationships. The README documents audio transcription and the frontend/API capabilities, but the supplied excerpts do not show all wiring, so those links are attributed to the README rather than inferred from unsampled code.
Main entry points: main.py FastAPI application · database.py Persistence operations · api.ts API client · notes.py Notes routes
Components 23
Frontend
- Upload interface
frontend/components/UploadForm.tsx - Notes interface
frontend/app/notes/page.tsx - Search interface
frontend/components/SearchBox.tsx - Task interface
frontend/components/TaskList.tsx - Graph view
frontend/components/GraphView.tsx - API client
frontend/lib/api.ts - App pages
frontend/app
API
- FastAPI application
backend/main.py - Notes routes
backend/routers/notes.py - Search routes
backend/routers/search.py - Summarize routes
backend/routers/summarize.py - Task routes
backend/routers/tasks.py - API schemas
backend/models/schemas.py
AI services
- LLM chains
backend/services/llm.py - Audio transcription
backend/services/speech.py - Semantic retrieval
backend/services/retriever.py - Embeddings and index
backend/services/embeddings.py - Semantic linking
backend/services/graph.py
Knowledge data
- Persistence operations
backend/services/database.py - Note and task records
backend/models/orm.py - PostgreSQL
- Vector store
Other components
- Knowledge user
Connections 34
- Knowledge user → Upload interface: uploads content
README.md - Knowledge user → Notes interface: manages notes
README.md - Knowledge user → Search interface: asks questions
README.md - Upload interface → API client: sends requests
README.md - Notes interface → API client: sends requests
README.md - Search interface → API client: sends requests
README.md - Task interface → API client: sends requests
README.md - API client → FastAPI application: calls API
README.md - App pages → Upload interface: renders
README.md - App pages → Notes interface: renders
README.md - App pages → Search interface: renders
README.md - App pages → Graph view: renders
README.md - FastAPI application → Notes routes: registers routes
backend/main.py - FastAPI application → Search routes: registers routes
backend/main.py - FastAPI application → Summarize routes: registers routes
backend/main.py - FastAPI application → Task routes: registers routes
backend/main.py - FastAPI application → Persistence operations: initializes tables
backend/main.py - Summarize routes → LLM chains: builds summary chain
README.md - Task routes → LLM chains: builds task chain
backend/routers/tasks.py - Task routes → Persistence operations: saves tasks
backend/routers/tasks.py - Search routes → Semantic retrieval: creates retriever
backend/routers/search.py - Search routes → LLM chains: builds QA chain
backend/routers/search.py - Notes routes → Semantic retrieval: indexes note
backend/routers/notes.py - Notes routes → Semantic linking: links notes
backend/routers/notes.py - Notes routes → Persistence operations: reads and saves
backend/routers/notes.py - Semantic retrieval → Embeddings and index: indexes and retrieves
backend/services/retriever.py - Semantic linking → Semantic retrieval: finds neighbors
backend/services/graph.py - Semantic linking → Persistence operations: stores links
backend/services/graph.py - Persistence operations → Note and task records: persists records
backend/services/database.py - Persistence operations → PostgreSQL: reads and writes
backend/services/database.py - Embeddings and index → Vector store: indexes chunks
README.md - Graph view → API client: loads graph data
README.md - Upload interface → Audio transcription: transcribes audio
README.md - API schemas → Notes routes: defines payloads
backend/routers/notes.py