Maya is a mobile app that helps people stay on top of administrative documents by letting them scan a document and turning it into structured, searchable information.
This repo contains:
- React Native iOS app in
mobileApp/ - FastAPI backend in
app/(Postgres + optional OCR/LLM/RAG integrations)
- Scan documents on mobile with live border detection (
react-native-document-scanner-plugin) - Add from Photos or Files (PDFs + images) — choose a photo or a file instead of scanning
- Upload + classify + extract fields (backend pipeline: multimodal LLM via OpenRouter → persistence)
- Auto-organization into a folder-like hierarchy:
doctype/expediteur/date - Browse documents like folders (doctype → expediteur → documents)
- Preview scanned images served from backend
/storage/... - Semantic search (Chroma vector DB) (disabled in dev mode)
- Optional Google Calendar event for deadlines (disabled in dev mode)
iPhone (React Native)
- Scan (Vision/Doc scanner)
- Auth (JWT stored in AsyncStorage)
- Upload / Validate / Browse / Search
|
v
FastAPI (app/main.py)
- Auth: /register, /login, /users/me
- Upload: /upload (stores image + extracts info via OpenRouter)
- Validate: /validate (finalize classification + move file)
- Browse: /user/documents
- Search: /user/search (Chroma)
- Chat: /chat and /chat/stream (OpenRouter)
|
+--> Postgres (documents + users)
+--> /storage static files (images)
+--> (optional) OpenRouter (Gemini 3 Flash)
+--> (optional) ChromaDB semantic search
+--> (optional) Google Calendar events
- Node.js
>=16 - Xcode
- CocoaPods (
pod) - Docker (for backend + Postgres)
From repo root:
docker compose up -d --buildBackend should be reachable at:
http://localhost:8000/docs
If the backend starts before Postgres is ready, restart it once:
docker compose restart webFrom mobileApp/:
npm start -- --host 0.0.0.0If port 8081 is already in use:
lsof -nP -iTCP:8081 -sTCP:LISTEN
kill <PID>cd mobileApp
npm install
cd ios
pod installOpen the workspace in Xcode (important: workspace, not xcodeproj):
mobileApp/ios/mobileApp.xcworkspace
Select your iPhone, set a Development Team, then Run.
On a real iPhone, localhost points to the phone itself.
You need your Mac LAN IP (example):
ipconfig getifaddr en0Sanity checks from the iPhone (Safari):
- Backend:
http://<mac-ip>:8000/docs - Metro:
http://<mac-ip>:8081/status(should returnpackager-status:running)
The app’s API_BASE_URL is derived from the Metro host (see mobileApp/src/config/apiConfig.js), so on-device it should automatically use http://<mac-ip>:8000 in debug builds.
Set MAYA_DEV_MODE=1 (via .env or container env). In DEV mode the backend:
- accepts uploads and stores files
- returns mocked
extracted_info(no OCR/LLM required) - skips Chroma and Google Calendar
Backend:
- Set
GOOGLE_WEB_CLIENT_IDandGOOGLE_IOS_CLIENT_IDin.env(or use legacyGOOGLE_IDas a comma-separated list). - Mobile exchanges the Google
id_tokenviaPOST /auth/googleto receive{access_token, refresh_token}.
Mobile:
- Update
mobileApp/src/config/googleConfig.jswith your Google OAuth client IDs. - Ensure
mobileApp/ios/mobileApp/Info.plistcontains the reversed client ID URL scheme. - Install deps and pods:
cd mobileApp && npm install && cd ios && pod install.
Provide credentials/keys in .env:
OPENROUTER_API_KEY(Gemini 3 Flash via OpenRouter)OPENAI_API_KEY(still used for Chroma embeddings)ADMIN(Chroma basic auth)GOOGLE_SA_CREDENTIALS(Calendar service account, optional)
- CocoaPods “boost checksum incorrect”: the upstream
boostorg.jfrog.ioURL can return HTML;pod installwill fail. Usepod cache clean boost --alland re-runpod install --repo-update. - Flipper build errors: Flipper is disabled in
mobileApp/ios/Podfileto avoid toolchain issues. - iOS deployment target: set to iOS 13+ (required by the scanner plugin).
- iPhone can’t reach backend: check Wi‑Fi isolation and macOS firewall; verify
http://<mac-ip>:8000/docsloads on the iPhone. - PDF import says “no extractable text”: the PDF is likely a scanned image-only PDF; use Scan instead (or run OCR on the PDF first).
- iOS setup notes:
docs/ios-setup.md