https://github.com/miriappel/spring-library-api
Java REST API built with Spring Boot and JPA for managing library users, books and magazines.
https://github.com/miriappel/spring-library-api
hibernate java maven rest-api spring-boot
Last synced: 3 months ago
JSON representation
Java REST API built with Spring Boot and JPA for managing library users, books and magazines.
- Host: GitHub
- URL: https://github.com/miriappel/spring-library-api
- Owner: MiriAppel
- Created: 2025-08-31T17:50:22.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-09-20T19:39:49.000Z (10 months ago)
- Last Synced: 2025-09-20T21:24:25.224Z (10 months ago)
- Topics: hibernate, java, maven, rest-api, spring-boot
- Language: Java
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring Library API
A REST API for managing library users, books, and magazines built with Spring Boot.
## Features
- **User Management**: Add, update, delete, and view library users
- **Item Management**: Manage books and magazines in the library
- **REST API**: Full CRUD operations via HTTP endpoints
## Technologies Used
- **Java 24**
- **Spring Boot 3.4.4**
- **Spring Data JPA**
- **Hibernate**
- **Microsoft SQL Server**
- **Maven**
- **Lombok**
## API Endpoints
### Users
- `GET /user/getAll` - Get all users
- `POST /user/add` - Add new user
- `PUT /user/update/{id}` - Update user
- `DELETE /user/delete/{id}` - Delete user
### Items
- `GET /item/getAll` - Get all items
- `POST /item/add` - Add new item
- `PUT /item/update/{id}` - Update item
- `DELETE /item/delete/{id}` - Delete item
## Database Configuration
Configure your SQL Server connection in `application.properties`:
```properties
spring.datasource.url=jdbc:sqlserver://[server];database=[database_name];trustServerCertificate=true;
spring.datasource.username=[username]
spring.datasource.password=[password]
```
## How to Run
1. Clone the repository:
```bash
git clone https://github.com/MiriAppel/spring-library-api.git
cd spring-library-api
```
2. Configure database connection in `application.properties`
3. Run the application:
```bash
mvn spring-boot:run
```
4. Access the API at `http://localhost:8080`
## Architecture
Built using **layered architecture** with clear separation of concerns:
- **Controllers** - Handle HTTP requests and responses
- **Services** - Business logic and validation
- **Repositories** - Data access layer with JPA
- **Entities** - Domain models with inheritance (Book/Magazine extend Item)
## Project Structure
```
src/main/java/com/example/SpringProject/
├── controllers/ # REST controllers
├── entities/ # JPA entities
├── repositories/ # Data repositories
└── services/ # Business logic
```