This is my very first Spring Boot project — a simple Book Tracker API that allows users to manage books with full CRUD functionality. The app follows a clean layered architecture and connects to an in-memory H2 database.
- ➕ Add a new book
- 📖 View all books
- 🔍 Get book by ID
- ✏️ Update book details
- ❌ Delete a book
- 🔄 RESTful API structure
- 💾 H2 Database for testing
- Java 17+
- Spring Boot
- Spring Data JPA
- H2 Database
- Maven
- Postman
src/
└── main/
├── java/
│ └── com.example.booktracker
│ ├── controller
│ ├── model
│ ├── repository
│ └── service
└── resources/
├── application.properties
| Method | Endpoint | Description |
|---|---|---|
| GET | /books |
Get all books |
| GET | /books/{id} |
Get book by ID |
| POST | /books |
Create a new book |
| PUT | /books/{id} |
Update book by ID |
| DELETE | /books/{id} |
Delete book by ID |
- Clone the project:
https://github.com/nethmith/bookTrackerAPI.git
cd book-tracker-
Open in IntelliJ / VS Code
-
Start the application:
./mvnw spring-boot:run- Access the API:
http://localhost:8080/books
- Access H2 Console:
http://localhost:8080/h2-console
- JDBC URL:
jdbc:h2:mem:testdb - Username:
sa - Password: (leave blank)
{
"title": "Atomic Habits",
"author": "James Clear",
"genre": "Self-help"
}Test all endpoints using Postman. Make sure your request body is in raw JSON and headers include:
Content-Type: application/json
This project is open-source and free to use for learning or educational purposes.
Built with ❤️ by Nethmi Herath 🔗 Portfolio 📘 This is my first Spring Boot project!