A full-stack library application that allows users to register, rent, renew, and return books. The solution consists of a React + TypeScript frontend, a Java + Spring Boot backend, and a MySQL database. Spring Security (with JWT) ensures secure authentication and authorization. The application integrates Stripe for handling payment processing (e.g., late fees), and relies on self-signed HTTPS certificates for enhanced security.
-
User Registration & Login
- Secure sign-up and sign-in flow using Spring Security and JWT tokens.
- Role-based authorization with three main roles: USER, MODERATOR, and ADMIN.
-
Book Management
- CRUD operations for books, with admin privileges to add new titles or modify existing ones.
- View available/total copies for each book.
-
Rent, Return, & Renew
- Users can rent books, see due dates, and return or renew them within the Shelf/Loans menu.
- If a book is overdue (>7 days), the user cannot rent another book until fees are paid.
- Stripe integration for handling fees or membership payments.
-
Ratings & Reviews
- Users can rate books from 0 to 5 stars.
- Logged-in users can leave reviews. Ratings and review statistics are displayed on each book’s page.
-
Search & Categories
- A powerful search page that lets users find books by keyword.
- Sorting by category, rating, or other filters.
-
Messaging System
- Users can send messages/requests to administrators (e.g., report issues or ask questions).
- Admins can reply to users’ messages in an Admin Panel.
-
Self-Signed HTTPS Certificates
- Both frontend and backend run over HTTPS using self-signed certificates for secure communication.
┌────────────────┐ ┌────────────────────────┐
│ React + TS │ HTTPS │ Spring Boot + Security │
│ (Frontend SPA) │ <------> │ (Backend + REST API) │
└────────────────┘ └────────────────────────┘
| |
| |
| MySQL |
└---------------------------┘
-
Frontend
- Built with React (SPA) and TypeScript.
- Communicates with the backend via REST endpoints over HTTPS.
-
Backend
- Spring Boot + Spring Security (JWT) for secure and robust HTTP-based services.
- Exposes RESTful APIs, handles payments with Stripe, and enforces role-based access control.
-
Database
- MySQL manages user profiles, book records, transactions, messages, and other persistent data.
| Layer | Technology |
|---|---|
| Frontend | React, TypeScript, HTML, CSS |
| Backend | Java 11+, Spring Boot, Spring Security (JWT) |
| Database | MySQL 8+ |
| Payments | Stripe API |
| Auth | Spring Security + JWT |
| Hosting | Self-signed HTTPS Certificates (dev/production) |
Below are high-level steps for local development. Adjust to your needs if you have a particular CI/CD pipeline or deployment environment.
- Java 11+ installed.
- Node.js (v14+) and npm or Yarn for frontend.
- MySQL 8+ running locally or a remote MySQL instance.
- A Stripe account (and API keys) for payment integration.
- (Optional) Self-signed certificates for HTTPS configuration.
git clone https://github.com/<your-username>/<library-app>.git
cd library-app- Open the
application.properties(orapplication.yml) in the backend directory. - Provide your MySQL connection details:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/library?allowPublicKeyRetrieval=true&useSSL=false&createDatabaseIfNotExist=true&serverTimezone=UTC spring.datasource.username=<db_user> spring.datasource.password=<db_password> # Stripe integration stripe.key.secret=<your_stripe_api_key>
- Navigate to the frontend directory (e.g.,
cd frontend). - In the
.envfile where the environment variables are stored, add your React Stripe key:REACT_APP_STRIPE_KEY=<your_react_stripe_api_key> - Install dependencies:
or
npm install
yarn install
# From the backend directory
./mvnw spring-boot:run(Or use your preferred IDE to run the Spring Boot application.)
# From the frontend directory
npm start(Or yarn start if you use Yarn.)
After successful startup, you should be able to access the application at:
Frontend (HTTPS): https://localhost:3000
Backend (HTTPS) : https://localhost:8443
-
Register a New Account:
- Go to the registration page.
- Fill in your details. Your account will start with USER permissions by default.
-
Log In:
- Use your credentials to log in.
- A JWT token is returned and stored locally to authorize future requests.
-
Browse & Search Books:
- On the Search page, type a keyword or select a category to filter books.
- Check each book’s availability, rating, and total copies.
-
Rent, Return, or Renew:
- Under Shelf/Loans, you will see which books you have currently loaned.
- Return or Renew any book if it’s nearing its 7-day limit.
- Overdue books will incur fees, payable via Stripe.
-
Leave a Review:
- Rate the book (1–5 stars) and optionally leave a textual review once you have loaned the book.
-
Admin Panel (ADMIN Role Required):
- Add new books, change quantities, manage user messages.
- Reply to messages from users within the panel.
-
Paying Fees:
- Overdue fees or membership costs can be paid by navigating to the Fees menu, which uses Stripe for secure payment.
Contributions are welcome! To propose changes:
- Fork the repository.
- Create a new feature branch.
- Commit your changes with descriptive messages.
- Open a pull request against the main branch.
We encourage developers to write clean, testable code and follow general best practices for both React/TypeScript and Java/Spring Boot.
This project is licensed under the terms of the MIT License. Feel free to modify and use this project in your own applications, subject to the terms of the license.
Thank you for checking out the Library App!
If you have any questions or suggestions, please feel free to open an issue or submit a pull request. Enjoy reading!





