Inspiration:
The inspiration for AI Librarian came from the frustration of "reader's block." Traditional book search engines are rigid—they require you to already know the title, author, or a very specific keyword. We wanted to recreate the experience of walking up to a seasoned librarian and simply explaining a mood. We envisioned a system where a user could say, "I want a cozy mystery set in a small-town bakery," or "I need a massive, grimdark fantasy epic," and immediately receive a highly tailored recommendation.
What it does:
AI Librarian is a full-stack, voice-enabled web application that curates personalized book lists based on natural language prompts. Users can type or use the built-in microphone to describe their exact reading preferences. The application securely processes this request and uses artificial intelligence to generate three perfect book matches. It provides the title, author, a specific reason why the book matches the user's mood, and dynamically fetches the official book cover. Users can also securely create an account, log in using Email OTP (One-Time Password) verification, and save their recommendation history to the cloud.
How we built it:
We built the backend using Python and the Flask framework to handle routing, API requests, and user authentication.
The Brains: We integrated the Google Gemini 2.5 Flash API as the core logic engine, engineering strict prompts to ensure the AI returned properly formatted JSON arrays containing real 13-digit ISBNs.
The Database: We utilized a cloud-based PostgreSQL database (Neon/Supabase) to store user credentials, library materials, and search history, connecting it to Flask using psycopg2.
The Frontend: The UI was built with HTML, CSS, and Vanilla JavaScript. We utilized the browser's native Web Speech API to implement the auto-submitting voice recognition feature. Book covers were dynamically rendered by injecting the AI-generated ISBNs into the Open Library Covers API.
Deployment: The entire application was deployed to the internet via Render using Gunicorn, with sensitive credentials protected by environment variables.
Challenges we ran into Moving from a local testing environment to a live production server presented several major hurdles:
Strict AI Outputs: Initially, the AI would occasionally format its responses with markdown code blocks, which broke our frontend. We had to heavily refine our prompt engineering to force strict, pure JSON outputs.
Deployment Crashes: When deploying to Render, our build crashed due to a psycopg2 undefined symbol error. We discovered Render defaults to the newest Python versions (3.14), which conflicted with our database library. We successfully resolved this by configuring environment variables to downgrade the server to a highly stable Python 3.11.8 environment.
Responsive Design & Cold Starts: Making the complex UI fit on a mobile device required writing specific CSS Media Queries to collapse the navigation into a dropdown menu. Additionally, we had to navigate Render's free-tier "cold start" behavior, which puts the server to sleep after 15 minutes of inactivity.
Accomplishments that we're proud of We are incredibly proud of successfully deploying a full-stack application to the cloud. Getting the voice recognition microphone to listen, transcribe, and automatically submit the form without the user ever touching the keyboard feels like magic. Additionally, successfully forcing the AI to fetch real ISBN numbers so we could pull high-quality images from the Open Library database was a massive breakthrough that makes the UI look beautiful and professional.
What we learned
This project was a masterclass in full-stack engineering and cloud deployment. We learned how to secure applications using environment variables, handle complex cross-origin API requests, and debug server-side deployment logs. We also deepened our understanding of CSS media queries for mobile-first design and learned how to build robust, prompt-engineered interactions with Large Language Models that won't crash when receiving unexpected user inputs.
What's next for AI Librarian
The next step for AI Librarian is integrating location-based availability. We plan to connect the application to local library or bookstore APIs, so when the AI recommends a book, it will also tell the user if the physical copy is currently available to check out or purchase nearby. We also want to expand the system to include dedicated filtering options for Audiobooks and Graphic Novels!
Log in or sign up for Devpost to join the conversation.