This application allows users to set price alerts for cryptocurrencies and receive notifications when the target price is reached.
- Clone the repository
- If you're on Windows, you need to install and run Docker Desktop
- Run
docker-compose up --build
- The application will be available at
http://localhost:8080
URL: /users/signup
Method: POST
Request Body:
{
"email": "[email protected]",
"password": "pass1"
}
URL: /users/login
Method: POST
Request Body:
{
"email": "[email protected]",
"password": "pass1"
}
Response: JWT token
URL: /alerts/create
Method: POST
Authorization: JWT token as bearer token
Request Body:
{
"coin": "BTC",
"target_price": 35000.0
}
URL: /alerts/delete/:id
Method: DELETE
Authorization: JWT token as bearer token
URL: /alerts
Status filter query in URL(optional)
Method: GET
Authorization: JWT token as bearer token,
The application uses Binance's WebSocket connection to get real-time price updates. We establish a connection and continuously read the messages regarding price updates from the connection using an infinite loop. If there is any untriggered Alert for a specific coin, then the Alert's target price is compared with the coin's current price. When a target price is reached for an untriggered alert, the alert status is updated in the database, and a notification is printed to the console (in a production environment, this would send an email to the user).
The "fetch all alerts" endpoint uses Redis to cache results. The cache memory is updated every time a new Alert is created, deleted or triggered
Demo video Discord id: 763377449789685760