Skip to content

Gfood is an app for managing food delivery which was designed following a mudular monolith architecture. This project was based on this original monolith: https://github.com/microservices-patterns/ftgo-monolith.

Notifications You must be signed in to change notification settings

giuliana-bezerra/gfood

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gfood

Technologies   |    Project   |    Solution   |    Configuration   |    Build and Run   |    Developing

License Modular Monolith


✨ Technologies

💻 Project

Gfood is an app for managing food delivery which was designed following a mudular monolith architecture. This project was based on this original monolith.

💡 Solution

A modular monolith is an architecture more close to microsservices and therefore it has several benefits regarding reusability, dependency management, observability and teams workflow.

Gfood was designed in several modules, each with its own responsability:

  • gfood-application: The app itself which depends on all modules to run.
  • gfood-*-service: Domain service which provides business functionality.
  • gfood-*-service-api: API definitions for consumers of the domain service.
  • gfood-common: Common components reused by others.
  • gfood-domain: Domain classes and repositories that map database structures.
  • gfood-end-to-end-tests: Integration tests of all functionalities.
  • gfood-flyway: Migrations that create gfood database structures.
  • gfood-swagger: Swagger UI configuring all gfood APIs.

Each project generates its own jar file, which are dependencies of gfood-application. The following diagram shows gfood in terms of its services and related functionalities:

gfood

🛠️ Configuration

Gfood requires a mysql database for persisting data, so you have to configure an user and database as folows:

$ sudo mysql

CREATE USER 'user'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION;

exit

$ mysql -u user -p

CREATE DATABASE gfood;

exit

On building phase, the tables will be created by migrations configured using Flyway.

🚀 Build and Run

For building and testing, execute the script:

$ ./build-and-test.sh

For building and running, execute the script:

$ ./build-and-run.sh

The APIs will be available in Swagger-UI: http://localhost:8080/swagger-ui.html.

👩‍💻 Developing

Adding more functionality to gfood requires following the steps below to maintain consistency with modular monolith architecture:

  • Create a new spring boot project for the new service (ex: gfood-payment-service)
  • Create a new spring boot project for the service api (ex: gfood-payment-service-api)
  • Import the new ServiceConfig class in GfoodApplication
  • Create new domain classes and repositories inside gfood-domain
  • Create any common class inside gfood-common
  • Create new migrations inside gfood-flyway
  • Add unit tests inside the new service project
  • Add integration tests inside gfood-end-to-end-tests
  • Change scripts to build and test/run the new projects

About

Gfood is an app for managing food delivery which was designed following a mudular monolith architecture. This project was based on this original monolith: https://github.com/microservices-patterns/ftgo-monolith.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published