Blockchains communicate with the outside world through events. Events signal important state changes happening on-chain.
But today, applications typically learn about these changes through:
- complex indexing pipelines
- slow polling
- fragile websocket listeners
- manual filtering and SCALE decoding
- constant debugging and upkeep
It’s slow, tedious, and highly technical.
Triggr removes all of that.
Triggr is a reactive backend that listens for on-chain events and lets you declare simple triggers — instructions that run automatically whenever your smart contract emits an event. Your app receives updates instantly, with no polling, no indexers, and zero blockchain boilerplate.
As a Polkadot developer, you focus entirely on your business logic, not decoding bytes or running infrastructure.
-
Write your smart contract in ink! or Solidity.
Compile it to generate yourcontracts.jsonfile. -
Create a Triggr project, then upload your
contracts.json.
Triggr automatically extracts all contract events and displays them in the console. -
Write your triggers in the console.
These define what should happen in your storage whenever an event is emitted. -
Install the TypeScript SDK and subscribe to real-time updates in your dapp.
-
Enjoy fully reactive, event-driven programming — without managing nodes, websockets, indexing pipelines, or decoding logic.
Triggr is deployed and available online at https://triggr.cloud.
The entire platform is built in a monorepo with the following structure:
-
console/
Front-end code for the Triggr Console.
This UI connects to the Triggr node to:- create and manage projects
- upload contracts
- write and deploy triggers
- inspect storage
- manage events and state
-
examples/
A complete example dapp built entirely on Triggr.
Shows how to use events → triggers → frontend updates end-to-end. -
sdk/
The TypeScript SDK used by applications to:- subscribe to real-time collection changes
- query the Triggr backend
- react to contract events automatically
Published on NPM: https://www.npmjs.com/package/triggr-ts-sdk
-
ui/
Front-end code for the Triggr landing page and marketing website. -
triggr/
The core Triggr node, written in Rust.
Contains:- the webserver
- storage engine
- DSL parser + executor
- blockchain connector
- internal queue + event router
Triggr is built from four core components that work together seamlessly:
-
Webserver Module
Handles incoming HTTP/WebSocket requests from:- the console
- your dapps
- the SDK
It exposes APIs, triggers execution, and streams real-time updates.
-
Storage Module
A fast, embedded key-value store powered by Sled.
Used to store:- user data
- trigger outputs
- application state
- event logs (optional)
-
DSL Parser & Executor
Parses your trigger scripts and executes them whenever events occur.
This module is responsible for:- validating your DSL
- reading event fields
- performing
insert,update, anddeleteoperations - writing changes to storage
-
Chain Module
Connects to supported blockchains and:- listens for contract events
- fetches and decodes SCALE data
- serializes event fields into readable structures
- sends events to the DSL executor in real-time
Together, these components turn raw blockchain events into instant, structured updates for your application—without indexing, polling, or manual decoding.
- Rust i.e
scale-info,substrate-api-client,parity-scale-code,axum,sledetc. - React/Typescript for the UI.
- Contracts.json
- Clerk Auth (Dev) for console auth.
Triggr has a very small but expressive rule language used to define how your database should make state changes when events are emitted.
There are three core operations:
- INSERT – add new data to your database
- UPDATE – modify an existing record
- DELETE – remove a record
All comparisons between event parameters and constants are supported.
Below are triggers written to modify database state when events are emitted. The events are always exposed automatically in the console. This is made possible through the uploaded contacts.json file.
/* Events defined in your contract */
const events = [
ValueChanged { from, value, message }
FundsDeposited { amount }
EscrowPaused { fee }
]
fn main(events) {
/* No matter the event, insert the record */
insert @users:tx1 {
amount: events.ValueChanged.value,
message: events.ValueChanged.message,
status: "created"
}
}/* Events defined in your contract */
const events = [
ValueChanged { from, value, message }
]
fn main(events) {
if (events.ValueChanged.value > 200) {
update @users:tx10 {
amount: events.ValueChanges.value,
}
} else {
delete @users:tx9
}
}/* Events defined in your contract */
const events = [
ValueChanged { from, value, message }
]
fn main(events) {
if (events.ValueChanged.value > 200) {
delete @users:tx1
}
}Triggers watch out for events that match their condition and execute the rules that was set e.g deleting a record. Below are the four major patterns of writing triggers:
- Using a Conditional i.e reacting to events with a condition:
/* Events defined in your contract */
const events = [
NftMinted { total_supply, amount }
]
fn main(events) {
/* Execute trigger only when total_supply is greater than 2000 */
if (event.NftMinted.total_supply > 20000) {
update @collection:doc_id {
category: "high"
}
}
} - No Conditionals i.e simple triggers without conditions. These are executed any time any event is emitted from your contract:
/* Events defined in your contract */
const events = [
NftMinted { total_supply, amount }
]
fn main(events) {
/* Record NFT minting always */
insert @collection:doc_id {
total_supply: events.NftMinted.total_supply,
amount: events.NftMinted.amount
}
} - Dynamic ID i.e letting Triggr assign the ID automatically. This is done by leaving out the
document idafter the colon:. Triggr understands this and will generate aUUIDas the key for the record internally.
/* Events defined in your contract */
const events = [
NftMinted { total_supply, amount }
]
fn main(events) {
/* Record NFT minting always */
insert @collection: {
total_supply: events.NftMinted.total_supply,
amount: 49
}
} - Writing Event data directly into the database. Triggr is able to understand when real-time event data need to be stored. Here, it is important to make sure the event field is specified correctly as typographical errors would prevent the triggers from being fired:
/* Events defined in your contract */
const events = [
NftMinted { total_supply, amount }
]
fn main(events) {
/* Record NFT minting always */
insert @collection:doc_id {
total_supply: events.NftMinted.total_supply,
amount: events.NftMinted.amount
}
} - Every trigger must be written inside a
mainfunction. - Only one
mainfunction is allowed in each trigger file.
The Triggr SDK makes it easy for applications to send queries and react to real-time state changes originating from on-chain events.
It is available on NPM:
https://www.npmjs.com/package/triggr-ts-sdk
Documentation is here:
https://github.com/algorealmInc/Triggr/tree/main/sdk
The Demo showcases the power of Triggr.
A dummy contract emits events → triggers fire → database updates → front-end updates instantly.
Data Flow:
Contract Events → Triggers → Database Changes → Front-end Update
Here’s how it works:
-
Define the Contract
The ink! contract emits events whenever the internal storage changes.
View the contract here:
https://github.com/algorealmInc/Triggr/blob/main/examples/demo/contract/lib.rs -
Deploy the Contract
The demo contract is deployed on PassetHub:
0x25b322C78C16E0A20DCebECAAef82A0a2976624b
You can call it live using the Contracts UI:
https://ui.use.ink/contract/0x25b322C78C16E0A20DCebECAAef82A0a2976624b -
Create a Project on Triggr
Upload the generatedcontracts.jsonfile.
Triggr extracts events automatically and displays them in the console.
-
Write Your Triggers
Events from the contract appear automatically in the console.
Here is a trigger that writes to the database wheneverValueChangedis emitted:
/* Events defined in your contract */ const events = [ ValueChanged { from, value, message } ] fn main(events) { /* Insert into the transactions collection and generate ID */ insert @transactions: with { from: events.ValueChanged.from, value: events.ValueChanged.value, message: events.ValueChanged.message } }
-
Emit Events
Go to the Contracts UI and call the increment function.
This action emits the ValueChanged event.
(Ensure your account has sufficient PAS balance.)
- Database Updates Automatically
Once the event is emitted, your deployed trigger executes immediately, and the Triggr database updates in real time.
- Done!
Your on-chain event updated the database, and the Triggr SDK pushed the new data to your front-end instantly.
No indexing. No polling. No delays. No complexity.
It’s that simple — and it feels like magic. ✨
- Build reactive applications without any polling
- Drastically simplify backend logic
- Automatically sync blockchain events into your database
- Real-time UI updates out of the box
- Works seamlessly with Substrate, Polkadot, and modern dApps
- Fast, predictable rule execution
- Built for developers who want power without complexity
-
Perfect SCALE decoding
We will refine our event decoding so every contract event can be parsed reliably with zero errors. -
Decentralize Triggr nodes
Currently, Triggr runs on a single node. We will make it decentralized and synchronize nodes using SwarmNL. -
Support more chains
Triggr will become more generic and support additional ecosystems such as Ethereum. -
More powerful triggers
We will introduce richer integrations (e.g., Telegram), front-end modification hooks, and more expressive trigger logic.
Triggr is a powerful platform that accelerates and simplifies Web3 development.
You can now build real-time applications effortlessly and focus entirely on your business logic and smart contracts.
Web3 developers can finally have nice things 😊.
Copyright (c) 2025 Algorealm, Inc.



