Skip to main content

Dapr event bridge

PURISTA provides the @purista/dapr-sdk package, which includes an event bridge to use the Dapropen in new window features.

You should be familiar with the core concepts of Dapropen in new window.
There are also some more information available at the chapter Deployment - Dapr.

The Dapr event bridge contains two basic things.
There is an HTTP server, which provides endpoints for invoking commands and receiving events.
The second part of the Dapr event bridge is an HTTP client, which allows to send events, invoke functions.


To prevent timing issues, you need to follow a order, which is not the regular order in PURISTA:

  • create a Dapr event bridge instance (not started!)
  • create a instance of your service (only one service per instance is possible)
  • start your service
  • start the Dapr event bridge instance.

This is necessary, because the Dapr sidecar will call HTTP endpoints of your container at some unknown time.
These endpoints must return the finial configuration.
Because of the internal flexible and asynchronous structure within PURISTA, the Dapr event bridge webserver will never know, if all commands and subscriptions are added at the time of some endpoint invocation.


The Dapr event bridge HTTP server is based on the awesome Honoopen in new window framework.
This small, simple, and ultrafast web framework provides the ability, to profit from the benefits of your runtime.
You can use regular Node.jsopen in new window or Bunopen in new window or Denoopen in new window.

Node.js package required

If you use Node.js as runtime, you need to install the additional package @hono/node-server with version 1.0.0 or higher!

// package required for node adapter
import { serve } from '@hono/node-server'

import { gracefulShutdown } from '@purista/core'
import { DaprEventBridge } from '@purista/dapr-sdk'

import { userV1Service } from '../../src/service/user/v1/userV1Service'

const main = async () => {

  // create a Dapr event bridge instance
  const eventBridge = new DaprEventBridge({

  // create your service instance
  const userService = userV1Service.getInstance(eventBridge)
  // start your service instance
  await userService.start()

  // start the Dapr event bridge instance
  await eventBridge.start()

  gracefulShutdown(logger, [
    // begin with the event bridge to no longer accept incoming messages




PURISTA is using the HTTP header to add the OpenTelemetry information to each message, as recommended: in new window.

You can follow updated on Twitter @purista_jsopen in new window or join the Discord serveropen in new window to get in touch with PURISTA maintainers and other developers.

Last update:
Contributors: Sebastian Wessel