Skip to content

Installation

actor-ts ships as a single npm package. The core has two small runtime dependencies (ts-pattern for exhaustive matching, fastify for the default HTTP backend); everything else — Kafka, Redis, S3, Cassandra, gRPC — is opt-in via peer dependencies you only install when you use the corresponding extension.

RuntimeMinimum versionNotes
Bun1.1Recommended for development — fastest startup, native SQLite via bun:sqlite, native WebSocket server.
Node.js20.0Core works on 20+. Node 22+ enables native WebSocket without the ws peer dep; Node 22.15+ enables native zstd compression without fzstd. SQLite via better-sqlite3 (peer-dep).
Deno2.0Use the npm: specifier — import { ... } from 'npm:actor-ts'. Run with --allow-net / --allow-read as needed.

The framework auto-detects which runtime it’s executing under and picks the right backends transparently — see Runtime overview for the detection algorithm and per-runtime caveats.

Terminal window
bun add actor-ts

Each integration is gated by a peer dep — install only the ones you’ll actually use. Nothing is auto-loaded; the relevant extension throws a clear “missing peer dep” error if you try to use it without the package installed.

PackageEnables
fastify (default)Fastify-based HttpServerBackend — best Bun + Node performance.
expressExpress-based backend, for projects already on Express.
hono + @hono/node-server (Node only)Hono with runtime-aware serve primitives — Bun.serve, @hono/node-server, Deno.serve per runtime.
Terminal window
bun add fastify # or
bun add express # or
bun add hono @hono/node-server # @hono/node-server is Node-only
PackageEnables
better-sqlite3 (Node only)SQLite journal + snapshot store on Node. Bun uses bun:sqlite (built-in, no peer dep).
cassandra-driverCassandra / ScyllaDB journal + tag-index.
@aws-sdk/client-s3S3-compatible object-storage backend (works with MinIO, R2, Backblaze B2).
fzstd (optional)zstd compression for object-storage blobs when no native runtime support is available.
PackageEnables
ioredisRedis-backed Cache.
memjsMemcached-backed Cache.
PackageEnables
kafkajsKafkaActor — producer + consumer.
mqttMqttActor.
amqplibAmqpActor — RabbitMQ + AMQP-compatible brokers.
natsNatsActor — including JetStream subjects.
@grpc/grpc-js + @grpc/proto-loaderGrpcClientActor + GrpcServerActor.
wsWebSocketActor (outbound client connections).
PackageEnables
@kubernetes/client-nodeKubernetesApiSeedProvider + KubernetesLease.

Add (or verify) the following compiler options in your tsconfig.json:

{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"noImplicitOverride": true,
"exactOptionalPropertyTypes": true,
"skipLibCheck": true
}
}

The framework relies on noImplicitOverride to catch lifecycle-method- typo bugs (writing onRecieve instead of onReceive). Drop it if you prefer, but you’ll lose that safety net.

Save this as verify.ts:

import { Actor, ActorSystem, Props } from 'actor-ts';
class Ping extends Actor<'ping'> {
override onReceive(msg: 'ping'): void {
console.log('pong');
}
}
const system = ActorSystem.create('verify');
const ref = system.actorOf(Props.create(() => new Ping()));
ref.tell('ping');
await new Promise((r) => setTimeout(r, 20));
await system.terminate();
console.log('install OK');
Terminal window
bun run verify.ts

Expected output:

pong
install OK

If you see both lines, the install is working. If pong is missing, your runtime is below the minimum version (see the table at the top of this page) — bump it and re-run.

  • Quickstart — five minutes to a running actor.
  • Why actors? — the philosophy behind the framework.
  • Learning path — suggested reading order based on what you want to build.