My first blog post
Hello
Hello world!
Hello world!
Hello world!
require(“mc.core.options”)
catalog-service
repository on Github
(which belongs to NovelNest
organization)In other words, we can say the application should provide an API to perform CRUD operations on books.
Endpoint | HTTP Method | Request body | Status | Response body | Description |
---|---|---|---|---|---|
/v1/books | GET | 200 | Book[] | Get all the books in the catalog | |
/v1/books | POST | Book | 201 | Book | Add a new book to the catalog |
402 | A book with the same ISBN already exists | ||||
/v1/books/{isbn} | GET | 200 | Book | Get the book with the given ISBN | |
404 | No book with the given ISBN exists | ||||
/v1/books/{isbn} | PUT | Book | 200 | Book | Update the book with the given ISBN |
201 | Book | Create a book with the given ISBN | |||
/v1/books/{isbn} | DELETE | 204 | Delete the book with the given ISBN |
The contract is established through the REST API, so let’s move on and look at the business logic. The solution is centered around three concepts:
Entity
: an entity represents the noun in a domain. In this case: “Book”.Service
: a service defines the use cases for the domain. For example: “adding a book to the catalog”.Repository
: a repository is an abstraction to let the domain layer access data independently from its source.com.novelnest.catalogservice.domain
package for the business logic, create a Book
java record to
represent the domain entity.In this series, I aim to build an example web app as close as real-world scenario as possible and then set up the necessary infrastructure for it from scratch.
NovelNest
is a specialized bookshop whose mission is to spread knowledge and information. The organization behind NovelNest - has decided to start selling
its book online.
PostgreSQL
database to permanently store the data processed by the application.Flyway
Spring AMQP
and RabbitMQ
Redis
Prometheus
, Grafana
OpenTelemetry
Fluentbit
, Loki