Source Library Logo # Source Library **A digital library of historical primary sources with AI-aided OCR, translation, and scholarly curation.** [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) [![Next.js](https://img.shields.io/badge/Next.js-16-black)](https://nextjs.org) [![MongoDB](https://img.shields.io/badge/MongoDB-Atlas-green)](https://www.mongodb.com/cloud/atlas) [![Postgres Supabase](https://img.shields.io/badge/Supabase-green)](https://supabase.com) [![Gemini API](https://img.shields.io/badge/AI-Google%20Gemini-red)](https://ai.google.dev) [๐ŸŒ Visit Library](https://sourcelibrary.org) โ€ข [๐Ÿ“– Docs](./docs) โ€ข [๐Ÿ—บ๏ธ System Map](./.claude/docs/system-map.md) โ€ข [๐Ÿค Contribute](#contributing)
--- ## ๐ŸŽฌ Experience Source Library
*Explore thousands of digitized historical texts with AI-enhanced translations and scholarly curation.*
--- ## ๐ŸŽฏ About Source Library Source Library is an open digital library dedicated to making early printed books and primary sources readable and citable. We specialize in **alchemy, Hermetica, Kabbalah, Rosicrucianism, and early modern science**โ€”texts that bridge historical scholarship with contemporary exploration. ### ๐ŸŒŸ Why Source Library? - โœจ **Originals First** โ€” Read the original language text with AI-enhanced translations alongside - ๐ŸŽ“ **Citable Scholarship** โ€” Every book gets a DOI and scholarly metadata (USTC alignment, edition tracking) - ๐Ÿ›๏ธ **Partner Subdomains** โ€” Institutions like the [Bibliotheca Philosophica Hermetica](https://bph.sourcelibrary.org) curate reading rooms on their own domains - ๐Ÿ” **Discovery** โ€” Collections, galleries of illustrations, and semantic search surface overlooked texts - โœ… **Rigorous QA** โ€” Manual verification, image quality scoring, and OCR validation before publication The platform ingests **~15K pages monthly** from Internet Archive, Gallica, Bodleian, Wellcome, and other digital heritage partners. --- ## ๐Ÿš€ Quick Start ### ๐Ÿ’ป Development Environment ```bash # ๐Ÿด Clone and install git clone https://github.com/Embassy-of-the-Free-Mind/sourcelibrary-v2.git cd sourcelibrary-v2 npm install # โš™๏ธ Configure environment (see .env.example for required variables) # Must include: MongoDB Atlas connection, Google Gemini API key, Vercel Blob token # โ–ถ๏ธ Start dev server npm run dev ``` Open [http://localhost:3000](http://localhost:3000) --- ## ๐Ÿ“‹ Tech Stack
๐ŸŽจ Frontend Next.js 16, React 19, TailwindCSS, Lucide icons
โš™๏ธ Backend Next.js API routes, AWS Lambda for async processing
๐Ÿ’พ Database MongoDB Atlas (primary), Supabase (embeddings)
๐Ÿค– AI/ML Google Gemini 3.1 (OCR, translation, summarization)
๐Ÿ—‚๏ธ Storage Vercel Blob (images), AWS S3 (archive), Cloudflare R2 (archive)
๐Ÿ” Auth NextAuth v5 with MongoDB adapter
๐Ÿš€ DevOps Vercel (hosting), GitHub (VCS), Playwright (E2E tests)
โœ”๏ธ Testing Vitest (unit/integration), Playwright (E2E)
๐Ÿ”Ž Search PostgreSQL FTS + semantic search via Supabase
**๐Ÿ“ฆ Key Dependencies:** - `sharp` โ€” Image resizing and cropping - `@google/generative-ai` โ€” Gemini API integration - `xml2js` โ€” USTC metadata parsing - `@modelcontextprotocol/sdk` โ€” MCP server for agent integration - `stripe` โ€” Donation and subscription handling --- ## ๐Ÿ“š Core Features ### ๐Ÿ“– Reading & Navigation - **โšก Page pagination** โ€” Instant navigation between 100+ pages - **๐Ÿ” Full-text search** โ€” Query across OCR'd text and translations - **๐Ÿ“Œ Quote generation** โ€” Copy and cite passages with DOI links ### ๐Ÿ”„ Processing Pipeline - **๐Ÿงฉ Smart split detection** โ€” Automatic gutter detection for two-page spreads (Gemini AI or ML-based) - **โœ๏ธ High-accuracy OCR** โ€” Gemini Vision API with language-specific models (Latin, German, Greek, Arabic, etc.) - **๐Ÿ—ฃ๏ธ Context-aware translation** โ€” Maintains continuity across pages for scholarly accuracy - **๐Ÿ–ผ๏ธ Gallery extraction** โ€” AI-powered detection and cataloging of illustrations ### ๐ŸŽจ Curation & Discovery - **๐Ÿ“‘ Themed collections** โ€” Editorial collections (e.g., "Alchemy & Transmutation," "Kabbalah & Mysticism") - **๐Ÿ›๏ธ Gallery browsing** โ€” Curated images from all books (museum-quality metadata) - **๐Ÿ“š Related editions** โ€” Link across translations, reprints, and derivative works - **๐Ÿ”— Authority linking** โ€” Connect to USTC, VIAF, and other scholarly databases ### ๐Ÿ“ค Scholarly Export - **๐Ÿ“ฑ EPUB generation** โ€” Multi-format ebook export - **๐Ÿ“„ PDF with annotations** โ€” Preserve layout, add scholarly notes - **๐Ÿ†” DOI minting** โ€” Version books via Zenodo integration for long-term citation ### ๐Ÿข Tenant Subdomains - **๐Ÿ›๏ธ Isolated reading rooms** โ€” Partners host curated subsets on custom domains (e.g., `bph.sourcelibrary.org`) - **๐ŸŽจ Branding & navigation** โ€” Full UI customization per tenant - **๐Ÿ”’ Access control** โ€” Public or members-only collections --- ## ๐Ÿ—๏ธ Architecture Overview ### ๐Ÿ“Š Data Model **๐Ÿ“š Books** contain structured metadata: - **๐Ÿ›๏ธ Bibliographic** โ€” Title, author, language, publication date, USTC ID - **๐Ÿ–ผ๏ธ Images** โ€” Links to source (Internet Archive, Gallica, etc.), archival status - **โš™๏ธ Processing** โ€” OCR status, translation language, extraction metadata - **๐ŸŽจ Curation** โ€” Collections, tier (featured/standard), visibility flags **๐Ÿ“„ Pages** store individual page data: - **๐Ÿ“ธ Original image** โ€” Source photo or PDF page - **โœ‚๏ธ Split coordinates** โ€” Crop boundaries (0-1000 scale) for two-page spreads - **โœ๏ธ OCR output** โ€” Raw Gemini extraction + language metadata - **๐Ÿ—ฃ๏ธ Translation** โ€” English translation with scholarly notes - **๐Ÿ–ผ๏ธ Illustrations** โ€” Detected images with quality scores and descriptions **๐Ÿ–ผ๏ธ Gallery images** are extracted illustrations: - **๐Ÿท๏ธ Metadata** โ€” Subject, figures, symbols, style, techniques, period - **โญ Quality score** โ€” 0โ€“1.0 rating (filters below 0.5) - **๐Ÿ”— Provenance** โ€” Source book and page, linked back ### ๐ŸŽจ Image Tier System All page images are resized on-demand via ``/api/image``: | Tier | Dimensions | Quality | ๐Ÿ“ฑ Use Case | |------|-----------|---------|----------| | **Thumbnail** | 400px wide | 70% JPEG | Grids, navigation, social sharing | | **Display** | 1200px wide | 80% JPEG | Main reading view, comfortable for annotation | | **Full** | 2400px wide | 90% JPEG | Magnifier, fullscreen detail, printing | Split pages are cropped non-destructively via coordinates; original images are always preserved. ### ๐Ÿ”„ Processing Pipeline ``` ๐Ÿ“ฅ Import โ†’ โœ‚๏ธ Split Detection โ†’ โœ๏ธ OCR โ†’ ๐Ÿ—ฃ๏ธ Translation โ†’ ๐ŸŽจ Enrichment โ†’ ๐ŸŒ Publishing ``` 1. **๐Ÿ“ฅ Import** โ€” Upload images, import from IA/Gallica via IIIF, or paste URLs 2. **โœ‚๏ธ Split Detection** โ€” Detect two-page spreads; mark crop boundaries 3. **โœ๏ธ OCR** โ€” Gemini Vision extracts text per page language 4. **๐Ÿ—ฃ๏ธ Translation** โ€” Gemini translates to English with prior-page context for continuity 5. **๐ŸŽจ Enrichment** โ€” Extract illustrations, generate summaries, assign collections 6. **๐ŸŒ Publishing** โ€” Set `visible: true`, mint DOI, push to search index Batch endpoints process up to 5 pages/request using Gemini Batch API (50% cheaper). ### ๐Ÿ”Œ API Routes (Key) **Base URL:** `https://sourcelibrary.org` (production) or `http://localhost:3000` (local dev with `.env.local` configured). > **Common 404 mistake:** paths like `/api/bph/books` or `/api/bph/books/[id]` **do not exist**. BPH catalogue APIs live under `/api/embed/bph/...`. There is also **no** top-level `/api/[tenant]/books` route โ€” tenant book listings use `/api/books/library` or the embed routes below. #### Public read APIs (no auth required today) | Endpoint | Method | Purpose | |----------|--------|---------| | `/api/search?q=` | GET | Full-text search across books and page translations | | `/api/books?limit=100&offset=0` | GET | Simple book list (global catalogue; `visible: true`, indexed only) | | `/api/books/library?limit=100&skip=0` | GET | Rich browse API โ€” search, sort, filters, collections | | `/api/books/[id]` | GET | Book metadata (accepts Mongo `id` or `slug`) | | `/api/books/[id]/quote?page=` | GET | Citable quote + formatted citations (inline, footnote, BibTeX, DOI) | | `/api/gallery?limit=24` | GET | Illustration / artwork search | | `/api/image?url=&w=400` | GET | On-demand image resize & crop | | `/api/embed/bph/books?limit=24` | GET | BPH catalogue (paginated, searchable) | | `/api/embed/bph/books/[slug]` | GET | Single BPH book detail | | `/api/embed/bph/featured` | GET | Featured BPH books | | `/api/embed/bph/collections` | GET | BPH collection list | | `/api/embed/bph/languages` | GET | BPH language facets | | `/api/embed/bph/suggest?q=alch` | GET | BPH search autocomplete | | `/api/embed/bph/stats` | GET | BPH catalogue stats | #### Tenant-scoped listing (not `/api/bph/...`) Use one of these patterns to filter by partner tenant (e.g. BPH): | Approach | Example | |----------|---------| | **Embed prefix (recommended for BPH)** | `GET /api/embed/bph/books?limit=24` | | **Library API + query param** | `GET /api/books/library?tenant_slug=bph&limit=24` | | **Host header (subdomain)** | Call `https://bph.sourcelibrary.org/api/books/library?limit=24` โ€” the proxy injects tenant context | | **Manual header (advanced)** | `curl -H "x-tenant-slug: bph" https://sourcelibrary.org/api/books/library?limit=24` | The `/api/[tenant]/books/[id]/...` paths that exist in the codebase are **editor/processing** routes (batch OCR, index rebuild, etc.) โ€” not public catalogue listings. #### Authenticated / internal APIs These require a signed-in session cookie, editor role, or (for some dataset endpoints) a Bearer API key. Calling them without auth returns `401` or `403`. | Endpoint | Method | Purpose | |----------|--------|---------| | `/api/books` | POST | Create a new book (editor) | | `/api/books/[id]` | PATCH | Update book metadata (curator+) | | `/api/books/[id]/batch-ocr-async` | POST | Queue batch OCR job | | `/api/books/[id]/batch-translate-async` | POST | Queue batch translation job | | `/api/pages/[id]` | PATCH | Update page OCR/translation | | `/api/jobs/[id]/process` | POST | Async job processor (Lambda) | Full narrative API walkthrough: [`docs/blog-source-library-api.md`](./docs/blog-source-library-api.md). MCP tools (search, quote, read): [`mcp-server/README.md`](./mcp-server/README.md). ### ๐Ÿงช Trying the API (curl, Postman, browser) All examples below hit **production** and need no API key. Replace the base URL with `http://localhost:3000` when running locally (MongoDB + env vars required). #### curl ```bash # Search translated text curl -s "https://sourcelibrary.org/api/search?q=quintessence&limit=5" | jq . # List books (global catalogue) curl -s "https://sourcelibrary.org/api/books?limit=5" | jq . # Browse with filters and sort curl -s "https://sourcelibrary.org/api/books/library?limit=5&sort=recent-translation&has_translation=true" | jq . # BPH catalogue โ€” note /api/embed/bph/, NOT /api/bph/ curl -s "https://sourcelibrary.org/api/embed/bph/books?limit=5&translated=true" | jq . # BPH via tenant_slug on the library endpoint curl -s "https://sourcelibrary.org/api/books/library?tenant_slug=bph&limit=5" | jq . # Book metadata (id or slug) curl -s "https://sourcelibrary.org/api/books/know-thyself-reger-von-ehrenhart" | jq . # Citable quote for a page curl -s "https://sourcelibrary.org/api/books/6836f8ee811c8ab472a49e36/quote?page=57" | jq . # Gallery search curl -s "https://sourcelibrary.org/api/gallery?subject=alchemy&limit=5" | jq . ``` Pretty-printing with `jq` is optional; omit `| jq .` to see raw JSON. #### Postman 1. Create a new **GET** request. 2. Set URL to e.g. `https://sourcelibrary.org/api/embed/bph/books` 3. On the **Params** tab add query keys: `limit` = `24`, `sort` = `title`, `translated` = `true` 4. Leave **Auth** as *No Auth* for the public endpoints above. 5. Send โ€” expect `200` with JSON body. ![Get Books](public/images/readme/postman-get-books.jpg) #### Browser Public GET endpoints can be opened directly: - [Search: quintessence](https://sourcelibrary.org/api/search?q=quintessence&limit=5) - [BPH books](https://sourcelibrary.org/api/embed/bph/books?limit=5) - [Global library browse](https://sourcelibrary.org/api/books/library?limit=5) ### ๐Ÿ“ Directory Structure ``` src/ โ”œโ”€โ”€ app/ # ๐ŸŽจ Next.js App Router โ”‚ โ”œโ”€โ”€ book/[id]/ # ๐Ÿ“– Book detail, reading, processing โ”‚ โ”‚ โ”œโ”€โ”€ page.tsx # Main book hub โ”‚ โ”‚ โ”œโ”€โ”€ split/page.tsx # Split detection workflow โ”‚ โ”‚ โ””โ”€โ”€ page/[pageId]/page.tsx # Individual page view โ”‚ โ”œโ”€โ”€ api/ # ๐Ÿ”Œ All API routes โ”‚ โ”‚ โ”œโ”€โ”€ books/ # Book CRUD & batch ops โ”‚ โ”‚ โ”œโ”€โ”€ pages/ # Page processing โ”‚ โ”‚ โ”œโ”€โ”€ image/ # Image proxy & cropping โ”‚ โ”‚ โ”œโ”€โ”€ jobs/ # Async job tracking โ”‚ โ”‚ โ””โ”€โ”€ search/ # Full-text & semantic โ”‚ โ”œโ”€โ”€ [tenant]/ # ๐Ÿข Tenant subdomain routes โ”‚ โ”œโ”€โ”€ gallery/ # ๐Ÿ–ผ๏ธ Illustration browsing โ”‚ โ”œโ”€โ”€ collections/ # ๐Ÿ“‘ Collection pages โ”‚ โ””โ”€โ”€ admin/ # โš™๏ธ Admin dashboard โ”œโ”€โ”€ hooks/ # ๐ŸŽฃ Reusable React hooks โ””โ”€โ”€ lib/ # ๐Ÿ› ๏ธ Business logic & utilities โ”œโ”€โ”€ mongodb.ts # Database operations โ”œโ”€โ”€ image-extraction.ts # Illustration detection โ””โ”€โ”€ auth-helpers.ts # Authentication utilities scripts/ โ”œโ”€โ”€ workers/ # โš™๏ธ Lambda worker functions โ”‚ โ”œโ”€โ”€ pipeline-orchestrator.mjs # Main processing pipeline โ”‚ โ”œโ”€โ”€ image-extract-worker.mjs # Gallery extraction โ”‚ โ””โ”€โ”€ ... โ”œโ”€โ”€ maintenance/ # ๐Ÿ”ง One-off maintenance scripts โ”œโ”€โ”€ migrations/ # ๐Ÿ“Š Database schema updates โ””โ”€โ”€ audit-bph-leaks.mjs # ๐Ÿ”’ Tenant security verification tests/ โ”œโ”€โ”€ unit/ # โœ”๏ธ Vitest unit tests โ””โ”€โ”€ integration/ # ๐Ÿ”— Integration tests prompts/ # ๐Ÿค– AI system prompts โ”œโ”€โ”€ ocr/ โ”œโ”€โ”€ translation/ โ”œโ”€โ”€ split-detection/ โ””โ”€โ”€ ... .claude/ # ๐Ÿง  AI agent context โ”œโ”€โ”€ docs/ # ๐Ÿ“š Detailed architecture docs โ”œโ”€โ”€ skills/ # ๐ŸŽฏ Specialized agent skills โ””โ”€โ”€ handoffs/ # ๐Ÿ“‹ Incident reports & lessons ``` --- ## ๐Ÿ”„ Common Workflows ### ๐Ÿ“ฅ Importing Books from Internet Archive ```typescript // From the UI or via API POST /api/books { "ia_id": "thehermetic00fludd", "title": "The Hermetic and Alchemical Writings", "author": "Arthur Edward Waite", "language": "en", "ustc_id": "123456" } ``` The system: 1. ๐Ÿ“ฅ Fetches page images from IA IIIF 2. โœ‚๏ธ Detects splits and generates crop coordinates 3. ๐Ÿ“ค Queues for OCR and translation 4. ๐ŸŒ Publishes when processing completes ### โœ‚๏ธ Processing a Split Book 1. ๐Ÿ–ฅ๏ธ Visit `/book/[id]/split` 2. ๐Ÿ–ฑ๏ธ Adjust split line visually (drag or Gemini AI auto-detection) 3. โœ… Click "Apply Split" โ€” creates two virtual pages with crop coordinates 4. ๐Ÿ“ธ Original images preserved; OCR runs on cropped versions ### โœ๏ธ Batch OCR with Gemini Batch API ```typescript POST /api/books/[id]/batch-ocr-async { "page_ids": ["page-1", "page-2", "page-3"], "language": "la" } ``` Returns a job ID; Gemini processes offline, saves results when complete. 50% cheaper than standard API. ### ๐ŸŽ“ Generating a Scholarly Edition ```typescript POST /api/books/[id]/editions { "title": "The Emerald Tablet: First Complete English Translation", "translator": "Jane Doe", "language": "en", "format": "epub" } ``` System generates: - ๐Ÿ“ Scholarly front matter (introduction, translator bio, etc.) - ๐Ÿ“ฑ EPUB with TOC and metadata - ๐Ÿ†” DOI via Zenodo integration - ๐Ÿ“š Citation metadata (BibTeX, RIS) --- ## ๐Ÿงช Testing ### ๐Ÿš€ Run Tests ```bash # Unit tests npm run test:unit # Integration tests npm run test:integration # End-to-end tests (Playwright) npm run test:e2e # Coverage report npm run test:coverage # Watch mode npm run test:watch ``` ### โœ… E2E Test Examples - ๐Ÿ“ฅ **Book import** โ€” Validate IA ingestion pipeline - โœ‚๏ธ **Split detection** โ€” Verify gutter detection accuracy - ๐ŸŒ **Translation** โ€” Confirm source/translation alignment - ๐Ÿ”’ **Tenant subdomain** โ€” Ensure content isolation (no leaks) - ๐Ÿ” **Search** โ€” Test full-text and semantic indexing --- ## ๐Ÿš€ Deployment ### ๐Ÿ”„ Staging (Preview) Every pushed branch auto-deploys to Vercel preview: ```bash git push origin feat/my-feature # โ†“ Vercel builds and deploys # โ†“ Preview URL in GitHub PR ``` ### ๐ŸŒ Production Merge to `main` via PR โ†’ automatic Vercel deploy to [sourcelibrary.org](https://sourcelibrary.org) **โœ… Pre-deployment checklist:** - [ ] Tests pass (`npm run test`) - [ ] TypeScript check passes (`npx tsc --noEmit`) - [ ] No hardcoded secrets or credentials - [ ] Tenant subdomain leak audit passes (`node scripts/audit-bph-leaks.mjs`) - [ ] PR reviewed and approved ### ๐Ÿ”‘ Environment Variables **Required** (`.env.local`): ``` MONGODB_URI=mongodb+srv://... NEXTAUTH_SECRET= GOOGLE_API_KEY= VERCEL_BLOB_TOKEN= AWS_REGION=us-east-1 AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... ``` **Optional:** ``` STRIPE_SECRET_KEY= ZENODO_TOKEN= SUPABASE_URL= ``` --- ## ๐Ÿ“– Documentation - ๐Ÿ—บ๏ธ **[System Map](./.claude/docs/system-map.md)** โ€” Comprehensive architecture diagram and file index - ๐Ÿ—๏ธ **[ARCHITECTURE.md](./ARCHITECTURE.md)** โ€” Data model, workflows, and design decisions - ๐Ÿค– **[AGENTS.md](./AGENTS.md)** โ€” Technical context for AI agents and automated workers - ๐Ÿ“‹ **[CLAUDE.md](./CLAUDE.md)** โ€” Development workflow, PR conventions, critical invariants - ๐Ÿ” **[AUTH_IMPLEMENTATION.md](./AUTH_IMPLEMENTATION.md)** โ€” NextAuth setup and tenant auth - ๐Ÿ“ฆ **[Batch OCR Workflow](./docs/BATCH-OCR-WORKFLOW.md)** โ€” Using Gemini Batch API - ๐Ÿ”Œ **[API Documentation](./docs/blog-source-library-api.md)** โ€” REST API reference - ๐Ÿ–ผ๏ธ **[Image Processing](./AGENTS.md#image-processing)** โ€” How cropping and resizing works --- ## ๐Ÿค Contributing We welcome contributions! Please follow our [development workflow](./CLAUDE.md#development-workflow): 1. **๐ŸŒฟ Create a feature branch** (off `main`): ```bash # Using git worktree for multi-session safety git worktree add .claude/worktrees/feat-xyz feat/xyz cd .claude/worktrees/feat-xyz ``` 2. **โœ๏ธ Make changes and test**: ```bash npm run lint npm run test npm run test:e2e ``` 3. **๐Ÿ“ค Push and create a PR**: ```bash git push origin feat/xyz gh pr create --base main ``` 4. **๐Ÿ“‹ PR guidelines**: - **One concern per PR** โ€” Don't bundle refactors with features - **Verify deletions** โ€” Always `grep -rn` before deleting code - **Run type check** โ€” `npx tsc --noEmit` before submitting - **Describe scope** โ€” State what's in scope AND out of scope ### ๐ŸŽฏ What We're Looking For - ๐Ÿ› **Bug fixes** with test coverage - โœจ **Feature implementations** aligned with project mission - โšก **Performance improvements** with benchmarks - ๐Ÿ“ **Documentation** improvements - โ™ฟ **UX/accessibility** enhancements - ๐Ÿข **Tenant integration** examples ### ๐Ÿ“ข Reporting Issues - ๐Ÿ› **Bugs** โ€” Include reproduction steps, expected vs. actual behavior - ๐Ÿ’ก **Feature requests** โ€” Explain the use case and user impact - โ“ **Questions** โ€” [Open an issue](https://github.com/Embassy-of-the-Free-Mind/sourcelibrary-v2/issues) --- ## ๐Ÿ›ก๏ธ Security & Data Protection - ๐Ÿšซ **No deletion without approval** โ€” All book/page deletions require explicit confirmation - ๐Ÿ”’ **Tenant isolation** โ€” Tenant subdomains are closed systems (no cross-tenant leaks) - ๐Ÿ” **Secret management** โ€” All secrets via environment variables, never hardcoded - โš–๏ธ **AGPL licensing** โ€” Contributions must respect AGPL-3.0-or-later See [CLAUDE.md Security](./CLAUDE.md#security---critical) for detailed security policies. --- ## ๐Ÿ“Š Current Status _As of July 2026 โ€” these move weekly; live numbers at [sourcelibrary.org/data](https://sourcelibrary.org/data)._ **๐Ÿ“ˆ Active Corpus:** - ๐Ÿ“š ~29K books with `visible: true` - โœ… ~15K fully processed (OCR'd and translated) - ๐ŸŒ ~14K with full English translations - ๐Ÿ–ผ๏ธ 200K+ catalogued illustrations in the [gallery](https://sourcelibrary.org/gallery) **โš™๏ธ Processing Capacity:** - ๐Ÿ“ฅ 15K+ pages/month ingestion - ๐Ÿ—ฃ๏ธ Multi-language support (Latin, German, Greek, Arabic, Sanskrit, Chinese, etc.) - ๐Ÿ’ฐ Batch API for 50% cost reduction **๐Ÿข Platform Tenants:** - ๐Ÿ”ฎ [Bibliotheca Philosophica Hermetica](https://bph.sourcelibrary.org) โ€” Hermetica & esoterica - โš—๏ธ [Kloss Collection](https://kloss-collection.sourcelibrary.org) โ€” Medical alchemy - ๐Ÿค Additional partners in development --- ## ๐Ÿ“ License Source Library is licensed under the **GNU Affero General Public License v3.0 or later** ([AGPL-3.0-or-later](./LICENSE)). All contributions must respect this license. See [LICENSING.md](./LICENSING.md) for details on third-party licenses and attribution. --- ## ๐Ÿ“ž Support & Community - ๐Ÿ› **Found a bug?** [Open an issue](https://github.com/Embassy-of-the-Free-Mind/sourcelibrary-v2/issues) - ๐Ÿค **Want to collaborate?** [Contribute](https://sourcelibrary.org/contribute) - ๐ŸŒ **Visit the site** โ€” [sourcelibrary.org](https://sourcelibrary.org) ---
**๐Ÿ“– Digitizing history. Making primary sources readable. Building open scholarship.** [โ†‘ Back to top](#-source-library)
``` src/ โ”œโ”€โ”€ app/ # All routes, pages, and API endpoints โ”‚ โ”œโ”€โ”€ api/ # API routes โ”‚ โ”œโ”€โ”€ book/ # Book pages (detail, read, pipeline) โ”‚ โ””โ”€โ”€ page.tsx # Homepage โ”œโ”€โ”€ components/ # Reusable React components โ”œโ”€โ”€ hooks/ # Reusable React hooks for component logic โ””โ”€โ”€ lib/ # Business Logic, Utilities (mongodb, ai, types), and Services ```