Skip to content

Admin SDK should support publishing topics to rooms #2303

@uriva

Description

@uriva

Problem

The admin SDK (@instantdb/admin) has a Rooms class that only exposes getPresence(). There is no way to publish topics from the server side.

The core SDK (@instantdb/core) supports joinRoom().publishTopic(), but the Reactor constructor has an isClient() guard that returns early when window is not defined, making it unusable in server environments (Node.js, Deno, etc.).

Use case

We're building a chat platform where a backend endpoint needs to broadcast ephemeral UI updates (spinner progress, status changes) to connected clients in a specific room. Topics are the perfect fit for this — fire-and-forget, no persistence needed. But since the admin SDK can't publish topics, we're forced to use persistent entities + reactive queries as a workaround, which adds unnecessary DB writes.

Desired behavior

import { init } from "@instantdb/admin";

const db = init({ appId, adminToken, schema });

// Publish a topic to a room (fire-and-forget to all connected clients)
await db.rooms.publishTopic("conversation", roomId, "uiUpdate", { elementId, percentage: 0.5 });

Current workaround

Using a persistent entity that clients read via useQuery, with manual cleanup of old records.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions