Skip to content

A full-stack Library Management System designed to streamline library operations. It features a responsive frontend built with React and a robust backend API powered by Node.js and Express. Core functionalities include secure user authentication, detailed profile management, and tracking of issued books, with all data stored in an OracleDB database

License

Notifications You must be signed in to change notification settings

mkp151203/Library-Mangement-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Library Management System

React NodeJS Express.js Oracle

A full-stack Library Management System built with a React frontend, Node.js/Express backend, and an OracleDB database. This project provides an efficient platform for managing core library operations, including user authentication, book issuance, and detailed user profile management.

πŸš€ Demo

Demo

✨ Features

  • User Authentication: Secure login and registration system for both students and administrators.
  • User Profiles: View, create, and edit user profiles with details like name, email, department, academic year, join date, and a list of currently issued books.
  • Book Management: Seamlessly issue books to users and track the history of all issued books.
  • Responsive UI: A modern and intuitive user interface built with React for a great user experience on any device.
  • RESTful Backend API: A robust backend powered by Node.js and Express, providing clear and structured routes for interacting with the OracleDB database.
  • JWT-based authentication for secure session management and protected routes, ensuring a reliable and scalable backend.

πŸ“‚ Project Structure

.
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ auth.js      # Handles login and registration
β”‚   β”‚   └── user.js      # User profile and book-related routes
β”‚   β”œβ”€β”€ db.js            # OracleDB connection logic
β”‚   β”œβ”€β”€ server.js        # Express server setup
β”‚   └── package.json
β”‚
└── frontend/
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ components/
    β”‚   β”‚   β”œβ”€β”€ Login.jsx
    β”‚   β”‚   β”œβ”€β”€ Registration.jsx
    β”‚   β”‚   └── UserProfile.jsx
    β”‚   β”œβ”€β”€ App.css
    β”‚   β”œβ”€β”€ App.jsx
    β”‚   └── index.js
    └── package.json

πŸ’Ύ Database Schema

The application uses four main tables in the Oracle database.

(version - Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production)

1. USERS

Stores user credentials for authentication.

Column Type Constraints
ID NUMBER NOT NULL
USERNAME VARCHAR2(50) NOT NULL
PASSWORD VARCHAR2(255) NOT NULL
ROLE VARCHAR2(20) NOT NULL

2. BOOKS

Contains the library's book collection.

Column Type Constraints
ID NUMBER NOT NULL
TITLE VARCHAR2(255) NOT NULL
AUTHOR VARCHAR2(255) NOT NULL
GENRE VARCHAR2(100)
PUBLISHEDYEAR NUMBER
AVAILABLE CHAR(1)
COVER VARCHAR2(1000)

3. USER_PROFILES

Stores detailed information about each user.

Column Type Constraints
USER_ID NUMBER NOT NULL
NAME VARCHAR2(100)
EMAIL VARCHAR2(100)
ROLE VARCHAR2(20)
DEPARTMENT VARCHAR2(100)
YEAR VARCHAR2(50)
JOIN_DATE DATE
BOOKS_ISSUED NUMBER
AVATAR VARCHAR2(1000)

4. ISSUED_BOOKS

Tracks books that are currently issued to users.

Column Type Constraints
ID NUMBER NOT NULL
BOOK_ID NUMBER NOT NULL
USER_ID NUMBER NOT NULL
ISSUE_DATE DATE
DUE_DATE DATE
RETURNED CHAR(1)

πŸ› οΈ Installation & Setup

To get this project up and running locally, please follow these steps.

Prerequisites

  • Node.js (which includes npm)
  • Access to an OracleDB instance and its connection details.
  • You need to install oracle database and set up the tables proplerly according to the given structure above.

1. Clone the Repository

First, clone the project to your local machine.

