A backend application that helps users manage and monitor their cryptocurrency investments. Users can track their coin holdings, view real-time prices, calculate profit/loss, and set up price alerts.
To build a secure and user-friendly backend system where individuals can:
- Add, edit, and delete cryptocurrency holdings
- Track real-time prices using third-party APIs (e.g., CoinGecko)
- View profit/loss calculations for individual coins and total portfolio
- Get alerts when coins hit specific price thresholds
Purpose: Protect user data and allow secure access.
Functionalities:
- β Register and Login functionality
- β Basic authentication using session_token
- β Each user sees only their holdings
What Youβll Learn:
- How Spring Security works
- Securing API routes using roles
- Session management and validation
Purpose: Allow users to record and manage their crypto investments.
Functionalities:
- Add new holdings:
- Coin Symbol (e.g., BTC)
- Quantity (how much they own)
- Buy Price (price when bought)
- Edit and Delete entries
- View current portfolio
What Youβll Learn:
- Building CRUD APIs with Spring Boot
- Using JPA for database operations
- Filtering user-specific data
Purpose: Keep prices up to date using real market data.
Functionalities:
- Integrate with CoinGecko or similar public APIs
- Fetch latest prices every 5β10 minutes using
@Scheduled - Store prices in a local database or in-memory
What Youβll Learn:
- Making REST API calls with
RestTemplate - Using
@Scheduledto run background tasks - Parsing and mapping JSON to Java objects using Jackson
- Database design for price history
Purpose: Show how each holding is performing.
Functionalities:
- For each coin, calculate:
- gain = (currentPrice - buyPrice) * quantity
- percentageChange = (gain / (buyPrice * quantity)) * 100
- Show total portfolio profit/loss
What Youβll Learn:
- Writing business logic in service layers
- Performing math operations in Java
- Sending calculated results via REST APIs
Purpose: Notify users when their coin hits a target price.
Functionalities:
- Users can set a price alert (e.g., ETH > $3,000)
- The system checks prices on each cron job
- If the condition is met:
- Mark the alert as βTriggeredβ
- Optionally log it or send an email
What Youβll Learn:
- Writing condition-based business logic
- Storing and updating alert status
- Optional: Logging or sending notifications
| Layer | Technology |
|---|---|
| Language | Java |
| Framework | Spring Boot, Spring Data JPA |
| Security | Spring Security, Basic authentication using session_token |
| Scheduler | Spring Scheduler (@Scheduled) |
| REST Client | RestTemplate / WebClient |
| JSON Parser | Jackson |
| Database | MySQL |
| Build Tool | Maven |
- POST
/api/auth/registerβ Register a new user - POST
/api/auth/loginβ Login and receive token - PUT
/api/users/updateUser/{id}β Update user details - GET
/api/users/getUser/{id}β Get user details by ID - GET
/api/users/getIdβ Get currently logged-in user's ID
- GET
/api/holdings/addβ Add a new cryptocurrency holding - POST
/api/holdings/getHoldingsβ Get current user's holdings - PUT
/api/holdings/getMyNetValueβ Get total portfolio value for current user
- POST
/api/alert/createβ Create a new price alert - GET
/api/alert/user/{userid}β List all alerts - GET
/api/alerts/user/{userid}/triggeredβ List all triggered alerts - PUT
/api/alert/{id}β Update a price alert - PUT
/api/alert/{id}/disableβ Disable a specific alert - DELETE
/api/alert/{id}β Delete a price alert
- POST
/api/admin/loginβ Login as admin - GET
/api/admin/usersβ View all users - GET
/api/admin/user/{id}β Get user details by ID (admin access)
- GET
/api/crypto/getPrice/{symbol}β Get current price of a crypto by symbol - GET
/api/crypto/getAllCryptosβ Get list of all supported cryptocurrencies
This diagram represents a stock portfolio management system with layers:
Controllers, DTO, Enum, Model, Repository, Services, and Entities.
It includes user authentication, alert generation, portfolio creation, and gain/loss calculation.
Entities like User, PriceAlert, Alert, Holding, and Log manage data and behavior.
Services like PriceService, AlertService, AlertSchedulerService, AdminService, CryptoService, CustomUserDetailsService, EmailService, HoldingService, NotificationService, and UserService provide business logic.
This ER diagram models Users, Admins, Holdings, and Logs with relationships among them.
- A User can have multiple Holdings and can generate multiple Logs when transactions occur.
- Holdings store data about the cryptocurrencies owned, such as coin name, quantity, buy price, and price alerts.
- Logs record detailed transaction history including buy/sell prices and dates.
- An Admin can review logs but does not directly manage holdings or users.
This database diagram models the core components of a Crypto Portfolio Tracker application, including users, holdings, transaction logs, and external coin data.
It consists of four main tables: users, holdings, logs, and coin_API.
| Area | What Youβll Learn |
|---|---|
| Spring Boot APIs | Build and secure backend routes |
| Security | Basic authentication login using session_token and access control |
| Scheduling | Automate background tasks like price fetcher |
| API Integration | Call real-world APIs using Java |
| JSON Handling | Deserialize API responses with Jackson |
| Logic & Math | Calculate gains, losses, and percentages |
| Alerts | Apply business rules (if-else, comparisons) |
com.example.CryptoPortfolioTracker
βββ config
β βββ SecurityConfig.java
βββ controller
β βββ AdminController.java
β βββ AlertController.java
β βββ CryptoController.java
β βββ HoldingController.java
β βββ UserController.java
βββ dto
β βββ AddHoldingRequest.java
β βββ AlertRequestDTO.java
β βββ SimpleUserResponse.java
β βββ CryptoData.java
β βββ LoginRequest.java
β βββ HoldingDTO.java
β βββ RegisterRequest.java
βββ entity
β βββ Alert.java
β βββ Holding.java
β βββ Log.java
β βββ User.java
βββ enums
β βββ AlertDirection.java
β βββ AlertStatus.java
β βββ Role.java
βββ exception
β βββ GlobalExceptionHandler.java
β βββ ResourceNotFoundException.java
βββ model
β βββ ApiResponse.java
βββ repository
β βββ AlertRepository.java
β βββ HoldingRepository.java
β βββ LogRepository.java
β βββ UserRepository.java
βββ service
β βββ AdminService.java
β βββ AlertSchedulerService.java
β βββ AlertService.java
β βββ CryptoService.java
β βββ EmailService.java
β βββ HoldingService.java
β βββ NotificationService.java
β βββ PriceService.java
β βββ UserService.java
βββ CryptoPortfolioTrackerApplication.java
βββ README.md
- Java 17+
- Maven
- MySQL
- Postman (for testing APIs)
-
Clone the project:
git clone https://github.com/your-username/CryptoPortfolioTracker.git cd CryptoPortfolioTracker -
Create a database: CREATE DATABASE CryptoPortfolioTracker;
-
Configure application.properties: spring.application.name=CryptoPortfolioTracker spring.datasource.url=jdbc:mysql://10.9.124.199:3306/CryptoPortfolioTracker?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true spring.datasource.username=root spring.datasource.password=password spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
spring.mail.host=smtp-relay.brevo.com spring.mail.port=587 spring.mail.username=[email protected] spring.mail.password=h1nr2WQwZysT5zVg spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true
-
Build and run: ./mvnw clean install ./mvnw spring-boot:run
-
Test using Swagger or Postman.
| Feature | Benefit |
|---|---|
| Graphical reports (charts) | Easier to visualize performance |
| Export portfolio to PDF/Excel | For offline record-keeping |
| Mobile app integration | Future frontend possibilities |
| WebSocket price updates | Live price tracking |
| Name | Role |
|---|---|
| Praveen | Project Lead, User Module, GlobalExceptionHandling Module, Basic authentication using session_token & Scheduler Logic |
| Aayushi | Alert module |
| Kaushik, Harshnie | Price Fetcher, Gain Calculator |
| Navya | Fetch API Module |
| Lakshmi Bhanu | Admin Module and Junit testing |


