Core API Cheatsheet
A concise reference guide of the most frequently used SAPI core interfaces and code snippets when developing SFMC modules. Ready to copy and adapt.
1. Module Lifecycle & Registration (ModuleRegistry)
Every module entry point sapi/src/index.ts must register via ModuleRegistry.register.
2. Notification & Message Helpers (Msg)
Direct player.sendMessage() calls are disallowed by lint rules. Always use the standardized Msg helpers.
3. Standard Form Styling (ListFormInfo)
When constructing UI forms via @minecraft/server-ui, follow the unified visual layout:
4. Database Persistence & Transactions (@sfmc-bds/sdk/sapi/db)
Safely persist data to isolated SQLite storage via @sfmc-bds/sdk/sapi/db.
5. Private Module Configuration (@sfmc-bds/sdk/sapi/config)
Read and write isolated configuration in configs/<configKey>.json:
Declare defaults in the module package at configs-default/<configKey>.json; install and update operations add only missing fields and never overwrite user values.
6. Cross-Module RPC & Services (@sfmc-bds/sdk/sapi/service)
When module A requires a service declared in module B's manifest: