A full-stack web application for managing a library — built with Spring Boot on the backend and React + Vite on the frontend, powered by PostgreSQL.
Modern SaaS-style UI: purple gradient sidebar, split-panel auth pages, dark mode, live stats dashboard, and full CRUD for books, authors, categories, and members.
- Register in 2 steps: Account (name, username, email, password) → Profile (phone, address)
- Real-time password strength hints (length, number/symbol, mixed case)
- Login with username or email (case-insensitive)
- Session persisted in
localStorage; protected routes auto-redirect to login
- Add books with title, author, image URL, publish year, description, and categories
- Searchable / filterable book grid with cover images and availability status
- Borrow and Return with live status updates
- Book detail modal with full description and metadata
- Add authors with name and bio
- Inline edit (name + bio) directly from the author card
- Click an author to see all their books
- Create and browse categories (Fiction, Science, History, etc.)
- Books can belong to multiple categories (many-to-many)
- View all registered users with profile details
- See which books each user currently has borrowed
- "You" badge highlights the logged-in user
- Live counters: total books, available, borrowed, authors, categories, members
- Recently added books grid (last 6)
- My Borrowed Books panel + Quick-action shortcuts
- Edit display name, email, phone, address
- Change password with current-password verification
- Auto-generated avatar from initials
- Dark mode toggle (persisted via
data-themeon<html>) - Gradient purple sidebar with smooth active/hover states
- Split-panel auth pages — white form left, blue-to-purple graphic right
- Fully responsive; auth right panel hides on mobile
- 100% custom CSS — no UI framework
| Layer | Technology |
|---|---|
| Backend | Java 21, Spring Boot 3.2.5, Spring Data JPA, Hibernate |
| Database | PostgreSQL 17 |
| Frontend | React 18, Vite 5, React Router DOM v6 |
| Styling | Custom CSS design system (no framework) |
| Build | Maven (backend), npm (frontend) |
java-library-management-system/
├── backend/
│ └── src/main/java/com/library/
│ ├── config/ CorsConfig.java
│ ├── controller/ AuthController, BookController, AuthorController,
│ │ CategoryController, UserController
│ ├── dto/ AuthRequest, AuthResponse, BookRequest
│ ├── entity/ User, Profile, Book, Author, Category
│ ├── repository/ UserRepository (email + username lookup)
│ ├── service/ UserService (login, register, profile update)
│ └── LibraryApplication.java
│
└── frontend/src/
├── api/api.js All fetch() calls with error handling
├── pages/
│ ├── Login.jsx Split-panel, underline inputs, social buttons
│ ├── Register.jsx 2-step, password hints, split-panel
│ ├── Dashboard.jsx Gradient sidebar + dark mode toggle
│ ├── Home.jsx Stats dashboard + recent books
│ ├── Books.jsx Grid + search + filter + detail modal
│ ├── Authors.jsx Inline edit with bio
│ ├── Categories.jsx
│ ├── Users.jsx Member list with borrowed books
│ └── Profile.jsx Edit profile + change password
├── App.jsx Routes + PrivateRoute guard
└── index.css Custom CSS design system
User ──────── Profile One-to-One
User ──────── Book[] One-to-Many (borrowed books)
Book ──────── Author Many-to-One
Book ──────── Category[] Many-to-Many
Tables are auto-created and migrated by Hibernate (ddl-auto=update).
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/register |
Register new user |
| POST | /auth/login |
Login with username or email |
| GET | /books |
List all books |
| POST | /books |
Add a book |
| PUT | /books/{id}/borrow/{userId} |
Borrow a book |
| PUT | /books/{id}/return |
Return a book |
| GET | /authors |
List all authors |
| POST | /authors |
Add an author |
| PUT | /authors/{id} |
Update name + bio |
| GET | /authors/{id}/books |
Books by author |
| GET | /categories |
List all categories |
| POST | /categories |
Add a category |
| GET | /users |
List all users |
| GET | /users/{id}/books |
Books borrowed by user |
| PUT | /users/{id}/profile |
Update profile (name, email, phone, address, password) |
- Java 21+, Maven 3.9+, Node.js 18+, PostgreSQL 17
CREATE DATABASE librarydb;cd backend
mvn spring-boot:runAPI runs at http://localhost:8080
cd frontend
npm install # first time only
npm run devApp opens at http://localhost:5174
Vite proxies
/api/*tohttp://localhost:8080— no CORS issues in development.
backend/src/main/resources/application.properties:
spring.datasource.url=jdbc:postgresql://localhost:5432/librarydb
spring.datasource.username=postgres
spring.datasource.password=root
spring.jpa.hibernate.ddl-auto=update
server.port=8080
server.error.include-message=alwaysBuilt by storm309