Skip to content
LI123456moPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

gRPC Trading Platform

A Spring Boot + gRPC demo trading system built as a multi-module Maven project. It shows how to share protobuf contracts, expose gRPC services, call them from another service, and bridge gRPC to REST/SSE.

Highlights

  • Shared protobuf contracts in one module
  • gRPC server implementations for users and stock prices
  • REST gateway that consumes gRPC services
  • Unary RPCs and server-streaming RPCs
  • H2-backed persistence for user data
  • Integration tests for gRPC and SSE flows

Modules

Module Responsibility
proto Protobuf messages and generated gRPC classes
user-service gRPC user service with H2 + JPA storage
stock-service gRPC stock service with in-memory prices and live updates
aggregator-service REST API that calls the gRPC services

Request flow

REST client -> aggregator-service -> gRPC -> user-service / stock-service
  • aggregator-service handles HTTP requests.
  • user-service stores users and portfolio items in H2.
  • stock-service serves prices from memory and streams updates.

Tech stack

  • Java 21
  • Spring Boot 3.5
  • gRPC
  • Protocol Buffers
  • Spring Data JPA
  • H2 database

Main endpoints

REST API

Endpoint Description
GET /user/{id} Fetch user information
POST /trade Buy or sell a stock
GET /stock/updates Stream live stock updates as SSE

gRPC services

  • user.UserService
    • GetUserInformation
    • TradeStock
  • stock.StockService
    • GetStockPrice
    • GetPriceUpdates

Running the project

Build and test everything:

mvn clean test

Run a specific service:

mvn spring-boot:run -pl user-service
mvn spring-boot:run -pl stock-service
mvn spring-boot:run -pl aggregator-service

Notes

  • user-service uses H2, so data resets when the app stops.
  • stock-service keeps prices in memory, so its state also resets on restart.
  • The project is intended as a learning and portfolio demo for gRPC in Spring Boot.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages