Node.js repository for Whisper Chain REST APIs and cron processes.
We use OpenAPI specifications to standardize our API documentation. To generate the documentation, use the following command:
> npm run generate-openapi-docs
You can view the user-friendly UI of the specs by visiting <domain>/api-docs
in your browser.
We use DBML to document the MySQL tables in our project. You can find the DB schema documentation in the docs/dbSchema.dbml
file.
To view the schema diagram in a user-friendly graphical format, use the online editor.
To provide an easy-to-understand overview of the different steps involved in various flows, we've created a number of sequence diagrams.
You can find these diagrams in the docs/sequenceDiagrams
folder.
Before you can start the server, please make sure that you have the following prerequisites installed:
You will also need to set the correct values for the environment variables mentioned in the ./env_vars.sample
file.
To start the server, please follow the steps below:
- Install the required NPM dependencies by running the following commands:
rm -rf node_modules
rm -rf package-lock.json
npm install
- Create the main db and create schema_migrations table using the following command:
source set_env_vars.sh
node db/seed.js
- Run all pending migrations by running the following commands:
source set_env_vars.sh
node db/migrate.js
- Start the server by running the following commands:
source set_env_vars.sh
npm start
TODO
We have created a telegram bot to maintain a reserve of images for future lens profile posts. This ensures that we always have a set of images ready to go. These images will be posted one by one each day to lens through a cron job.
- Create a bot on the Telegram platform.
- Set the following environment variables:
- TELEGRAM_BOT_TOKEN - Bot token
- WHITELISTED_USER_IDS - An array of telegram user IDs of admin users.
- Set up a continuous cron job using the following command:
node lib/cron/seedImage.js
To use the telegram bot, please follow the steps below:
- Go to the bot page on Telegram.
- Upload the photo that you would like to add to the reserve.
That's it! The image will be added to the reserve and will be available for future posts.