server
Build addons with typed addon API imports, observable state and owned services.
@bedrock-core/server is in beta: the API can change between releases. Pin matching versions across packages.
What is @bedrock-core/server?
Each behavior pack runs in its own script realm. Public addon APIs let code use normal imports while functions execute in the owning pack and observable values synchronize between packs.
import { getBalance, currency, balanceChanged } from '@studio/economy';
const balance = await getBalance(player.id);
const currentCurrency = currency.get();
const stop = balanceChanged.subscribe(updateBalance);
Builder reads the installed addon's manifest and public exports and generates client bindings. The owning behavior pack publishes its implementation through core.register({ manifest, economy: registerModule(API) }). The runtime owns discovery, availability, calls and subscription cleanup. See public addon APIs.
Install
- npm
- yarn
- pnpm
npm install @bedrock-core/server
yarn add @bedrock-core/server
pnpm add @bedrock-core/server
The umbrella package exposes the runtime. Install libraries such as @bedrock-core/i18n, @bedrock-core/observable and @bedrock-core/db directly when your code uses them. Register the authored manifest once:
import { core } from '@bedrock-core/server';
import manifest from '../manifest.json';
core.register({ manifest });
What you get
- Public addon APIs — async functions, read-only observables and transient signals through package imports
- AddonRegistry — addon presence, dependencies and display metadata
- Persistence — library-owned documents with schemas and migrations
- Optional integrations — configuration and imported observables with runtime-owned cleanup
- Translations — localized display metadata and cross-addon translation resolution
- Declarations and services — install library services with runtime-owned cleanup
The runtime uses @bedrock-core/sync internally. That transport is independently installable for transport implementations and protocol tests.
Next steps
- Installation — scaffold or register an addon
- Public addon APIs — publish and consume typed addon APIs
- Sharing data between addons — choose functions, values and signals
- Trust model — ownership and authorization