ArchLibrary is an online library management system built using:
- Backend: Spring Boot (Java 17), MySQL
- Frontend: Next.js (React with TypeScript)
- Authentication: JWT (JSON Web Tokens)
- Database: MySQL 8+
- Deployment: Localhost (can be easily extended to AWS or GCP)
The application supports user registration, authentication, borrowing and returning books, fine management, and admin-specific functionality.
- Java 17+
- Maven 3.8+
- MySQL 8+
- IDE (IntelliJ IDEA / Eclipse / VS Code)
- Create a MySQL database named
archlibrary.
CREATE DATABASE archlibrary;- In your
application.properties(orapplication.yml) configure:
spring.datasource.url=jdbc:mysql://localhost:3306/archlibrary
spring.datasource.username=your_mysql_username
spring.datasource.password=your_mysql_password
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
server.port=8080- Navigate to the backend root folder.
- Run the following command:
mvn clean install
mvn spring-boot:runThe backend will start on:
http://localhost:8080
- JWT Authentication is enabled via a custom
JwtFilter. - CORS is configured to allow requests from
http://localhost:3000. @Table(name = "BorrowedBook")and similar annotations are added to prevent Hibernate auto-splitting table names.- Borrowing and Returning books automatically adjust available copies.
- Overdue returns automatically generate unpaid fines.
- Node.js 18+
- npm 9+
- IDE (VS Code recommended)
- Navigate to the frontend root folder.
- Install dependencies:
npm installnpm run devThe frontend will start on:
http://localhost:3000
- Axios instance is configured to automatically attach Authorization headers.
- After login,
token,userId,email, androleare stored in localStorage. - Protected routes (like dashboard, admin panel) check for valid login status.
- Role-based UI (Student vs Librarian) is dynamically rendered.
- Visit
/registerto create a new account. - Choose the role: Student or Librarian.
- Login via
/loginafter registration.
- Search available books.
- Borrow and return books.
- View active and historical borrowed books.
- View outstanding fines.
- Manage books: Add, Update.
- Manage fines: View all active fines and mark fines as paid.
- View and manage borrowed book transactions.
POST /api/auth/register- Register new userPOST /api/auth/login- Login and receive JWT + user details
GET /api/books- List all booksGET /api/books/search?title=xyz- Search books by titlePOST /api/books- Add new book (Librarian only)PUT /api/books/{bookId}- Update book details (Librarian only)
POST /api/library/borrow?userId=...&bookId=...- Borrow a bookPOST /api/library/return?userId=...&bookId=...- Return a book
GET /api/fines/user/{userId}- Get fines for a specific userPUT /api/fines/{fineId}/pay- Pay a specific fine (Librarian)GET /api/fines- List all fines (Librarian)
GET /api/borrowed/user/{userId}- Get borrowed books for userGET /api/borrowed/user/{userId}/active- Get active borrowed books for userGET /api/borrowed/overdue- Get all overdue borrowed booksGET /api/borrowed/user/{userId}/details- Get borrowed book details including book metadata
- Always ensure backend is running before frontend.
- Frontend expects all API endpoints to be served at
localhost:8080. - If modifying authentication flows, update both JWT token creation and parsing accordingly.
- Consider using environment variables for production deployment.
For any queries, issues, or contributions, please contact the project maintainer or open an issue in the repository.