Node.js
Node.js provides a robust environment for running ActorCore, ideal for development and production deployments.
ActorCore is still pre-v1.0. Please help us by report bugs on GitHub Issues!
Deploy
Start with framework
Start with your framework of choice:
Install dependencies
Install the Node.js platform package:
Define your server
Create a file src/index.ts
to start your ActorCore server:
Deploy to production
Compile your TypeScript code and run the server:
Deploy to any cloud provider of your choice.
Update your client's endpoint
Update your client to connect to your deployed app:
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 Node.js uses the file-system driver, which persists state between restarts.
For simple deployments, you can switch between drivers with:
For production, consider using an alternative driver like Redis.
Available Regions
Node.js 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