Chapterize is a client-side web app that detects chapter boundaries in PDF books with Google Gemini and exports each chapter as a separate PDF. View and/or download each chapter separately or download all of them bundled as a ZIP file.
- AI-assisted chapter detection: Uses Gemini to identify chapter starts from lightweight page text snippets.
- Browser-based PDF processing: Splitting and ZIP generation happen locally in the browser.
- Privacy-conscious workflow: The full PDF binary is not uploaded by Chapterize; only extracted text snippets are sent to Gemini.
- Bulk export: Download chapters individually or as a ZIP archive.
- Static deployment: Built with React and Vite, so it can be hosted on any static site platform.
- React and Vite
- Tailwind CSS
- Google Gemini via
@google/generative-ai - pdf.js for text extraction
- pdf-lib for PDF generation
- JSZip for archive downloads
- Node.js 18 or newer
- npm
- A Gemini API key from Google AI Studio
git clone <repository-url>
cd chapterize
npm install
cp .env.example .envAdd your Gemini API key to .env:
VITE_GEMINI_API_KEY=your_gemini_api_key_hereStart the development server:
npm run devnpm run devstarts the local Vite development server.npm run buildcreates a production build.npm run previewpreviews the production build locally.npm run lintruns ESLint.
- Chapterize loads the PDF in the browser with pdf.js.
- It extracts the first 300 characters of text from each page.
- It sends those snippets to Gemini and asks for structured chapter start pages.
- It uses pdf-lib to split the original PDF in memory.
- It generates individual PDF downloads and an optional ZIP archive.
Chapterize is a client-side app. Your full PDF file is not uploaded by the app, but page text snippets are sent to Gemini for analysis.
Because the app runs in the browser, any API key included in a deployed public build can be visible to users. Restrict deployed keys by HTTP referrer, set quota limits, and never commit .env.
Chapterize is open source under the MIT License.


