Node.js
ActorCore is still pre-v1.0. Please help us by report bugs on GitHub Issues!
Create New Project
Create Project with CLI
Run this command:
Follow the prompts:
- Where would you like to create your project? - Choose your project directory
- To which platform would you like to deploy? - Select Node.js
- Which template would you like to use? - Select counter, or your template of choice
The CLI will set up your project and install all dependencies automatically.
Start Development Server
Start your development server with:
This will start your ActorCore server in development mode.
Test
In a separate terminal, run the auto-generated test client:
Run this again to see the state update.
Deploy
Request a guide for deploying Node.js to your preferred cloud provider on GitHub Discussions.
Integrate With Existing Projects
If you already have a Node.js project and want to add ActorCore, you can follow these steps for manual integration. This approach gives you more control over how ActorCore fits into your existing codebase.
Install Packages
Create Actor
Create a new file for your actor at src/app.ts
:
Create Entrypoint
Create src/index.ts
to start your ActorCore server with:
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.
Create Client
Create a client to connect to your actor in src/client.ts
:
Test
Start your development server with:
Then run the client in another terminal with:
Run this again to see the state update.
Available Regions
Node.js can only run in one region at the moment. See Rivet and Cloudflare Workers for supporting multiple regions.