A web app to photograph book pages, extract text via OCR, and count words. Designed as a companion metric for tracking reading progress.
Live Demo: word-counter.ankile.com
- Book Management - Create and organize books
- Firebase Import - Import books from Book Tracker app
- Photo Upload - Drag & drop or select multiple page photos (mobile camera supported)
- OCR Processing - Google Cloud Vision extracts text from images
- Word Counting - Per-page and total word counts with averages
- Readability Metrics - Flesch-Kincaid grade level and reading ease scores
- OCR Visualization - Toggle bounding box overlay to see what was detected
- Lightbox View - Click any thumbnail to view full-size with OCR overlay
- Frontend: Next.js 16 + React + Tailwind CSS
- Backend: Convex (database + file storage + serverless functions)
- OCR: Google Cloud Vision API
- Hosting: Vercel
- Node.js 18+
- Google Cloud account with Vision API enabled
- Convex account (free tier works)
git clone https://github.com/ankile/word-counter.git
cd word-counter
npm installnpx convex devThis will prompt you to log in to Convex and create a project. It automatically adds NEXT_PUBLIC_CONVEX_URL to .env.local.
Get an API key from Google Cloud Console with Vision API enabled.
Add it to Convex:
npx convex env set GCP_VISION_API_KEY "your-api-key-here"To import books from a Firebase/Firestore Book Tracker app:
npx convex env set FIREBASE_SERVICE_ACCOUNT_KEY "$(cat path/to/serviceAccountKey.json)"In two terminals:
# Terminal 1: Convex backend
npx convex dev
# Terminal 2: Next.js frontend
npm run devThe app is deployed to Vercel with automatic deploys from the main branch:
- Frontend: Vercel (connected to GitHub)
- Backend: Convex Cloud
- Domain: word-counter.ankile.com
To deploy changes:
# Deploy Convex functions
npx convex deploy
# Push to GitHub (triggers Vercel deploy)
git push origin main- Click + New Book to create a book (or import from Book Tracker)
- Click on the book to open it
- Upload photos of book pages (drag & drop or click to select)
- Watch OCR process each page in real-time
- View word counts per page and total for the book
- Check readability metrics (grade level, reading ease)
- Click Show OCR to visualize what was detected
- Click any thumbnail to view full-size
The OCR output is cleaned with light heuristics:
- Removes standalone page numbers
- Removes short all-caps lines (headers)
- Rejoins hyphenated words at line breaks
MIT