## Inspiration

Every AI chat tool feels the same — sterile, transactional, forgettable. I wanted to prove that AI can create experiences, not just answers. The question wasn't "can AI
generate an ebook?" — it was "can AI make seeking knowledge feel like entering a forbidden library where an ancient sphinx decides if you're worthy?"

## What it does

GreatLibrary.ai is a single-page mystical experience where users converse with the Guardian — an eternal, all-knowing entity that possesses the infinite knowledge of the universe. Through cryptic, sphinx-like dialogue (powered by Gemini 2.5 Pro), the Guardian discerns what the seeker truly wants, then retrieves a custom PDF ebook — complete with AI-generated cover art (Gemini image generation), styled typography, drop caps, and clickable table of contents.

Gemini isn't bolted on — it IS the Guardian. Every interaction is Gemini:

  • Conversation: Gemini 2.5 Pro generates sphinx-like responses (constrained to 2 sentences, Law 4 persona)
  • Ebook outline: Gemini structures a 5-chapter outline from 2-3 conversational exchanges
  • Chapter content: Each chapter is generated with depth, examples, and 800+ words
  • Cover art: Gemini image generation creates dark, atmospheric book covers with no text
  • Eye whispers: Click the eye and Gemini delivers genuine life wisdom in under 10 words
  • Greetings, farewells, progress messages: All AI-generated so no two visits feel the same

## How we built it

Zero frameworks. Zero boilerplate. Every line written from scratch.

  • Frontend: A single index.html — pure HTML/CSS/JS. 5-phase lifecycle engine (dormant → awakening → alive → searching → sleeping) with SVG eye animations, Web Audio API ambient sound, particle systems, screen shake, and a golden border loader synced to real ebook generation progress.
  • Backend: Node.js + Express. Multi-provider LLM router supporting Gemini (via Vertex AI, billed to GCP), OpenAI, and OpenRouter — with automatic fallback chains and 429 retry logic. PDFKit for PDF generation with custom layout, drop caps, dividers, and AI-generated covers.
  • Infrastructure: Railway auto-deploy from GitHub. Gemini AI service account auth for GCP-billed generation. Custom domain at greatlibrary.ai.

The architecture is intentionally minimal — one HTML file, one server file. No React, no Next.js, no database. Complexity is in the experience, not the stack.

## Challenges we ran into

  • PDFKit ghost pages: doc.text() inside switchToPage() silently creates empty pages. We discovered you must use raw content streams for page numbers and pure drawing commands for borders — undocumented behavior that took hours to debug.
  • Gemini rate limits: Free tier rate-limits aggressively (5 RPM for Pro). We built exponential backoff retry logic with automatic provider fallback (Gemini → OpenAI → OpenRouter) and model downgrade (Pro → Flash) on 429 errors.
  • Railway outage during crunch time: Right in the middle of deploying critical updates, Railway went down entirely. Couldn't deploy, couldn't check logs, couldn't debug production. Had to keep building locally and trust the code would work once the platform came back — which taught us the importance of solid local testing and not depending on CI/CD as your only feedback loop.
  • Keeping the sphinx alive: The hardest challenge wasn't technical — it was making every single text element feel unique and in-character. Generic AI responses kill the illusion instantly. We constrain Gemini heavily (max 2 sentences, no emojis, no warmth, no lists) and it produces better writing under those constraints.
    • i think the railway.com got bombed or something it really threw me off link

## Accomplishments that we're proud of

  • The Guardian never breaks character. Not once. The persona constraints make Gemini's output genuinely compelling.
  • Eye click whispers deliver real, screenshot-worthy life wisdom — not generic mystery fluff. Users come back just to click the eye.
  • A full 5-chapter PDF with AI cover art, styled typography, and clickable TOC — from a 2-3 message conversation. The entire generation pipeline runs in parallel and reports live progress.
  • The whole app is one HTML file and one server file. No framework bloat, no boilerplate. Clean, readable JavaScript throughout.

    • and the uncensored version WHAHAHHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHAHHAAHAHA

## What we learned

  • Persona constraints make AI better. Telling Gemini "max 2 sentences, no warmth, speak like a sphinx" produces writing that's more powerful than unconstrained output. Limitations breed creativity — even for AI.
  • Simplicity wins. Every time we over-engineered a feature, it broke. One file > ten components. A working experience > a perfect architecture.
  • Don't fight the tools. When PDFKit or CSS resisted a design, simplifying the design always beat hacking around the limitation.
  • Infrastructure will betray you. Railway going down mid-hackathon forced us to build resilience into the app itself — retry logic, provider fallback chains, graceful degradation. The best code survives its platform dying.

## What's next for GreatLibrary.ai

  • User accounts (Google/Microsoft OAuth — already configured) to save tome collections
  • $49/mo membership for unlimited tomes with premium Gemini models
  • Tome library — browse, re-download, and share collected tomes
  • Deeper Gemini integration — multi-modal tomes with generated diagrams, longer context conversations, voice input via the eye

Note: The GitHub repository for this project is private to protect API
keys and proprietary code. If judges or reviewers need access to the source code for evaluation, please reach out to greatlibraryai@gmail.com and I'll be happy to provide access.

Built With

Share this project:

Updates