A high-performance stock portfolio management system built with gRPC, featuring real-time price streaming, alerts, and portfolio analytics.
- Real-Time Price Updates: Server-side streaming of stock prices with sub-second latency
- Portfolio Management: Track multiple stocks with purchase history and performance metrics
- Price Alerts: Set custom alerts with notifications when target prices are reached
- Bidirectional Streaming: Live portfolio updates while managing positions
- Historical Data: View and analyze historical price trends
- Multi-Language Support: Leveraging Protocol Buffers for polyglot development
βββββββββββββββ gRPC/HTTP2 βββββββββββββββ
β βββββββββββββββββββββββββββββΊβ β
β Frontend β Bidirectional Stream β Backend β
β (React + β Server-Side Stream β (Go) β
β gRPC-Web) β Unary RPCs β β
β β β β
βββββββββββββββ ββββββββ¬βββββββ
β
ββββββββββ΄βββββββββ
β β
βββββββΌβββββββ ββββββββΌββββββ
β PostgreSQL β β Redis β
β (Portfolio)β β (Cache) β
ββββββββββββββ ββββββββββββββ
Backend:
- Go 1.24+
- gRPC & Protocol Buffers
- PostgreSQL (portfolio data)
- Redis (price caching)
- Alpha Vantage API (market data)
Frontend:
- React 18.2+
- gRPC-Web
- Recharts (visualization)
- Lucide React (icons)
DevOps:
- Docker & Docker Compose
- Envoy Proxy (gRPC-Web gateway)
- Comprehensive Makefile (build, test, deploy)
# Install Go 1.24+
go version
# Install Protocol Buffers Compiler
# Mac
brew install protobuf
# Ubuntu/Debian
sudo apt-get install protobuf-compiler
# Install gRPC tools
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest# Clone the repository
git clone https://github.com/yourusername/realtime-portfolio-tracker.git
cd realtime-portfolio-tracker
# Complete setup (install deps, generate proto, build images)
make setup
# Start all services
make up
# View comprehensive help
make helpThe application will be available at:
- Frontend: http://localhost:3000
- gRPC-Web API: http://localhost:8081
- Backend gRPC: localhost:50052
- Envoy Admin: http://localhost:9901
# Start databases only
make up postgres redis envoy
# Run backend in development mode
make dev-backend
# Run frontend in development mode (new terminal)
make dev-frontendBackend:
cd backend
# Install dependencies and generate proto
make install-backend proto-backend
# Run server in development mode
make dev-backendFrontend:
cd frontend
# Install dependencies and generate proto
make install-frontend proto-frontend
# Run development server
make dev-frontendDemo Portfolio: The application comes with 6 pre-loaded stocks and streams live prices from 10 available symbols (AAPL, GOOGL, MSFT, AMZN, TSLA, META, NVDA, NFLX, JPM, JNJ).
The project includes a comprehensive Makefile with many useful commands:
# Development
make setup # Complete project setup
make dev # Start full development stack
make test # Run all tests
make lint # Lint all code
make format # Format all code
# Docker operations
make up # Start all services
make down # Stop all services
make logs # View all logs
make clean # Clean everything
# Database
make db-shell # PostgreSQL shell
make db-status # Database status
make db-backup # Backup database
# gRPC testing
make grpc-health # Check gRPC health
make grpc-test # Test gRPC endpoints
# Health checks
make health # Check all services
make doctor # System health checkAdd a new stock to your portfolio.
rpc AddStock(AddStockRequest) returns (AddStockResponse);Receive real-time price updates for your watchlist.
rpc StreamPrices(StreamPricesRequest) returns (stream PriceUpdate);Interactive portfolio management with live updates.
rpc LivePortfolio(stream PortfolioAction) returns (stream PortfolioUpdate);See proto/portfolio.proto for complete API definitions.
# Run all tests
make test
# Backend tests only
make test-backend
# Frontend tests only
make test-frontend
# Generate coverage report
make test-coverage
# Run linting
make lint
# Auto-fix linting issues
make lint-fix- Latency: < 50ms for price updates
- Throughput: Handles 10,000+ concurrent streams
- Payload Size: 90% smaller than REST+JSON
- Connection Efficiency: Single HTTP/2 connection for all operations
- Basic portfolio management
- Real-time price streaming
- Price alerts
- Authentication & Authorization (JWT)
- Mobile app (React Native)
- Advanced charts (candlestick, technical indicators)
- Portfolio optimization suggestions
- Multi-currency support
- Social features (share portfolio performance)
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details
- Market data provided by Alpha Vantage
- Built with gRPC
- Inspired by modern trading platforms
Your Name - @yourtwitter
Project Link: https://github.com/yourusername/realtime-portfolio-tracker
Note: This is a demonstration project for learning gRPC. Not intended for actual financial trading.