How vattey12dec/pdf-brain-mobile-app works
PDF Brain accepts authenticated PDF uploads, extracts and chunks their text, indexes embeddings, then retrieves relevant passages to produce cited Gemini answers. The backend also exposes document management, chat-history, and conversation operations. The README describes a Flutter client, but this tree contains only native platform scaffolding, not its application UI; client requests are therefore represented at the API boundary. Edges reflect sampled backend calls and README-documented integrations; unsampled details are omitted.
Main entry points: documents.py Document API · chat.py Chat API · main.py FastAPI application · database.py SQL database access
Components 18
API and identity
- FastAPI application
backend/app/main.py - JWT authentication
backend/app/core/security.py - API schemas
backend/app/schemas/api_schemas.py - Application settings
backend/app/core/config.py
PDF ingestion
- Document API
backend/app/routers/documents.py - PDF validation and extraction
backend/app/services/pdf_service.py - Text chunking
backend/app/services/chunking_service.py - Vector service
backend/app/services/vector_service.py
Question answering
- Chat API
backend/app/routers/chat.py - RAG answer generation
backend/app/services/rag_service.py - Conversation API
backend/app/routers/conversations.py
Persistence
- ChromaDB index
- Persistence models
backend/app/models/db_models.py - SQL database access
backend/app/core/database.py - SQLite or SQL store
Other components
- User
- Supabase Auth
- Gemini API
Connections 26
- User → FastAPI application: sends requests
- FastAPI application → Document API: registers routes
backend/app/main.py - FastAPI application → Chat API: registers routes
backend/app/main.py - FastAPI application → Conversation API: registers routes
backend/app/main.py - Document API → JWT authentication: requires identity
backend/app/routers/documents.py - Chat API → JWT authentication: requires identity
backend/app/routers/chat.py - Conversation API → JWT authentication: requires identity
backend/app/routers/conversations.py - JWT authentication → Supabase Auth: verifies token
backend/app/core/security.py - Document API → PDF validation and extraction: validates and extracts
backend/app/routers/documents.py - Document API → Text chunking: creates chunks
backend/app/routers/documents.py - Document API → Vector service: indexes chunks
backend/app/routers/documents.py - Text chunking → PDF validation and extraction: consumes pages
backend/app/services/chunking_service.py - Vector service → ChromaDB index: queries and writes
backend/app/services/vector_service.py - Chat API → Vector service: retrieves chunks
backend/app/routers/chat.py - Chat API → RAG answer generation: requests answer
backend/app/routers/chat.py - RAG answer generation → Gemini API: generates answer
backend/app/services/rag_service.py - Chat API → SQL database access: stores chat history
backend/app/routers/chat.py - Conversation API → SQL database access: manages conversations
backend/app/routers/conversations.py - SQL database access → Persistence models: registers tables
backend/app/core/database.py - SQL database access → SQLite or SQL store: reads and writes
backend/app/core/database.py - FastAPI application → SQL database access: initializes storage
backend/app/main.py - Document API → Persistence models: reads and updates
backend/app/routers/documents.py - Document API → API schemas: validates responses
backend/app/routers/documents.py - Chat API → API schemas: uses request and response types
backend/app/routers/chat.py - Conversation API → Persistence models: reads and updates
backend/app/routers/conversations.py - Application settings → Gemini API: configures models