git clone [https://github.com/mkp151203/Library-Mangement-System.git](https://github.com/mkp151203/Library-Mangement-System.git)
cd Library-Mangement-System

2. Backend Setup

run these queries to create your database

-- ===============================
-- USERS TABLE
-- ===============================
CREATE TABLE USERS (
    ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    USERNAME VARCHAR2(50) NOT NULL UNIQUE,
    PASSWORD VARCHAR2(255) NOT NULL,
    ROLE VARCHAR2(20) NOT NULL
);

-- ===============================
-- BOOKS TABLE
-- ===============================
CREATE TABLE BOOKS (
    ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    TITLE VARCHAR2(255) NOT NULL,
    AUTHOR VARCHAR2(255) NOT NULL,
    GENRE VARCHAR2(100),
    PUBLISHEDYEAR NUMBER(4,0),
    AVAILABLE CHAR(1) DEFAULT 'Y' CHECK (AVAILABLE IN ('Y', 'N')) NOT NULL,
    COVER VARCHAR2(1000)
);

-- ===============================
-- USER_PROFILES TABLE
-- ===============================
CREATE TABLE USER_PROFILES (
    USER_ID NUMBER PRIMARY KEY,
    NAME VARCHAR2(100) NOT NULL,
    EMAIL VARCHAR2(100) NOT NULL,
    ROLE VARCHAR2(20),
    DEPARTMENT VARCHAR2(100),
    YEAR VARCHAR2(50),
    JOIN_DATE DATE DEFAULT SYSDATE,
    BOOKS_ISSUED NUMBER DEFAULT 0,
    AVATAR VARCHAR2(1000),
    CONSTRAINT FK_USER_PROFILES_USERS FOREIGN KEY (USER_ID)
        REFERENCES USERS(ID) ON DELETE CASCADE
);

-- ===============================
-- ISSUED_BOOKS TABLE
-- ===============================
CREATE TABLE ISSUED_BOOKS (
    ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    BOOK_ID NUMBER NOT NULL,
    USER_ID NUMBER NOT NULL,
    ISSUE_DATE DATE DEFAULT SYSDATE NOT NULL,
    DUE_DATE DATE NOT NULL,
    RETURNED CHAR(1) DEFAULT 'N' CHECK (RETURNED IN ('Y', 'N')) NOT NULL,
    CONSTRAINT FK_ISSUED_BOOK_ID FOREIGN KEY (BOOK_ID)
        REFERENCES BOOKS(ID),
    CONSTRAINT FK_ISSUED_USER_ID FOREIGN KEY (USER_ID)
        REFERENCES USER_PROFILES(USER_ID)
);

CREATE SEQUENCE ISSUE_SEQ START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE USER_SEQ START WITH 1 INCREMENT BY 1;

};

The backend requires your OracleDB credentials. You will need to update the connection details in library-backend/db.js.

// backend/db.js - Update with your credentials
const dbConfig = {
    user: process.env.DB_USER || "your_username",
    password: process.env.DB_PASSWORD || "your_password",
    connectString: process.env.DB_CONNECT_STRING || "localhost/orcl",
};

or you can use .env file in library-backend/.env.

DB_USER=username
DB_PASSWORD=password
DB_CONNECT_STRING=your connect string 
TNS_ADMIN=wallet location(if using autonomous database)
WALLET_PASSWORD=WalletPassword
JWT_SECRET=486789bd67d1638a46f7df9ad56297e (generate online)

The Frontend requires VITE_API_URL . You will need to update the connection details in library-frontend/.env.

#if running on localhost add ths line
VITE_API_URL=http://localhost:5000

Next, navigate to the backend directory, install its dependencies, and start the server.

cd backend
npm install
node server.js

The backend server will start and listen on http://localhost:5000.

3. Frontend Setup

In a new terminal window, navigate to the frontend directory, install its dependencies, and start the React application.

cd frontend
npm install
npm run dev

The frontend development server will launch and be accessible at http://localhost:5173.

πŸ’» Usage

  1. Ensure both the backend and frontend servers are running simultaneously in separate terminals.
  2. Open your web browser and navigate to http://localhost:5173.
  3. Register a new account or log in with existing user credentials.
  4. Once logged in, you can view your profile, see your issued books, and (if you have admin rights) manage other user profiles.

πŸš€ Future Improvements

  • Book Search: Implement a comprehensive search and filtering system for the library's book catalog.
  • Role-Based Access Control (RBAC): Enhance security by adding distinct permissions for admin and student roles.
  • Due Date Notifications: Add automated email or in-app notifications for upcoming book return deadlines.
  • Inventory Management: Create a dashboard for librarians to add, update, and remove books from the library's collection.

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

A full-stack Library Management System designed to streamline library operations. It features a responsive frontend built with React and a robust backend API powered by Node.js and Express. Core functionalities include secure user authentication, detailed profile management, and tracking of issued books, with all data stored in an OracleDB database

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages