Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Always include a README.md for new packages. The `README.md` should always follo
```md
# RivetKit {subname, e.g. library: Rivet Actor, driver and platform: RivetKit Cloudflare Workers Adapter}

_Lightweight Libraries for Backends_
_Library to build and scale stateful workloads_

[Learn More →](https://github.com/rivet-gg/rivetkit)

Expand Down
2 changes: 1 addition & 1 deletion packages/cloudflare-workers/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RivetKit Cloudflare Workers Adapter

_Lightweight Libraries for Backends_
_Library to build and scale stateful workloads_

[Learn More →](https://github.com/rivet-gg/rivetkit)

Expand Down
1 change: 1 addition & 0 deletions packages/cloudflare-workers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@rivetkit/cloudflare-workers",
"version": "2.0.3",
"description": "Cloudflare Workers adapter for RivetKit actors",
"keywords": [
"rivetkit",
"cloudflare",
Expand Down
8 changes: 8 additions & 0 deletions packages/cloudflare-workers/src/manager-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
HEADER_CONN_PARAMS,
HEADER_ENCODING,
HEADER_EXPOSE_INTERNAL_ERROR,
type ManagerDisplayInformation,
type ManagerDriver,
} from "rivetkit/driver-helpers";
import { ActorAlreadyExists, InternalError } from "rivetkit/errors";
Expand Down Expand Up @@ -345,4 +346,11 @@ export class CloudflareActorsManagerDriver implements ManagerDriver {
key: actorData.key,
};
}

displayInformation(): ManagerDisplayInformation {
return {
name: "Cloudflare Workers",
properties: {},
};
}
}
11 changes: 11 additions & 0 deletions packages/db/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RivetKit Database

_Lightweight Libraries for Backends_

[Learn More →](https://github.com/rivet-gg/rivetkit)

[Discord](https://rivet.gg/discord) — [Documentation](https://rivetkit.org) — [Issues](https://github.com/rivet-gg/rivetkit/issues)

## License

Apache 2.0
1 change: 1 addition & 0 deletions packages/db/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@rivetkit/db",
"version": "2.0.3",
"description": "Database providers and adapters for RivetKit actors",
"license": "Apache-2.0",
"sideEffects": false,
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/framework-base/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RivetKit Framework Base

_Lightweight Libraries for Backends_
_Library to build and scale stateful workloads_

[Learn More →](https://github.com/rivet-gg/rivetkit)

Expand Down
1 change: 1 addition & 0 deletions packages/framework-base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@rivetkit/framework-base",
"version": "2.0.3",
"description": "Base framework utilities for RivetKit client integrations",
"license": "Apache-2.0",
"keywords": [
"rivetkit",
Expand Down
1 change: 1 addition & 0 deletions packages/next-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@rivetkit/next-js",
"version": "2.0.3",
"description": "Next.js integration for RivetKit actors and client",
"license": "Apache-2.0",
"keywords": [
"rivetkit",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RivetKit React

_Lightweight Libraries for Backends_
_Library to build and scale stateful workloads_

[Learn More →](https://github.com/rivet-gg/rivetkit)

Expand Down
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@rivetkit/react",
"version": "2.0.3",
"description": "React hooks and components for RivetKit client applications",
"license": "Apache-2.0",
"keywords": [
"rivetkit",
Expand Down
11 changes: 11 additions & 0 deletions packages/rivetkit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RivetKit

_Library to build and scale stateful workloads_

[Learn More →](https://github.com/rivet-gg/rivetkit)

[Discord](https://rivet.gg/discord) — [Documentation](https://rivetkit.org) — [Issues](https://github.com/rivet-gg/rivetkit/issues)

## License

Apache 2.0
4 changes: 2 additions & 2 deletions packages/rivetkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "rivetkit",
"version": "2.0.3",
"description": "Lightweight libraries for building stateful actors on edge platforms",
"license": "Apache-2.0",
"keywords": [
"rivetkit",
Expand Down Expand Up @@ -148,7 +149,6 @@
},
"sideEffects": false,
"scripts": {
"dev": "pnpm build --watch",
"build": "tsup src/mod.ts src/client/mod.ts src/common/log.ts src/common/websocket.ts src/actor/errors.ts src/topologies/coordinate/mod.ts src/topologies/partition/mod.ts src/utils.ts src/driver-helpers/mod.ts src/driver-test-suite/mod.ts src/test/mod.ts src/inspector/mod.ts",
"build:schema": "./scripts/compile-bare.ts compile schemas/client-protocol/v1.bare -o dist/schemas/client-protocol/v1.ts && ./scripts/compile-bare.ts compile schemas/file-system-driver/v1.bare -o dist/schemas/file-system-driver/v1.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v1.bare -o dist/schemas/actor-persist/v1.ts",
"check-types": "tsc --noEmit",
Expand All @@ -160,7 +160,7 @@
"@bare-ts/lib": "~0.3.0",
"@hono/standard-validator": "^0.1.3",
"@hono/zod-openapi": "^0.19.10",
"@rivetkit/engine-runner": "https://pkg.pr.new/rivet-gg/engine/@rivetkit/engine-runner@664a377",
"@rivetkit/engine-runner": "https://pkg.pr.new/rivet-gg/engine/@rivetkit/engine-runner@eed1afb",
"@rivetkit/fast-json-patch": "^3.1.2",
"cbor-x": "^1.6.0",
"hono": "^4.7.0",
Expand Down
1 change: 1 addition & 0 deletions packages/rivetkit/scripts/dump-openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function main() {
openWebSocket: unimplemented,
proxyRequest: unimplemented,
proxyWebSocket: unimplemented,
displayInformation: unimplemented,
};

const { openapi } = createManagerRouter(
Expand Down
1 change: 1 addition & 0 deletions packages/rivetkit/src/driver-helpers/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type {
GetForIdInput,
GetOrCreateWithKeyInput,
GetWithKeyInput,
ManagerDisplayInformation,
ManagerDriver,
} from "@/manager/driver";
export { DriverConfigSchema, RunConfigSchema } from "@/registry/run-config";
Expand Down
2 changes: 2 additions & 0 deletions packages/rivetkit/src/drivers/engine/actor-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { WSContext } from "hono/ws";
import invariant from "invariant";
import { EncodingSchema } from "@/actor/protocol/serde";
import type { Client } from "@/client/client";
import { getLogger } from "@/common/log";
import {
type ActorDriver,
type AnyActorInstance,
Expand Down Expand Up @@ -119,6 +120,7 @@ export class EngineActorDriver implements ActorDriver {
websocket: this.#runnerWebSocket.bind(this),
onActorStart: this.#runnerOnActorStart.bind(this),
onActorStop: this.#runnerOnActorStop.bind(this),
logger: getLogger("engine-runner"),
};

// Create and start runner
Expand Down
10 changes: 1 addition & 9 deletions packages/rivetkit/src/drivers/engine/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,13 @@ export const ConfigSchema = z
runnerName: z
.string()
.default(() => getEnvUniversal("RIVET_RUNNER") ?? "rivetkit"),
// TODO: Automatically attempt ot determine key by common env vars (e.g. k8s pod name)
// TODO: Automatically attempt to determine key by common env vars (e.g. k8s pod name)
runnerKey: z
.string()
.default(
() => getEnvUniversal("RIVET_RUNNER_KEY") ?? crypto.randomUUID(),
),
totalSlots: z.number().default(100_000),
addresses: z
.record(
z.object({
host: z.string(),
port: z.number(),
}),
)
.default({ main: { host: "127.0.0.1", port: 5051 } }),
})
.default({});

Expand Down
2 changes: 1 addition & 1 deletion packages/rivetkit/src/drivers/engine/kv.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const KEYS = {
PERSIST_DATA: Uint8Array.from([1, 1]),
PERSIST_DATA: Uint8Array.from([1]),
};
15 changes: 12 additions & 3 deletions packages/rivetkit/src/drivers/engine/manager-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
GetWithKeyInput,
ManagerDriver,
} from "@/driver-helpers/mod";
import type { ManagerDisplayInformation } from "@/manager/driver";
import { type Encoding, noopNext, type RunConfig } from "@/mod";
import {
createActor,
Expand Down Expand Up @@ -135,14 +136,22 @@ export class EngineManagerDriver implements ManagerDriver {
return await upgradeWebSocket(() => args)(c, noopNext());
}

displayInformation(): ManagerDisplayInformation {
return {
name: "Rivet Engine",
properties: {
Endpoint: this.#config.endpoint,
Namespace: this.#config.namespace,
Runner: this.#config.runnerName,
},
};
}

extraStartupLog() {
return {
engine: this.#config.endpoint,
namespace: this.#config.namespace,
runner: this.#config.runnerName,
address: Object.values(this.#config.addresses)
.map((v) => `${v.host}:${v.port}`)
.join(", "),
};
}

Expand Down
5 changes: 4 additions & 1 deletion packages/rivetkit/src/drivers/file-system/global-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ export class FileSystemGlobalState {
actorDriver: ActorDriver;
};

get persist(): boolean {
return this.#persist;
}

get storagePath() {
return this.#storagePath;
}
Expand Down Expand Up @@ -418,7 +422,6 @@ export class FileSystemGlobalState {
actorDriver: ActorDriver,
) {
if (this.#runnerParams) {
logger().warn("already called onRunnerStart");
return;
}

Expand Down
11 changes: 11 additions & 0 deletions packages/rivetkit/src/drivers/file-system/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
import { createInlineClientDriver } from "@/inline-client-driver/mod";
import { ManagerInspector } from "@/inspector/manager";
import { type Actor, ActorFeature, type ActorId } from "@/inspector/mod";
import type { ManagerDisplayInformation } from "@/manager/driver";
import {
type DriverConfig,
type Encoding,
Expand Down Expand Up @@ -297,6 +298,16 @@ export class FileSystemManagerDriver implements ManagerDriver {
};
}

displayInformation(): ManagerDisplayInformation {
return {
name: this.#state.persist ? "File System" : "Memory",
properties: {
...(this.#state.persist ? { Data: this.#state.storagePath } : {}),
Instances: this.#state.actorCountOnStartup.toString(),
},
};
}

extraStartupLog() {
return {
instances: this.#state.actorCountOnStartup,
Expand Down
8 changes: 8 additions & 0 deletions packages/rivetkit/src/manager/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export interface ManagerDriver {
authData: unknown,
): Promise<Response>;

displayInformation(): ManagerDisplayInformation;

extraStartupLog?: () => Record<string, unknown>;

modifyManagerRouter?: (registryConfig: RegistryConfig, router: Hono) => void;
Expand All @@ -45,6 +47,12 @@ export interface ManagerDriver {
*/
readonly inspector?: ManagerInspector;
}

export interface ManagerDisplayInformation {
name: string;
properties: Record<string, string>;
}

export interface GetForIdInput<E extends Env = any> {
c?: HonoContext | undefined;
name: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/rivetkit/src/manager/mod.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { ManagerDriver } from "./driver";
export { ManagerDisplayInformation, ManagerDriver } from "./driver";
export { createManagerRouter } from "./router";
16 changes: 16 additions & 0 deletions packages/rivetkit/src/registry/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { chooseDefaultDriver } from "@/drivers/default";
import { createInlineClientDriver } from "@/inline-client-driver/mod";
import { getInspectorUrl } from "@/inspector/utils";
import { createManagerRouter } from "@/manager/router";
import pkg from "../../package.json" with { type: "json" };
import {
type RegistryActors,
type RegistryConfig,
Expand Down Expand Up @@ -92,6 +93,21 @@ export class Registry<A extends RegistryActors> {
logger().info({ msg: "inspector ready", url: getInspectorUrl(config) });
}

// Print welcome information
if (!config.noWelcome) {
const displayInfo = managerDriver.displayInformation();
console.log();
console.log(` RivetKit ${pkg.version} (${displayInfo.name})`);
for (const [k, v] of Object.entries(displayInfo.properties)) {
const padding = " ".repeat(Math.max(0, 13 - k.length));
console.log(` - ${k}:${padding}${v}`);
}
if (config.inspector?.enabled) {
console.log(` - Inspector: ${getInspectorUrl(config)}`);
}
console.log();
}

// Create runner
if (config.role === "all" || config.role === "runner") {
const inlineClient = createClientWithDriver(
Expand Down
3 changes: 3 additions & 0 deletions packages/rivetkit/src/registry/run-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export const RunConfigSchema = z
*/
basePath: z.string().optional().default("/"),

/** Disable welcome message. */
noWelcome: z.boolean().optional().default(false),

logging: z
.object({
baseLogger: z.custom<Logger>().optional(),
Expand Down
1 change: 1 addition & 0 deletions packages/rivetkit/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node"],
"resolveJsonModule": true,
"paths": {
"@/*": ["./src/*"],
// Used for test fixtures
Expand Down
11 changes: 11 additions & 0 deletions packages/sql-loader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RivetKit SQL Loader

_Lightweight Libraries for Backends_

[Learn More →](https://github.com/rivet-gg/rivetkit)

[Discord](https://rivet.gg/discord) — [Documentation](https://rivetkit.org) — [Issues](https://github.com/rivet-gg/rivetkit/issues)

## License

Apache 2.0
1 change: 1 addition & 0 deletions packages/sql-loader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@rivetkit/sql-loader",
"version": "2.0.3",
"description": "SQL file loader and migration utilities for RivetKit",
"license": "Apache-2.0",
"sideEffects": false,
"type": "module",
Expand Down
Loading
Loading