Plugin metadata (name, description, version, dependencies, etc.)
Zod validation schema for the plugin configuration
A Config class that extends BSBPluginConfig with metadata
// v9 pattern:
const TodoConfigSchema = z.object({
database: z.object({
host: z.string().default('localhost'),
port: z.number().default(5432),
}),
});
export const Config = createConfigSchema(
{
name: 'service-demo-todo',
description: 'Demo Todo Service',
version: '1.0.0',
author: 'BSB Team',
license: 'MIT',
category: 'service',
tags: ['demo', 'todo', 'example'],
initAfterPlugins: ['observable-default', 'events-default'],
},
TodoConfigSchema
);
// Usage in plugin:
export class Plugin extends BSBService<typeof Config, typeof EventSchemas> {
static Config = Config; // Required for auto-generation
}
Helper function to create a typed plugin configuration class with metadata.
v9 Breaking Change: This replaces the manual Config class pattern. Instead of extending BSBPluginConfig directly, use this helper to create a Config class with built-in metadata support.
The metadata is used to:
Plugin metadata (name, description, version, dependencies, etc.)
A Config class that extends BSBPluginConfig with metadata
// v9 pattern:
const TodoConfigSchema = z.object({
database: z.object({
host: z.string().default('localhost'),
port: z.number().default(5432),
}),
});
export const Config = createConfigSchema(
{
name: 'service-demo-todo',
description: 'Demo Todo Service',
version: '1.0.0',
author: 'BSB Team',
license: 'MIT',
category: 'service',
tags: ['demo', 'todo', 'example'],
initAfterPlugins: ['observable-default', 'events-default'],
},
TodoConfigSchema
);
// Usage in plugin:
export class Plugin extends BSBService<typeof Config, typeof EventSchemas> {
static Config = Config; // Required for auto-generation
}
Helper function to create a typed plugin configuration class with metadata.
v9 Breaking Change: This replaces the manual Config class pattern. Instead of extending BSBPluginConfig directly, use this helper to create a Config class with built-in metadata support.
The metadata is used to: