Installation
Register an authored behavior-pack manifest and import the addon APIs it uses.
Scaffold a project
- npm
- yarn
- pnpm
npx @bedrock-core/cli my-addon
yarn dlx @bedrock-core/cli my-addon
pnpm dlx @bedrock-core/cli my-addon
The starter includes a behavior pack, resource pack, Builder configuration and manifest registration. See CLI.
Install in an existing addon
- npm
- yarn
- pnpm
npm install @bedrock-core/server
yarn add @bedrock-core/server
pnpm add @bedrock-core/server
import { core } from '@bedrock-core/server';
import manifest from '../manifest.json';
core.register({ manifest });
Enable resolveJsonModule in TypeScript. The manifest owns the namespace, native UUID/version, display keys and dependencies. Its namespace is the address for discovery, API bindings and owned persistence. A BP/RP pair may share a namespace; two behavior packs cannot.
Set header.name to pack.name and header.description to pack.description. Author those strings in i18n/index.ts through createI18n and locale objects. See addon manifests.
Import an addon API
Install the provider's npm package and declare it in the authored manifest:
{
"dependencies": [{ "module_name": "@studio/economy" }]
}
import { getBalance, currency } from '@studio/economy';
const balance = await getBalance(player.id);
const kind = currency.get();
Builder resolves the provider's exported manifest into native pack requirements and Core availability. Public imports become clients; the implementation runs in the provider pack. Optional integrations use the same objects in optionalDependencies.
Publish an API
{
"name": "@studio/economy",
"exports": {
".": "./packs/BP/scripts/api/index.ts",
"./manifest.json": "./packs/BP/manifest.json"
}
}
Export an API object containing async functions, observable/signal sources and immutable metadata. Register that object with the owning Runtime:
import { core, registerModule } from '@bedrock-core/server';
import { API } from './api';
import manifest from '../manifest.json';
core.register({ manifest, economy: registerModule(API) });
Builder generates checked metadata and read-only consumer views. See public addon APIs for the complete authoring contract.
Install library services
const { config } = core.register({
manifest,
config: registerConfig(configDefinition),
catalog: registerCatalog(),
guides: registerGuides(),
});
Each declaration returns its typed accessor and owns its cleanup. Library services select API owners internally for cross-addon navigation and catalog discovery.
Next steps
- Public addon APIs — publish functions, observables and signals
- Runtime — declarations, services and lifecycle
- Translation authoring — localized pack display fields