Skip to content

Universal APIs

@starbeam/universal is the framework-neutral authoring package for Starbeam. Use it for resources and common reactive authoring APIs that are not tied to a specific framework adapter.

Most framework-neutral app and library code pairs it with @starbeam/collections.

Terminal window
pnpm add @starbeam/universal @starbeam/collections
import { Resource } from "@starbeam/universal";
import { reactive } from "@starbeam/collections";
Export groupExportsNotes
ResourcesResource, ResourceListFramework-neutral lifecycle authoring.
Resource typesResourceBlueprint, IntoResourceBlueprintUseful for reusable resource helpers.
Reactive primitivesCell, Marker, Formula, CachedFormula, Static, readPrefer @starbeam/collections for app state; use primitives when building lower-level abstractions.
Reactive typesReactive, Equality, FormulaFnHelper types for library and primitive authors.
Higher-level helpersFormulaList, Freshness, VariantsAdvanced reactive helpers.

Some public APIs intentionally stay in direct packages:

PackageUse for
@starbeam/servicelower-level app-scoped service machinery
@starbeam/resourcelow-level resource setup and sync helpers
@starbeam/reactiveprimitive-building surface and implementor compatibility exports

App authors usually reach services and resource scheduling through framework adapters.

@starbeam/universal still exports a few lower-level values for compatibility with existing packages and integrations. These are not the first APIs to teach in new examples:

  • debug wiring such as DEBUG and DEBUG_RENDERER;
  • runtime/protocol wiring such as CONTEXT, RUNTIME, and TAG.

Prefer direct package imports or adapter APIs for new low-level integration code.