A next-generation library platform that thinks, recommends, and organises β so librarians don't have to.
π§ STATUS: UNDER ACTIVE DEVELOPMENT
This project is currently a work in progress. Features are being actively built and the codebase is evolving. It is not yet production-ready. See the Project Status section and PROGRESS_REPORT.md for the latest updates. Contributions and feedback are very welcome!
Smart Library System is a full-stack MERN application that transforms traditional library management with the power of Google Gemini AI. It acts as a virtual librarian β automatically categorising books, generating summaries, powering semantic search, and delivering personalised reading recommendations β all through a clean, responsive React dashboard.
- π§ Project Status
- β¨ Features & Modules
- ποΈ Project Structure
- π οΈ Tech Stack
- π€ Google Gemini AI Integration
- βοΈ Installation
- π Environment Configuration
- π Usage
- π API Overview
- π£οΈ Roadmap
- π€ Contributing
- π License
This project is actively being built. Here's the current state of each module:
| Module | Status |
|---|---|
| π JWT Authentication (Member & Librarian roles) | β Implemented |
| π Book CRUD β Add, Edit, Delete, View | β Implemented |
| π€ AI Auto-Categorisation (Gemini) | ποΈ In Progress |
| π AI Semantic Search | ποΈ In Progress |
| π‘ AI Book Recommendations | ποΈ In Progress |
| βοΈ AI Book Summaries | ποΈ In Progress |
| π Borrow & Return System | ποΈ In Progress |
| π Due Date Reminder Notifications | π Planned |
| π Usage Analytics Dashboard | π Planned |
| π€ Member Profile & Reading History | π Planned |
| π· OCR Book Cover Scanner | π Planned |
| π± Mobile App | π Planned |
Legend: β Done Β |Β ποΈ In Progress Β |Β π Planned
For detailed progress notes, see PROGRESS_REPORT.md.
AI Auto-Categorisation β When a librarian adds a new book, Gemini analyses the title and description to automatically assign genres, subgenres, and searchable keywords β no manual tagging needed.
Semantic Smart Search β Members can search by feel and concept, not just exact titles. Queries like "a mystery set in Victorian London" or "something like Atomic Habits" are understood by Gemini and matched to relevant books in the collection.
Personalised Recommendations β Based on a member's borrowing history and preferences, Gemini generates curated reading lists tailored to each individual user.
AI Book Summaries β Any book in the system can have an instant AI-generated summary produced on demand β useful for members deciding whether to borrow a book.
Book Management β Full CRUD operations for the library catalogue. Librarians can add, edit, archive, and delete books with cover image uploads and metadata.
Borrow & Return System β Streamlined digital issuance tracking with due dates, overdue detection, and return logging β all stored in MongoDB.
Role-Based Access Control β Two distinct roles: Librarian (full admin access) and Member (browse, borrow, return, view history). Protected via JWT middleware.
Due Date Reminders β Automated notification system to alert members when their borrowed books are approaching or past their due date.
Usage Analytics β Real-time dashboard for librarians showing most borrowed books, inventory levels, overdue counts, and member activity trends.
Member Profiles β Each member has a personal profile with their current borrowings, reading history, and AI-generated recommendations.
Smart_Library_System/
β
βββ backend/ # Node.js + Express β REST API & AI logic
β βββ controllers/ # Route handlers (books, users, borrow, AI)
β βββ models/ # Mongoose schemas (Book, User, Transaction)
β βββ middleware/ # JWT auth & role-based access control
β βββ routes/ # API route definitions
β βββ config/ # MongoDB connection & environment setup
β βββ app.js # Express server entry point
β
βββ frontend/ # React + Vite β library dashboard UI
β βββ src/
β βββ components/ # Reusable UI β Book cards, Search bar, Modals, Nav
β βββ pages/ # Admin Dashboard, User Library, Profile, Login
β βββ context/ # Auth context & global library state
β βββ main.jsx # React app entry point
β
βββ PROGRESS_REPORT.md # Development progress log and notes
βββ package.json # Root-level frontend dependencies
βββ .gitignore
βββ README.md
Backend
- Node.js 18+ β server-side JavaScript runtime
- Express.js β RESTful API framework
- MongoDB β NoSQL document database
- Mongoose β MongoDB object modelling and schema validation
- JWT (jsonwebtoken) β stateless authentication and role-based access
- Google Gemini API β AI categorisation, search, summaries, and recommendations
Frontend
- React β component-based UI library
- Vite β fast modern build tool and dev server
- Tailwind CSS 4 β utility-first responsive styling
- React Router DOM v7 β client-side routing
- Lucide React β clean, consistent icon library
- clsx + tailwind-merge β conditional class handling utilities
Every intelligent feature in Smart Library System runs through the Google Gemini API, called securely from the Express backend β never exposed to the frontend.
| Feature | How Gemini Is Used |
|---|---|
| π·οΈ Auto-Categorisation | Analyses book title + description β assigns genres, subgenres, and keyword tags |
| π Semantic Search | Interprets natural language queries β finds conceptually relevant books in the catalogue |
| π‘ Recommendations | Reads a member's borrowing history β generates a personalised reading list |
| βοΈ Book Summaries | Generates a concise, readable synopsis for any book on demand |
Librarian adds book / Member searches / Member requests summary
β
βΌ
Express API route receives request
β
βΌ
Context prompt assembled
(book metadata / search query / user history)
β
βΌ
Google Gemini API called (server-side only)
β
βΌ
Structured response parsed (JSON / plain text)
β
βΌ
Result saved to MongoDB + returned to React UI
- Visit https://ai.google.dev/ and sign in with your Google account
- Click "Get API Key" β "Create API Key in new project"
- Copy the generated key
- Add it to
backend/.envasGEMINI_API_KEY
β οΈ Always call Gemini from your Express backend routes. Never place the API key in the React frontend or commit it to Git.
- Node.js 18 or higher
- npm 9 or higher
- MongoDB (local instance or MongoDB Atlas free tier)
- A Google Gemini API key (free tier available)
git clone https://github.com/Lucky-939/Smart_Library_System.git
cd Smart_Library_Systemcd backend
npm installcd ../frontend
npm installCreate a .env file in the backend/ folder (see Environment Configuration below).
Terminal 1 β Backend:
cd backend
npm run devBackend API runs at: http://localhost:5000
Terminal 2 β Frontend:
cd frontend
npm run devDashboard runs at: http://localhost:5173
Create a .env file inside the backend/ directory:
# ββ Server ββββββββββββββββββββββββββββββββββββββββββββ
PORT=5000
NODE_ENV=development
# ββ MongoDB Database ββββββββββββββββββββββββββββββββββ
MONGO_URI=mongodb://localhost:27017/smart_library
# Or use MongoDB Atlas:
# MONGO_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/smart_library
# ββ Authentication ββββββββββββββββββββββββββββββββββββ
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRES_IN=7d
# ββ Google Gemini AI ββββββββββββββββββββββββββββββββββ
GEMINI_API_KEY=your_google_gemini_api_key_hereπ‘ Generate a strong
JWT_SECRETwith:node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
β οΈ Ensurebackend/.envis listed in.gitignore. Never push credentials to GitHub.
Once both servers are running at their respective ports:
- Sign up as a Member or log in as a Librarian via the authentication page
- Librarians β Add a new book with its title, author, description, and cover image; Gemini will auto-assign categories and tags
- Members β Use the smart search bar to find books by concept, mood, or natural language description
- Members β Request an AI-generated summary for any book before deciding to borrow it
- Members β Borrow a book; the system logs the due date and tracks the return
- Members β Visit your profile to see your borrowing history and personalised AI recommendations
- Librarians β Monitor the analytics dashboard for inventory health, overdue books, and usage trends
| Method | Endpoint | Description | Auth |
|---|---|---|---|
POST |
/api/auth/register |
Register a new member or librarian | No |
POST |
/api/auth/login |
Login and receive JWT token | No |
GET |
/api/books |
Get all books in the catalogue | Yes |
GET |
/api/books/:id |
Get a single book's details | Yes |
POST |
/api/books |
Add a new book (AI auto-categorises) | Yes (Librarian) |
PUT |
/api/books/:id |
Update book details | Yes (Librarian) |
DELETE |
/api/books/:id |
Remove a book from catalogue | Yes (Librarian) |
GET |
/api/books/search?q= |
Semantic AI-powered search | Yes |
POST |
/api/ai/summary/:bookId |
Generate AI summary for a book | Yes |
GET |
/api/ai/recommendations |
Get personalised book recommendations | Yes (Member) |
POST |
/api/borrow/:bookId |
Borrow a book | Yes (Member) |
PUT |
/api/borrow/:id/return |
Return a borrowed book | Yes (Member) |
GET |
/api/members/:id/history |
Get a member's borrowing history | Yes |
Planned features for upcoming development sprints:
- Due date email/SMS reminder notifications
- Full analytics dashboard with charts β most borrowed, overdue trends, peak usage
- Member profiles with reading history and AI-curated recommendation feeds
- OCR book cover scanner β photograph a book cover to auto-fill its metadata
- Audio summaries β Gemini-generated spoken summaries for accessibility
- QR code generation for each book β scan to borrow instantly
- Multi-branch support β manage multiple library locations from one system
- Mobile app β React Native for members to browse, borrow, and get recommendations on the go
- Production deployment β Railway (backend) + Vercel (frontend) + MongoDB Atlas
Since this project is in early development, contributions are especially valuable right now!
# 1. Fork the repository on GitHub
# 2. Clone your fork
git clone https://github.com/YOUR-USERNAME/Smart_Library_System.git
# 3. Create a feature branch
git checkout -b feature/your-feature-name
# 4. Make your changes and commit
git add .
git commit -m "feat: describe your change here"
# 5. Push and open a Pull Request
git push origin feature/your-feature-name- Keep backend and frontend code cleanly separated in their respective folders
- Follow conventional commit format (
feat:,fix:,docs:,refactor:) - Comment Gemini prompt construction clearly β it helps others tune AI behaviour
- For major changes or new modules, open an issue first to align on the approach
- Test all API routes with Postman or Thunder Client before submitting a PR
Open an issue and include:
- A clear title and description of the problem
- Steps to reproduce it
- Expected vs. actual behaviour
- Relevant error messages or screenshots
This project is licensed under the MIT License β see the LICENSE file for details.
Made with β€οΈ for readers and librarians everywhere β Lucky-939