SmartScan is a document scanning and AI-powered search application that allows users to upload documents, extract text using OCR, and perform semantic searches using vector embeddings.
- Document Upload: Upload PDF, images, and text files from your device or camera
- OCR Processing: Extract text from documents using Eden AI Document Parser and Image OCR
- Vector Embeddings: Create semantic embeddings using OpenAI's embedding model
- Semantic Search: Search documents by meaning, not just keywords
- Multi-platform: Works on iOS, Android, and Web with a single codebase
- Node.js 16+ and npm
- Expo CLI (
npm install -g expo-cli
) - Supabase account
- Eden AI API key
- OpenAI API key
- Clone the repository:
git clone https://github.com/yourusername/smartscan.git
cd smartscan
- Install dependencies:
npm install
- Set up environment variables by creating a
.env
file:
EXPO_PUBLIC_SUPABASE_URL=your_supabase_url
EXPO_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
EXPO_PUBLIC_EDEN_AI_API_KEY=your_eden_ai_api_key
EXPO_PUBLIC_OPENAI_API_KEY=your_openai_api_key
EXPO_PUBLIC_APP_URL=your_app_url
- Initialize the database:
npm run db:init
- Set up authentication:
npm run auth:setup
- Start the development server:
npm start
The application requires a Supabase project with the following:
-
Database Tables:
users
: For user profilesdocuments
: For document metadatadocument_embeddings
: For vector embeddings
-
Vector Extension:
- Make sure the
vector
extension is enabled in your Supabase project
- Make sure the
-
Storage Bucket:
- Create a
documents
bucket for file storage
- Create a
-
Authentication:
- Enable Google OAuth provider
The db:init
script will help you set up most of this automatically.
- Upload: User uploads a document via the DocumentUploader component
- Storage: File is stored in Supabase Storage
- OCR: Eden AI extracts text from the document using Document Parser (for PDFs) or Image OCR (for images)
- Embedding: OpenAI creates vector embeddings for the extracted text
- Storage: Embeddings are stored in the database with PostgreSQL's vector extension
- Search: Users can search using natural language queries
DocumentUploader.tsx
: UI for uploading documentsDocumentSearch.tsx
: UI for searching documentsDocumentList.tsx
: UI for viewing and managing documents
documentQueries.uploadAndProcessDocument
: Handles document upload and processingprocessDocumentWithOCR
: Extracts text from documentscreateDocumentEmbeddings
: Creates vector embeddings for extracted textsearchDocumentsByEmbedding
: Performs semantic search
If you encounter issues with PDF processing:
- Make sure your Eden AI API key is correctly set up with access to Document Parser and Image OCR services
- Verify that the PDF is not password-protected
- Try converting the PDF to images before uploading for better OCR results
If vector search is not working:
- Confirm the
vector
extension is enabled in Supabase - Check that the
search_document_embeddings
function is properly created - Verify embeddings are being stored correctly in the
document_embeddings
table
MIT