gitmyhub

piggymetrics

Java ★ 14k updated 2y ago

Microservice Architecture with Spring Boot, Spring Cloud and Docker

Piggymetrics is a sample personal-finance app built as a teaching example to demonstrate microservice architecture using Spring Boot, Spring Cloud, and Docker.

JavaSpring BootSpring CloudDockerMongoDBOAuth2setup: hardcomplexity 4/5

Piggy Metrics is a sample personal-finance application built mainly as a teaching example. The README is clear that the app itself, a simple financial advisor that tracks your incomes, expenses, and savings, is not the real point. The point is to show off a particular way of building software called the microservice architecture, using a set of Java tools named Spring Boot, Spring Cloud, and Docker. People are welcome to copy the project and turn it into something of their own.

The core idea of microservices is that instead of writing one large program, you split the system into several small, separate programs that each handle one job and talk to each other over the network. Piggy Metrics is broken into three such business services. The Account service handles the user's income and expense entries, savings, and settings. The Statistics service does the number-crunching, calculating figures and recording them over time so cash-flow trends can be shown. The Notification service stores contact details and reminder settings, and a scheduled worker gathers data from the other services to send email reminders. The README documents each service as a table of web addresses (endpoints) showing what each one does and whether a logged-in user is required.

A notable design rule is that each service has its own separate database, here MongoDB, so no service can reach into another's data directly. They only communicate through their published interfaces.

The rest of the README covers the supporting infrastructure that holds the small services together. A Config service keeps all the settings in one central place and can even change them while the app is running. An Auth service handles logging in and issuing security tokens, using a standard called OAuth2, both for human users and for the services to trust each other. An API Gateway acts as the single front door, taking incoming requests and routing them to the right service behind the scenes. Together these pieces demonstrate common patterns that distributed systems need, which is why the project is widely used as a reference for learning Spring Cloud.

Where it fits