Skip to content

Lucky-939/Smart_Library_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Smart Library System β€” AI-Powered Resource Management

A next-generation library platform that thinks, recommends, and organises β€” so librarians don't have to.

Node.js Express.js MongoDB React Vite Gemini AI TailwindCSS License: MIT


🚧 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.


πŸ“Œ Table of Contents


🚧 Project Status

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.


✨ Features & Modules

πŸ€– AI-Powered Features (Google Gemini)

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.

πŸ“¦ Core Library Modules

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.


πŸ—‚οΈ Project Structure

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

πŸ› οΈ Tech Stack

Backend

Frontend


πŸ€– Google Gemini AI Integration

Every intelligent feature in Smart Library System runs through the Google Gemini API, called securely from the Express backend β€” never exposed to the frontend.

What Gemini Powers

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

API Call Flow

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

Getting Your Gemini API Key

  1. Visit https://ai.google.dev/ and sign in with your Google account
  2. Click "Get API Key" β†’ "Create API Key in new project"
  3. Copy the generated key
  4. Add it to backend/.env as GEMINI_API_KEY

⚠️ Always call Gemini from your Express backend routes. Never place the API key in the React frontend or commit it to Git.


βš™οΈ Installation

Prerequisites

Step 1 β€” Clone the Repository

git clone https://github.com/Lucky-939/Smart_Library_System.git
cd Smart_Library_System

Step 2 β€” Backend Setup

cd backend
npm install

Step 3 β€” Frontend Setup

cd ../frontend
npm install

Step 4 β€” Configure Environment Variables

Create a .env file in the backend/ folder (see Environment Configuration below).

Step 5 β€” Start the Development Servers

Terminal 1 β€” Backend:

cd backend
npm run dev

Backend API runs at: http://localhost:5000

Terminal 2 β€” Frontend:

cd frontend
npm run dev

Dashboard runs at: http://localhost:5173


πŸ”‘ Environment Configuration

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_SECRET with:

node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"

⚠️ Ensure backend/.env is listed in .gitignore. Never push credentials to GitHub.


πŸš€ Usage

Once both servers are running at their respective ports:

  1. Sign up as a Member or log in as a Librarian via the authentication page
  2. Librarians β€” Add a new book with its title, author, description, and cover image; Gemini will auto-assign categories and tags
  3. Members β€” Use the smart search bar to find books by concept, mood, or natural language description
  4. Members β€” Request an AI-generated summary for any book before deciding to borrow it
  5. Members β€” Borrow a book; the system logs the due date and tracks the return
  6. Members β€” Visit your profile to see your borrowing history and personalised AI recommendations
  7. Librarians β€” Monitor the analytics dashboard for inventory health, overdue books, and usage trends

🌐 API Overview

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

πŸ›£οΈ Roadmap

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

🀝 Contributing

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

Guidelines

  • 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

πŸ› Reporting Issues

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

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


Made with ❀️ for readers and librarians everywhere β€” Lucky-939

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages