website/src/content/docs/general/edge.mdx
By default, actors will choose the nearest region based on the client's location.
Under the hood, Rivet and Cloudflare use Anycast routing to automatically find the best location for the client to connect to without relying on a slow manual pinging process.
The region an actor is created in can be overridden using region options:
import { createClient } from "rivetkit/client";
import { actor, setup } from "rivetkit";
const example = actor({ state: {}, actions: {} });
const registry = setup({ use: { example } });
const client = createClient<typeof registry>("http://localhost:6420");
// Create actor in a specific region using getOrCreate
const actorHandle = client.example.getOrCreate(["my-actor"], {
createInRegion: "atl"
});
See Create Manage Actors for more information.