How patrick-1810/booklens-backend works
BookLens is a document-digitization backend. A client submits an image to the OCR routes, which invoke image/OCR processing and the documented dictionary-validation stage, then return structured text and persist document history. The API also supports account authentication, document management and comments, plus searchable-PDF and visual-overlay exports. The README documents the product stages; the sampled OCR excerpt is partial, so some processing and export links rely on the SOURCE INDEX rather than visible call sites.
Main entry points: ocr.py OCR and document routes · auth.py Authentication routes · security.py JWT security · models.py User and document entities
Components 13
API and Accounts
- FastAPI application
app/main.py - OCR and document routes
app/routes/ocr.py - Authentication routes
app/routes/auth.py - Dictionary autocomplete
app/routes/dictionary.py - JWT security
app/core/security.py - Request and response schemas
app/core/schemas.py
Document Processing
- Image and OCR processor
app/core/processor.py - Docling conversion
app/core/docling_processor.py
Persistence
- Database configuration
app/database/config.py - User and document entities
app/database/models.py - Relational database
Document Outputs
- Searchable PDF and overlay
app/core/pdf_writer.py
Other components
- Frontend client
Connections 20
- Frontend client → FastAPI application: sends API requests
README.md - FastAPI application → OCR and document routes: registers routes
app/main.py - FastAPI application → Authentication routes: registers routes
app/main.py - FastAPI application → Dictionary autocomplete: registers routes
app/main.py - OCR and document routes → Image and OCR processor: invokes processing
app/routes/ocr.py - OCR and document routes → Docling conversion: invokes conversion
app/routes/ocr.py - OCR and document routes → Searchable PDF and overlay: uses export tools
app/routes/ocr.py - OCR and document routes → User and document entities: reads and writes documents
app/routes/ocr.py - OCR and document routes → JWT security: requires authenticated user
app/routes/ocr.py - OCR and document routes → Dictionary autocomplete: validates extracted words
README.md - Authentication routes → JWT security: creates and verifies tokens
app/routes/auth.py - Authentication routes → User and document entities: queries users
app/routes/auth.py - Authentication routes → Database configuration: gets database session
app/routes/auth.py - Authentication routes → Request and response schemas: accepts typed inputs
app/routes/auth.py - JWT security → User and document entities: loads current user
app/core/security.py - JWT security → Database configuration: gets database session
app/core/security.py - JWT security → Request and response schemas: returns token data
app/core/security.py - Database configuration → Relational database: creates engine sessions
- User and document entities → Database configuration: uses ORM base
app/database/models.py - User and document entities → Relational database: defines persisted entities