Example project applying hexagonal architecture with Dart Frog
Domain
Concepts that are in our context (User, Product, Cart, etc), and business rules that are determined exclusively by us ( domain services),
Application
The application layer is where the use cases of our application live (register user, publish product, add product to cart, etc).
Infrastructure
Code that changes based on external decisions. In this layer will live the implementations of the interfaces that we will define a domain level. That is, we will rely on the SOLID DIP to be able to decouple from external dependencies.
./gradlew check
# 🏁 Start the dev server
dart_frog dev
curl --location --request GET 'http://localhost:8080/ping'
POST
curl --location --request POST 'http://localhost:8080/product' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": "uuid"
"name": "product name",
"price": 120
}'
GET
Get all products
curl --location --request GET 'http://localhost:8080/product'
Get product by id
curl --location --request GET 'http://localhost:8080/product/9e6fcea9-237e-4055-ab31-95f90aac2f80'