Phase 1

πŸ“˜ Smart Library System – Monolithic Architecture #

Overview #

The Smart Library System (Monolithic Version) is a single, unified application that handles all core functionalities: managing users, books, and book loans. This system is ideal for simple deployments where all components are tightly coupled, sharing the same runtime and database.


🧩 Functional Modules #

1. User Management Module #

  • Register a user (students/faculty).
  • Update user profile.
  • Retrieve user info.

2. Book Management Module #

  • Add/update/remove books.
  • View book availability.
  • Search books by title, author, or genre.

3. Loan Management Module #

  • Issue books to users.
  • Return books.
  • View active/past loans.

πŸ›’οΈ Unified Database Schema #

Table Description
users Stores user information.
books Stores book catalog details.
loans Tracks issued/returned books.

All modules interact with this shared relational database, typically PostgreSQL or MySQL.


πŸ”„ Internal Communication #

  • All module calls happen via function calls or internal classes.
  • Tight coupling between modules.
  • No network-based interaction β€” all components reside in the same codebase and memory space.

πŸ§ͺ Example API Documentation (REST Endpoints) #

Here’s how external clients (like CLI tools or a potential frontend) interact with the system.

πŸ”Ή User Endpoints #

POST /api/users #

Create/register a new user.

{
  "name": "Alice Smith",
  "email": "[email protected]",
  "role": "student"
}

GET /api/users/{id} #

Fetch user profile by ID.


πŸ”Ή Book Endpoints #

POST /api/books #

Add a new book.

{
  "title": "Clean Code",
  "author": "Robert C. Martin",
  "isbn": "9780132350884",
  "copies": 3
}

GET /api/books?search=clean #

Search for books by title, author, or keyword.


πŸ”Ή Loan Endpoints #

POST /api/loans #

Issue a book to a user.

{
  "user_id": 1,
  "book_id": 42
}

POST /api/returns #

Return a borrowed book.

{
  "loan_id": 1001
}

GET /api/loans/{user_id} #

View loan history for a user.


⚠️ Limitations of Monolithic Design #

  • Hard to scale individual components independently.
  • Tight coupling makes it difficult to change or test modules in isolation.
  • Single point of failure: one bug can crash the entire app.
  • Deployment of small changes requires redeploying the whole system.