Bun provides a fast runtime environment for running ActorCore, with excellent performance for both development and production.

ActorCore is still pre-v1.0. Please help us by report bugs on GitHub Issues!

Deploy

1

Start with framework

Start with your framework of choice:

2

Install dependencies

Install the Bun platform package:

bun add @actor-core/bun
3

Define your server

Create a file src/index.ts to start your ActorCore server:

src/index.ts
import { serve } from "@actor-core/bun";
import { app } from "../actors/app";

// Start the server with file-system driver (default)
serve(app);
4

Deploy to production

Build and run your production server:

bun build ./src/index.ts --outdir ./dist
bun ./dist/index.js

Deploy to any cloud provider of your choice.

5

Update your client's endpoint

Update your client to connect to your deployed app:

const client = createClient<App>(/* FILL ME IN */);

CORS Configuration

For security reasons, you should configure proper CORS settings in production. In the example above, we used cors: { origin: "*" } which allows requests from any domain.

For production deployments, specify the exact domains that should be allowed to connect to your actors. Learn more in the CORS documentation.

Integration with Existing Projects

If you already have an existing application and want to mount ActorCore on a subpath, see our Hono integration guide. Remember to specify the same path in config.basePath as where you mount the router.

Using Different Drivers

By default, ActorCore for Bun uses the file-system driver, which persists state between restarts.

For simple deployments, you can switch between drivers with:

serve(app, {
  mode: "in-memory",  // Switch to in-memory (file-system is default)
});

For production, consider using an alternative driver like Redis.

Available Regions

Bun typically runs in a single region at a time. For multi-region deployments, consider:

  • Rivet - Managed cloud service with global deployment
  • Cloudflare Workers - Edge computing with global distribution

Next Steps