The Online Library Management System is a web application built using the MERN stack (MongoDB, Express.js, React.js, Node.js). The application allows users to manage books in a library, including functionalities for adding books, viewing the library catalog, and user authentication.
- User Authentication: Secure user registration and login using JWT.
- Book Management: Add, view, and manage books in the library.
- Responsive Design: User-friendly and responsive interface.
- Frontend: React.js, Bootstrap
- Backend: Node.js, Express.js
- Database: MongoDB
- Authentication: JSON Web Tokens (JWT)
- Node.js
- npm (Node Package Manager)
- MongoDB
-
Clone the repository:
git clone https://github.com/your-username/online-library-system.git cd online-library-system/backend
-
Install backend dependencies:
npm install
-
Create a
.env
file in thebackend
directory and add the following environment variables:PORT=5000 MONGO_URI=your_mongodb_uri JWT_SECRET=your_jwt_secret
-
Start the backend server:
npm start
-
Navigate to the
frontend
directory:cd ../frontend
-
Install frontend dependencies:
npm install
-
Start the frontend development server:
npm start
- Ensure MongoDB is running.
- Start the backend server:
cd backend npm start
- Start the frontend development server:
cd ../frontend npm start
- Open your browser and navigate to
http://localhost:3000
.
- Register User:
POST /api/auth/register
- Login User:
POST /api/auth/login
- Add Book:
POST /api/books
(Authorization: Bearer<JWT Token>
) - Get Books:
GET /api/books
-
Register User:
POST http://localhost:5000/api/auth/register { "username": "testuser", "name": "Test User", "email": "[email protected]", "password": "password123", "contactNumber": "1234567890" }
-
Login User:
POST http://localhost:5000/api/auth/login { "email": "[email protected]", "password": "password123" }
-
Add Book:
POST http://localhost:5000/api/books Headers: { "Authorization": "Bearer <JWT Token>" } { "name": "The Great Gatsby", "author": "F. Scott Fitzgerald", "availabilityStatus": true }
-
Get Books:
GET http://localhost:5000/api/books
online-library-system/
├── backend/
│ ├── controllers/
│ ├── models/
│ ├── routes/
│ ├── server.js
│ ├── .env
│ └── package.json
├── frontend/
│ ├── public/
│ ├── src/
│ │ ├── components/
│ │ ├── App.js
│ │ ├── index.js
│ │ └── ...
│ ├── .env
│ └── package.json
├── README.md
└── .gitignore
Contributions are welcome! Please fork the repository and submit a pull request for any features, improvements, or bug fixes.