A real-time stock trading application with live market data and comprehensive trading capabilities.
├── src/ # Source code
├── deployment/ # Deployment scripts
├── docker/ # Docker configuration
├── scripts/ # AWS management scripts
├── docs/ # Documentation
├── build/ # Build artifacts
├── target/ # Maven build output
└── pom.xml # Maven configuration
mvn spring-boot:run./deployment/docker-deploy.sh./deployment/deploy-final.sh- Java 17 - Core programming language
- Spring Boot 3.2.0 - Application framework
- Spring Data JPA - Database abstraction layer
- Hibernate - ORM framework
- Maven - Dependency management and build tool
- PostgreSQL - Primary database
- Amazon RDS - Managed database service
- HikariCP - Connection pooling
- Thymeleaf - Server-side templating engine
- Bootstrap 5.3.0 - CSS framework
- JavaScript - Client-side interactions
- WebJars - Frontend dependency management
- Amazon EC2 - Application hosting (t3.micro)
- Amazon RDS - PostgreSQL database hosting
- Amazon VPC - Network isolation
- Security Groups - Network access control
- Finnhub API - Real-time stock market data
- Alpha Vantage API - Additional market data (configured)
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Web Browser │ │ Amazon EC2 │ │ Amazon RDS │
│ │ │ │ │ │
│ Bootstrap UI │◄──►│ Spring Boot App │◄──►│ PostgreSQL DB │
│ JavaScript │ │ (Port 5000) │ │ (Port 5432) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
▼
┌──────────────────┐
│ Finnhub API │
│ │
│ Real-time Stock │
│ Market Data │
└──────────────────┘
┌───────────────────────────────────────────────────────────────────┐
│ AWS VPC Network │
│ ┌─────────────────┐ ┌─────────────────────────────┐ │
│ │ Public Subnet │ │ Private Subnet │ │
│ │ │ │ │ │
│ │ EC2 Instance │ │ RDS PostgreSQL │ │
│ │ Security Group │ │ Security Group │ │
│ │ - Port 22 SSH │ │ - Port 5432 (from EC2) │ │
│ │ - Port 5000 │ │ │ │
│ └─────────────────┘ └─────────────────────────────┘ │
└───────────────────────────────────────────────────────────────────┘
graph TB
A[Web Browser<br/>Bootstrap UI + JavaScript] --> B[Spring Boot Application<br/>Port 5000]
B --> C[PostgreSQL Database<br/>Amazon RDS Port 5432]
B --> D[Finnhub API<br/>Real-time Stock Data]
subgraph "Frontend Pages"
E[Stock Watchlist]
F[Trading Interface]
G[Portfolio View]
H[Transaction History]
I[Profit/Loss Analysis]
end
subgraph "Backend Services"
J[Stock Service]
K[Trading Service]
L[Portfolio Service]
M[Price Update Service]
N[Transaction Service]
end
subgraph "AWS Infrastructure"
O[EC2 Instance<br/>t3.micro]
P[RDS PostgreSQL<br/>Private Subnet]
Q[VPC Network]
R[Security Groups]
end
A --> E
A --> F
A --> G
A --> H
A --> I
B --> J
B --> K
B --> L
B --> M
B --> N
O --> B
P --> C
Q --> O
Q --> P
R --> O
R --> P
- Real-time stock price monitoring (30-second updates)
- Dynamic stock watchlist management
- Buy/sell stock transactions
- Portfolio tracking and management
- Transaction history and logging
- Automatic price updates via scheduled tasks
- RESTful API endpoints
- Database transaction logging
- Responsive web interface
- Memory-optimized deployment
GET /api/stocks- Get all stocksGET /api/stocks/{symbol}- Get specific stock (adds if not exists)DELETE /api/stocks/{symbol}- Remove stock from watchlistPOST /api/stocks/refresh- Manual price update
POST /api/trading/buy- Buy stocksPOST /api/trading/sell- Sell stocks
GET /transactions- View transaction historyGET /portfolio- View current portfolioGET /profit-loss- View profit/loss analysis
- stocks - Stock information and current prices
- transactions - All buy/sell transaction records
- portfolio - Current stock holdings
- account - User account and cash balance
- Java 17+
- Maven 3.6+
- AWS Account (EC2 + RDS)
- Finnhub API key
# Clone repository
git clone https://github.com/tungle2709/Stockify.git
cd Stockify
# Build application
mvn clean package
# Deploy to EC2 (with memory optimization)
java -Xmx256m -Xms128m -jar target/stock-trading-app-1.0.0.jarUpdate application.properties:
# Database Configuration
spring.datasource.url=jdbc:postgresql://your-rds-endpoint:5432/stockifydb
spring.datasource.username=your-username
spring.datasource.password=your-password
# API Configuration
finnhub.api.key=your-finnhub-api-key
finnhub.api.url=https://finnhub.io/api/v1- JVM memory limits:
-Xmx256m -Xms128m - Connection pooling with HikariCP
- Scheduled updates every 30 seconds
- SQL logging disabled in production
- Optimized for t3.micro EC2 instances
URL: http://44.198.177.164:5000/
/- Stock watchlist and search/trading- Buy/sell interface/portfolio- Portfolio overview/transactions- Transaction history/profit-loss- Performance analysis
- Fork the repository
- Create feature branch (
git checkout -b feature/new-feature) - Commit changes (
git commit -m 'Add new feature') - Push to branch (
git push origin feature/new-feature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Built with Spring Boot and deployed on AWS