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.
- 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.
.
βββ 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
The application uses four main tables in the Oracle database.
(version - Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production)
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 |
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) |
Stores detailed information about each user.
| Column | Type | Constraints |
|---|---|---|
| USER_ID | NUMBER | NOT NULL |
| NAME | VARCHAR2(100) | |
| VARCHAR2(100) | ||
| ROLE | VARCHAR2(20) | |
| DEPARTMENT | VARCHAR2(100) | |
| YEAR | VARCHAR2(50) | |
| JOIN_DATE | DATE | |
| BOOKS_ISSUED | NUMBER | |
| AVATAR | VARCHAR2(1000) |
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) |
To get this project up and running locally, please follow these steps.
- 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.
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-Systemrun 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.jsThe backend server will start and listen on http://localhost:5000.
In a new terminal window, navigate to the frontend directory, install its dependencies, and start the React application.
cd frontend
npm install
npm run devThe frontend development server will launch and be accessible at http://localhost:5173.
- Ensure both the backend and frontend servers are running simultaneously in separate terminals.
- Open your web browser and navigate to
http://localhost:5173. - Register a new account or log in with existing user credentials.
- Once logged in, you can view your profile, see your issued books, and (if you have admin rights) manage other user profiles.
- 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
adminandstudentroles. - 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.
This project is licensed under the MIT License. See the LICENSE file for more details.