Plugin Developer Quickstart¶
Create a OnePlatform plugin, simulate a hook locally, package it, and install it.
Prerequisites¶
- OnePlatform stack running (see Platform Admin Quickstart)
- Node.js 20+ and npm 10+
@oneplatform/cliinstalled globally:npm install -g @oneplatform/cli- Account with
plugins:managescope (dev-mode install does not require platform-admin)
Setup (3 commands)¶
# 1. Log in
op auth login --email developer@example.com
# 2. Scaffold a new plugin (interactive prompts)
op plugin create
# 3. Enter the plugin directory and install dependencies
cd my-plugin && npm install
First working example¶
After op plugin create, the interactive prompts ask for: - Name: My Plugin - Slug: my-plugin - Type: transformer (connector, transformer, or hook) - Description: Transforms records during ingestion
The scaffold creates:
my-plugin/
src/
index.ts # Plugin entry point with hook handler
index.test.ts # Vitest test using mock context
plugin.manifest.json
tsconfig.json
package.json
Step 1: Implement a hook¶
Edit src/index.ts to add logic to the before:ingestion.receive hook:
import { definePlugin } from "@oneplatform/plugin-sdk";
export default definePlugin({
hooks: {
"before:ingestion.receive": async (event, ctx) => {
// Normalize email to lowercase before records are stored
if (typeof event.data.email === "string") {
event.data.email = event.data.email.toLowerCase();
}
ctx.log.info("Email normalized", { email: event.data.email });
return event;
},
},
});
Step 2: Test the hook locally¶
# Build the plugin
npm run build
# Create a sample input file
cat > data.json << 'EOF'
{ "email": "CUSTOMER@Example.COM", "name": "Test User" }
EOF
# Simulate the hook without deploying
op plugin simulate-hook before:ingestion.receive --input data.json
Expected output:
Step 3: Run the tests¶
Tests use createMockContext from @oneplatform/plugin-sdk/testing for isolated unit testing without a running platform instance.
Step 4: Package the plugin¶
The .oppkg file is a ZIP archive containing dist/bundle.js and plugin.manifest.json.
Step 5: Install the plugin (dev mode)¶
# Install in dev mode — requires only plugins:manage scope (not platform-admin).
# Dev-mode installations are tenant-scoped and expire after 7 days.
op plugin install ./my-plugin-1.0.0.oppkg --dev
Expected output:
Verify the plugin is active:
Iterating during development¶
# Watch mode: rebuilds on every file change
npm run dev
# Re-simulate after changes (no redeploy needed for local testing)
op plugin simulate-hook before:ingestion.receive --input data.json
# Reinstall to the platform after significant changes
op plugin install ./my-plugin-1.0.0.oppkg --dev
Next steps¶
op plugin --help— upgrade, rollback, list, and remove pluginspackages/plugin-sdk/src/dev/simulate-hook.ts— simulate-hook internalsplugin.manifest.json— hooks, permissions, and connector type declarations- App Developer Quickstart — build a UI to visualize plugin output