The Memory Driver is a simple in-memory implementation designed for development and testing environments. It stores all actor state in memory, which means data is not persisted between application restarts.

You rarely need to manually configure drivers. The platform package you’re using will configure the appropriate drivers for you. See the documentation for your platform for details.

The Memory Driver is not recommended for production environments as it doesn’t provide persistence or distributed capabilities.

Compatibility

PlatformsTopologies
Node.js Standalone
Bun Partition
Cloudflare Workers Coordinate
Rivet

Installation

1

Install the required packages:

npm install @actor-core/memory @actor-core/nodejs
2

Create a simple server using the Memory driver:

src/index.ts
import { serve } from "@actor-core/nodejs"
import { MemoryManagerDriver } from "@actor-core/memory/manager";
import { MemoryActorDriver } from "@actor-core/memory/actor";

serve(app, {
  topology: "standalone",
  drivers: {
    manager: new MemoryManagerDriver(),
    actor: new MemoryActorDriver(),
  },
});
3

Start your server:

npm run dev

Limitations

The Memory driver has several limitations to be aware of:

  • No Persistence: All data is stored in memory and lost when the application restarts
  • Single Process: Only works within a single process - not suitable for distributed environments
  • Scalability: Cannot scale beyond a single instance
  • Coordination: Limited support for coordinated topology, as actors can only communicate within the same process

For production environments or applications requiring persistence and distributed capabilities, consider using the Rivet or Cloudflare Workers instead.