Streams (Syncs)
This guide will teach you how to set up streams for your self-hosted Moralis Server
Using Streams, you can listen to real-time on-chain events and automatically synchronize incoming data with your database.
Streams is what you need to replace the old Moralis-hosted Syncs:
Configuration
Open src/index.ts
and make sure that streamsSync
method gets config.STREAMS_WEBHOOK_URL
as a webhookUrl
parameter:
You can modify this parameter in your .env
file by setting STREAMS_WEBHOOK_URL
to a different string
value. By default it's:
If you want to modify the ability to listen to Streams you can do so on your .env
file by setting USE_STREAMS
to true
or false
.
Build and run
We need to build and run the project to get the full Streams Webhook URL that we'll use later.
Build the project:
And then run it locally:
After starting your server you shoud see a similar message on your terminal. The message will contain the Streams Webhook URL (powered by ngrok) you will use to create a Stream:
Create a Stream
To create a Stream, head over to the following guide or follow our YouTube tutorial from minute 7:05.
You will need to provide the Streams Webhook URL you got in the previous step:
Last updated