Actors

The Dapr JavaScript SDK lets Node.js applications host virtual actors, call actors through proxies or by method name, manage actor state, and schedule timers and durable reminders.

These guides target @dapr/dapr 3.19.0 or later. Use a supported Node.js LTS release and a Dapr runtime that supports the APIs you use. The how-to guide uses HTTP actor hosting and a local Dapr environment.

Choose a guide

GuideLearn how to
Run and use virtual actorsCreate a contract, implement an actor, configure a state store, and run a host and client
Author and host actorsRegister types, use lifecycle hooks, and configure the actor runtime
Call actorsChoose actor identities, build proxies, invoke methods dynamically, and understand serialization
Manage actor stateRead, update, remove, cache, and explicitly save actor state
Use timers and remindersSchedule callbacks, retrieve and list reminders, and perform scoped or type-wide cleanup

Protocol and runtime support

The application protocol and the protocol used to call the sidecar are separate choices.

CapabilityHTTPgRPC
Host JavaScript actors with DaprServerSupportedNot implemented
Invoke actor methods through a proxy or the lower-level actor clientSupportedSupported
Read and transact actor state; register and unregister timers and individual remindersSupportedSupported
Retrieve an individual reminder with getActorReminderSupportedSupported
List reminders for one actor with listActorRemindersDapr 1.19+Dapr 1.17+
List reminders for every instance of an actor typeNot supportedDapr 1.17+
Delete reminders in bulk with unregisterActorRemindersByTypeNot supportedDapr 1.17+

A gRPC client can call actors hosted by an HTTP application. It does not require a gRPC actor host. JavaScript actor hosting does not implement the runtime’s app-initiated actor streams.

The SDK does not expose every feature of the runtime’s Actors API. For example, this SDK version has no high-level timer retrieval/listing methods or reminder overwrite and failurePolicy options. See the individual guides for serialization and reentrancy limitations.

Registering actors

Call await server.actor.init() and await server.actor.registerActor(YourActor) before await server.start(). Registration advertises an actor type; it does not create every actor instance. Dapr activates instances on demand.

See author and host actors for registration and configuration, or follow the complete example.