explaingit

sqshq/piggymetrics

13,911JavaAudience · developerComplexity · 4/5Setup · hard

TLDR

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

Mindmap

mindmap
  root((Piggy Metrics))
    What it does
      Microservice demo
      Personal finance app
      Spring Boot example
    Business Services
      Account service
      Statistics service
      Notification service
    Infrastructure
      Config service
      Auth with OAuth2
      API Gateway
    Tech Stack
      Java Spring Boot
      Spring Cloud
      MongoDB and Docker
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Study how to split a Java application into microservices where each service owns its own separate database.

USE CASE 2

Learn how to wire together Spring Boot services with a shared Config service, API Gateway, and Auth service.

USE CASE 3

Use it as a starter template for your own microservice-based Java project with Spring Cloud infrastructure already wired up.

USE CASE 4

Understand how OAuth2 authentication works across multiple services that need to trust each other.

Tech stack

JavaSpring BootSpring CloudDockerMongoDBOAuth2

Getting it running

Difficulty · hard Time to first run · 1h+

Requires Docker and Java, all services plus separate MongoDB instances must start together before the app functions.

In plain English

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.

Copy-paste prompts

Prompt 1
Using piggymetrics as a reference, help me set up an API Gateway with Spring Cloud that routes incoming requests to three separate Spring Boot services.
Prompt 2
Show me how to implement a central Config service in Spring Cloud that stores shared settings and can update them while the app is running, as done in piggymetrics.
Prompt 3
How does piggymetrics handle OAuth2 so that its microservices can authenticate both human users and calls from other services?
Prompt 4
Help me adapt the piggymetrics Statistics service pattern to collect events from my own microservices and store time-series data in MongoDB.
Open on GitHub → Explain another repo

← sqshq on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.