🚀 A comprehensive cryptocurrency price tracking and investment analysis API built with Spring Boot and Java
This is the Spring Boot version of the CryptoDash API - a modern, reactive web application that provides real-time cryptocurrency prices, investment analysis, and portfolio calculations. This version replicates all functionality from the original Node.js implementation while leveraging Spring Boot's robust ecosystem.
- 📈 Real-time Crypto Prices: Live cryptocurrency price data from CoinGecko API
- 📊 7-Day Price History: Comprehensive price trend analysis and visualization
- 💰 Portfolio Calculator: Calculate potential returns on cryptocurrency investments
- 🎯 Best Buy Analysis: AI-powered recommendations for optimal buying opportunities
- 🎨 Modern UI: Beautiful purple gradient interface with responsive design
- ⚡ Reactive Programming: Built with Spring WebFlux for high-performance async operations
- 🔄 RESTful API: Clean, well-documented API endpoints
- Backend: Spring Boot 3.1.0, Spring WebFlux
- Language: Java 21
- Build Tool: Maven
- HTTP Client: WebClient (reactive)
- API Integration: CoinGecko API v3
- Frontend: Vanilla HTML5, CSS3, JavaScript
- Architecture: MVC pattern with reactive programming
src/
├── main/
│ ├── java/com/cryptodash/cryptoapi/
│ │ ├── CryptoApiApplication.java # Main application class
│ │ ├── controller/
│ │ │ └── CryptoController.java # REST API endpoints
│ │ ├── service/
│ │ │ └── CryptoService.java # Business logic layer
│ │ └── model/
│ │ ├── CryptoInfoResponse.java # Response model
│ │ ├── PriceHistory.java # Price history model
│ │ └── PricePoint.java # Individual price point
│ └── resources/
│ ├── static/
│ │ └── index.html # Frontend UI
│ └── application.properties # Configuration
├── target/ # Compiled files (ignored)
└── pom.xml # Maven dependencies
- Java 21 or higher
- Maven 3.6+
- Git
-
Clone the repository
git clone https://github.com/Ezn605/SpringBoot-CryptoAPI.git cd SpringBoot-CryptoAPI -
Build the project
mvn clean compile
-
Run the application
mvn spring-boot:run
-
Access the application
- Open your browser and navigate to:
http://localhost:8080 - The CryptoDash interface will load automatically
- Open your browser and navigate to:
GET /crypto-info?coin={coinId}&portfolio={amount}Parameters:
coin(required): Cryptocurrency ID (e.g., "bitcoin", "ethereum", "cardano")portfolio(optional): Investment amount in USD for portfolio calculations
Response:
{
"coin": "bitcoin",
"currentPrice": 115840.82,
"priceChange7d": 2.5,
"priceHistory": {
"labels": ["Day 1", "Day 2", ...],
"prices": [115000, 115500, ...]
},
"portfolioValue": 1158.41,
"portfolioGain": 25.00,
"investmentTip": "Strong bullish momentum detected..."
}- Cryptocurrency Selection: Dropdown with popular cryptocurrencies
- Live Price Display: Real-time price updates with 7-day change percentage
- Interactive Charts: Visual price history representation
- Portfolio Calculator: Input investment amount for return calculations
- Investment Insights: AI-generated buy/sell recommendations
- Responsive Design: Works seamlessly on desktop and mobile devices
The application can be configured via application.properties:
# Server configuration
server.port=8080
# Logging configuration
logging.level.com.cryptodash=DEBUG
logging.level.org.springframework.web.reactive=DEBUG
# External API configuration
coingecko.api.base-url=https://api.coingecko.com/api/v3This application uses Spring WebFlux for non-blocking, reactive programming:
- WebClient: For asynchronous HTTP calls to CoinGecko API
- Mono/Flux: Reactive types for handling asynchronous data streams
- Async Controllers: Non-blocking request handling
- Controller Layer: Handles HTTP requests and responses
- Service Layer: Contains business logic and external API integration
- Model Layer: Data transfer objects and domain models
Run the test suite:
mvn testCreate a production-ready JAR:
mvn clean package
java -jar target/crypto-api-0.0.1-SNAPSHOT.jar- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- CoinGecko API for providing free cryptocurrency data
- Spring Boot for the excellent framework
- Maven for dependency management
If you encounter any issues or have questions, please open an issue on GitHub.
⭐ Star this repository if you found it helpful!