Deno
actor-ts works on Deno, but with caveats. Core actor APIs (Actor, ActorSystem, ActorRef, supervision, etc.) work identically. Subsystems with native dependencies are where support varies.
Status: best-effort
Section titled “Status: best-effort”| Subsystem | Status |
|---|---|
| Core actor API | ✓ Works |
| Cluster transport (TCP) | ✓ Works (via Deno.connect / Deno.listen) |
| Persistence — in-memory | ✓ |
| Persistence — SQLite | ✗ Not supported |
| Persistence — Cassandra | ⚠ Untested |
| HTTP — Fastify | ✓ Works |
| HTTP — Bun.serve | ✗ (Bun-only) |
WebSocket server (ServerWebSocketActor) | ⚠ Workaround needed |
| Broker actors (Kafka, MQTT, etc.) | ⚠ Depends on Deno-compat of underlying npm package |
For production, we recommend Bun or Node unless your organization is committed to Deno.
Installation
Section titled “Installation”curl -fsSL https://deno.land/install.sh | shdeno --version # need 2.0+Using actor-ts
Section titled “Using actor-ts”// deno.json{ "imports": { "actor-ts": "npm:actor-ts", "ts-pattern": "npm:ts-pattern" }}
// main.tsimport { ActorSystem } from 'actor-ts';
const system = ActorSystem.create('my-app');// ...Deno’s npm-compat lets you import actor-ts directly via npm:
specifiers.
What works out of the box
Section titled “What works out of the box”- Core actor model — Actor, ActorSystem, dispatchers, mailboxes, supervision.
- Cluster transport — Deno’s TCP APIs are wired up.
- In-memory persistence — works for tests + dev.
- DistributedData — pure-JS, works.
- Event stream, receptionist, sharding singleton — all work.
What needs workarounds
Section titled “What needs workarounds”SQLite
Section titled “SQLite”Not supported. Deno doesn’t have a built-in SQLite, and
neither bun:sqlite nor better-sqlite3 work natively.
Workarounds:
deno_sqlite(a Deno-native package) — implementJournalagainst it manually.- HTTP-backed journal — wrap a remote journal service.
- Use Cassandra instead — no SQLite needed for multi-node persistence.
WebSocket server
Section titled “WebSocket server”ServerWebSocketActor defaults to ws (Node) or Bun.serve.
For Deno, write a thin adapter using Deno.serveHttp +
Deno.upgradeWebSocket.
Permissions model
Section titled “Permissions model”Deno’s permission system requires explicit flags:
deno run \ --allow-net \ --allow-read \ --allow-write \ --allow-env \ main.tsFor most actor-ts apps:
--allow-net— cluster + HTTP traffic.--allow-read— config files, certs.--allow-write— for SQLite / file persistence (if using).--allow-env— for env vars.
For production, narrow to specific allowances:
deno run --allow-net=:2552,:8080 --allow-env=ACTOR_TS_* main.tsDeno Deploy
Section titled “Deno Deploy”Deno Deploy is Deno’s edge-style serverless platform. Short-lived isolates, no long-running process — doesn’t fit clustering.
For Deno Deploy use cases:
- Single-actor patterns — spawn one actor per request, then stop.
- Use actor-ts as a library for actor patterns within an HTTP handler, not as a clustering primitive.
Testing on Deno
Section titled “Testing on Deno”import { Deno } from 'deno';import { TestKit } from 'actor-ts/testkit';
Deno.test('counter increments', async () => { const tk = TestKit.create(); // ... await tk.shutdown();});Deno’s built-in test runner works with TestKit.
Migrating to Deno
Section titled “Migrating to Deno”If you’re considering moving from Node / Bun to Deno:
- Verify your peer deps work on Deno — most NPM packages
are usable via
npm:, but a few (especially those with complex native bindings) fail. - Replace SQLite if you use it — switch to in-memory (tests) or Cassandra (production).
- Replace
ServerWebSocketActorif used — write a Deno adapter or use SSE instead. - Test cluster formation thoroughly — Deno’s TCP backend has less production hours.
Where to next
Section titled “Where to next”- Runtime overview — the bigger picture.
- Bun — the recommended alternative.
- Node — the other alternative.
- Compatibility matrix — feature-by-feature support.