Free Library is a Spring Boot-based backend application designed to manage a digital library system. The application provides functionality for user authentication, book management, PDF uploads, and administrative controls.
- User registration
- JWT-based authentication
- Role-based access control
- Create and list books
- Filter books by title, author, and category
- Administrative book management
- PDF file uploads
- Automatic cleanup of temporary PDF files
- User management
- Book deletion
- User activation/deactivation
- Language: Java 21
- Framework: Spring Boot
- Security: Spring Security
- Authentication: JWT
- Database: (Not specified in provided files, likely configurable)
- Build Tool: Gradle
- Additional Libraries:
- Bcrypt for password hashing
- Cloudinary for PDF storage
- Swagger for API documentation
src/main/java/alekssandher/free_library/
│
├── config/ # Configuration classes
├── dto/ # Data Transfer Objects
├── entities/ # Database entity definitions
├── modules/ # Business logic modules
│ ├── admin/
│ ├── auth/
│ ├── book/
│ ├── pdf/
│ └── users/
├── repository/ # Database repositories
└── exception/ # Custom exception handling
-
Authentication (
AuthController):/auth/register: User registration/auth/login: User login, returns JWT
-
Book Management (
BookController):GET /books: List books with filteringPOST /books: Create a new book
-
Admin Operations (
AdminController):GET /admin/users/{name}: Find users by nameGET /admin/books: List books (admin view)DELETE /admin/books/{bookPublicId}: Delete a bookPATCH /admin/users/{userPublicId}/{kind}: Modify user status
-
PDF Handling (
PdfController):POST /pdfs/uploadPdf: Upload PDF files
- JWT-based authentication
- Role-based access control
- Custom access denied handling
- Stateless session management
- CORS configuration
The project uses Swagger/OpenAPI for API documentation. Access the documentation at /docs.html when the application is running.
The API is available for online testing at: Free Library API
- Java 21
- Gradle
- (Configured) Database
- Cloudinary account for PDF storage
For development mode, you can use the dev profile:
./gradlew bootRun --args='--spring.profiles.active=dev'./gradlew clean build
./gradlew bootRunThe project includes a Dockerfile for containerization:
- Uses multi-stage build
- Builds with Gradle
- Runs on Java 21
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the GPL 3 License - see the LICENSE file for details.