Full-stack Library Management System with role-based access control and JWT authentication. Built with Spring Boot and React.
- About The Project
- Features
- Tech Stack
- Security
- Architecture
- Database Architecture
- REST API Structure
- Screenshots
- How to Run
Please note: This repository contains only the back-end part of the application.
Mita is a full-stack web application for managing a digital library. The system supports authentication, authorization, and various operations for users, categories, and items.
It follows a stateless architecture using JWT with automatic token refresh on the frontend.
👤 User
-
Registration & Login
-
Full CRUD for categories
-
Full CRUD for items
-
Quick item search and filtering
-
Various item sorting options
-
Edit profile
👑 Admin
-
Access to admin dashboard
-
Manage all users
-
Role-based access control (ADMIN / USER)
Backend
-
Java 21
-
Spring Boot
-
Spring Data
-
Spring Security
-
JWT
-
REST API
-
PostgreSQL
Frontend
-
React
-
Fetch API
-
Automatic token refresh
-
Protected routes
-
SPA architecture
-
Stateless authentication using JWT
-
Access token + Refresh token mechanism
-
Automatic access token refresh on expiration
-
Role-based authorization
-
Custom JwtAuthenticationFilter
-
Protected REST endpoints
-
Admin-only API routes (/api/admin/**)
The application follows a classic client-server architecture:
flowchart TD
A[React SPA] --> B[Spring Boot REST API]
B --> C[PostgreSQL Database]
There is three main tables in database
erDiagram
USER ||--o{ CATEGORY : owns
USER ||--o{ ITEM : creates
CATEGORY ||--o{ ITEM : contains
USER {
Long id
String username
String email
String password
String avatar
String about
Role role
}
CATEGORY {
Long id
String name
Long userId
}
ITEM {
Long id
String title
Double rating
String additionalInfo
String poster
Long userId
Long categoryId
}
🔑 Auth Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register | Register user |
| POST | /api/auth/authenticate | Login |
| POST | /api/auth/refresh | Refresh access token |
| POST | /api/auth/logout | Logout |
👤 User Endpoints
| Method | Endpoint | Access | Description |
|---|---|---|---|
| GET | /api/users/profile | Authenticated | Get user info |
| PUT | /api/users/avatar | Authenticated | Update avatar |
| PUT | /api/users/about | Authenticated | Update about block |
| PUT | /api/users/name | Authenticated | Update name |
| GET | /api/users/stats | Authenticated | Get user stats |
📂 Category Endpoints
| Method | Endpoint | Access | Description |
|---|---|---|---|
| GET | /api/categories | Authenticated | Get categories |
| GET | /api/categories/{id} | Authenticated | Get category by id |
| POST | /api/categories | Authenticated | Add category |
| PUT | /api/categories/{id} | Authenticated | Update category |
| DELETE | /api/categories/{id} | Authenticated | Delete category |
📦 Item Endpoints
| Method | Endpoint | Access | Description |
|---|---|---|---|
| GET | /api/items | Authenticated | Get items with filtration and sorting |
| GET | /api/items/{id} | Authenticated | Get item by id |
| POST | /api/items | Authenticated | Add item |
| PUT | /api/items/{id} | Authenticated | Update item |
| DELETE | /api/items/{id} | Authenticated | Delete item |
👑 Admin Endpoints
| Method | Endpoint | Access | Description |
|---|---|---|---|
| GET | /api/admin/user-by-email | ADMIN | Get user by email |
| DELETE | /api/admin/user-by-email | ADMIN | Delete user by email |
Main page have several blocks:
- Categories list
- Items list
- Filter bar
- Hidden navigation bar
Profile page:
- Avatar and name
- About block
- Best items for each category
- Logout button
Add item page:
- Input fields
- Preview card
- Submit button
- Cancel button
Registration page:
Login page:
Backend
mvn spring-boot:run
Runs on:
http://localhost:8080




