A minimal starter template for creating ObjectStack plugins. This template provides a clean foundation for building plugins that extend ObjectStack with custom objects, views, and functionality.
# Clone this template
git clone https://github.com/objectstack-ai/objectstack-starter.git my-plugin
cd my-plugin
# Install dependencies
npm install
# Build the plugin
npm run build
# Run the example
npm run exampleThis starter template includes:
- Plugin Configuration (
src/objectstack.config.ts) - Define your plugin metadata - Example Object (
src/objects/example.object.ts) - Sample data object definition - Example Views (
src/views/example.view.ts) - Sample list and kanban views - TypeScript Configuration - Properly configured for ObjectStack development
- Build Scripts - Ready-to-use development and build commands
objectstack-starter/
βββ src/
β βββ objectstack.config.ts # Plugin configuration
β βββ objects/ # Data object definitions
β β βββ example.object.ts
β βββ views/ # UI view definitions
β β βββ example.view.ts
β βββ index.ts # Main entry point
β βββ example.ts # Usage example
βββ package.json
βββ tsconfig.json
βββ README.md
Define your plugin's metadata in src/objectstack.config.ts:
import type { System } from '@objectstack/spec';
export const config: System.ObjectStackManifest = {
id: 'my-plugin',
name: 'my-plugin',
version: '0.1.0',
type: 'plugin',
description: 'Description of your plugin'
};Define data structures in src/objects/:
import { Data } from '@objectstack/spec';
export const myObject = Data.ObjectSchema.create({
name: 'my_object', // snake_case for machine names
label: 'My Object',
fields: {
name: {
type: 'text',
label: 'Name',
required: true
}
}
});Define how data is displayed in src/views/:
import type { UI } from '@objectstack/spec';
export const myListView: UI.ListView = {
name: 'my_list',
label: 'My List',
type: 'grid',
columns: [
{ field: 'name', label: 'Name', width: 200 }
],
data: {
provider: 'object',
object: 'my_object'
}
};ObjectStack follows strict naming conventions:
- Configuration Keys (TypeScript properties):
camelCase- Example:
maxLength,defaultValue,trackHistory
- Example:
- Machine Names (data values):
snake_case- Example:
my_object,first_name,example_field
- Example:
npm run build- Build the pluginnpm run dev- Watch mode for developmentnpm run clean- Remove build artifactsnpm run type-check- Type check without emitting filesnpm run example- Run the example usage
- Create a new file in
src/objects/(e.g.,my-object.object.ts) - Define your object using
Data.ObjectSchema.create() - Export it from
src/index.ts
- Create a new file in
src/views/(e.g.,my-object.view.ts) - Define your view following the UI Protocol
- Export it from
src/index.ts
This starter template uses the ObjectStack Protocol Specification:
- Data Protocol - Define data structures and relationships
- UI Protocol - Define user interface views
- System Protocol - Define plugin configuration and metadata
Edit src/objectstack.config.ts to set your plugin's ID, name, version, and description.
Replace or extend src/objects/example.object.ts with your own object definitions.
Replace or extend src/views/example.view.ts with your own view definitions.
Make sure to export all your objects and views in src/index.ts.
npm run buildThis creates a dist/ directory with compiled JavaScript and TypeScript definitions.
npm publishMake sure to update package.json with your plugin details before publishing.
Once built, your plugin can be:
- Imported in other ObjectStack applications
- Registered with an ObjectStack runtime
- Used to extend ObjectStack functionality
Example integration:
import myPlugin from '@your-org/my-plugin';
// Use in ObjectStack application- ObjectStack Spec - Protocol specification
- ObjectStack Documentation - Full documentation
- ObjectStack GitHub - Source code and examples
- Writing Plugins Guide - Official plugin development guide
- Follow the naming conventions strictly (camelCase for config, snake_case for data)
- Use the TypeScript language server for IntelliSense and type checking
- Use
Data.ObjectSchema.create()for creating objects with proper type inference - Keep your plugin focused on a specific domain or functionality
MIT
Built with β€οΈ using ObjectStack