Shreyansh Kumar Singh

Case study · PRODUCT · 2607.PRD.05

BookVerse AI: step inside any book — even with no API key

How can an AI book-summary app keep working when no API key is available?

BookVerse AI keeps working without an API key by treating the model as optional: with no provider configured it serves grounded, structured previews from an offline path, and when a configured model or database is slow or down, timeouts and a circuit breaker drop it to the fallback instead of hanging. Configure Groq, OpenAI, Gemini or a local Ollama and the same app generates full study guides.

By Shreyansh Kumar Singh · Updated · Source available on GitHub (proprietary license).

BookVerse AI's real landing page, full length — 'Step inside any book', with its live model badge and Summon search
API keys required
0
Model paths
Groq · OpenAI · Gemini · Ollama (+ offline)
Circuit breaker
Opens after 2 failures, for 30 s
Seed library
10 public-domain books
Stack
Next.js 16 · TypeScript · Tailwind · zod · SQLite · Supabase · Vitest · Playwright

01The problem it solves

Most AI demos are a single API call wrapped in a UI — remove the key, or let the provider stall, and the whole product is a spinner. A study tool has to be dependable before it can be clever.

02What he built

A study guide from a title

Enter a book and get a structured summary, chapter breakdown, key lessons, a timeline, a radial mind map, a character map and an AI tutor grounded in the book's content. Ten public-domain books are seeded and served instantly; summaries are paraphrased and transformative, never reproduced text.

Provider-agnostic AI layer

One provider interface over Groq, OpenAI, Gemini, any OpenAI-compatible endpoint, or local Ollama. A status badge turns green only when the configured model is actually reachable — verified against the provider's model list, not just the presence of a key.

Untrusted model output, validated

Generated JSON is extracted from prose, then normalised with zod: every field has a fallback, strings and arrays are clamped, and the mind map is repaired so it always has exactly one root. Results are cached so a book is generated once.

03 — THE HARDEST DECISIONDegrade honestly instead of failing hard

Every external dependency — hosted database, remote model, session refresh — is wrapped in a timeout and a circuit breaker. A dead Supabase costs about two slow requests per 30-second window and then nothing, because the circuit opens after two consecutive failures and calls go straight to the local SQLite fallback.

The same rule shapes the UI: when the app is running on its offline path it says so, with a badge, rather than passing previews off as model output.

04The result

A Next.js 16 app that runs fully on first `npm run dev` — embedded SQLite, offline AI previews, a localStorage shelf — and scales up to hosted models, Supabase persistence and accounts by adding environment variables, with rate limiting, request-scoped logging and Vitest and Playwright test suites along the way.

STACKTech stack

  • Next.js 16
  • React
  • TypeScript
  • Tailwind
  • Groq
  • Ollama

MORE OF THE RANGEMore projects by Shreyansh Kumar Singh