BitAlert Server is the serverside code for BitAlert client side located in this repo. and the direct link for the app is here!.
There are 5 cron jobs that run constantly.
- Get the current market price from BitStamp and push it to the database (every minute)
- Clear the price collection in the database at midnight
- Flag alerts that are over 24 hours old to be marked for deletion (every minute)
- Compares alerts with the current market price, alerts that are triggered are sent an sms message and are then marked for deletion (every minute)
- Remove alerts that are flagged for deletion at midnight
Cron Jobs are run locally on a rasberry pi server to save costs on server space.
The sms api used in this application is Twilio.
There are 4 routes that are stored in seperate router files.
router.get(/api/alerts)
Gets alerts from the db by phonenumberrouter.post(/api/alerts)
Adds an alert from the dbrouter.delete(/api/alerts)
Removes an alert from the db by idrouter.get(/api/price)
Gets the market price from the db