Developer docs
Setup·

Setup

Scaffold with the niyase-plugin CLI, then build, lint, and run a local preview.

Requirements

  • Node.js 24+ / npm 10+
  • A modern browser (for local preview)

Scaffold a project

niyase-plugin new generates a plugin project.

npx @niyase/plugin-sdk new @your-org/tasks
cd tasks
npm install

Generated files:

tasks/
├── package.json        # niyase-plugin scripts + SDK devDeps
├── tsconfig.json
└── src/
    ├── manifest.ts     # defineManifest({...})
    ├── Root.tsx        # the main component that uses useNiyase()
    └── index.tsx       # createNiyase(); register("@your-org/tasks", Root)

CLI commands

CommandRole
niyase-plugin newScaffold a plugin
niyase-plugin buildGenerate the distributable IIFE bundle (dist/bundle.js)
niyase-plugin linttsc + validateManifest() (zod) + forbidden-API scan
niyase-plugin testRun vitest (verify against the MOCK with createTestHost())
niyase-plugin devLocal preview (see below)
niyase-plugin publishBuild + validate + submit (see Submission)

Local preview

npm run dev          # = niyase-plugin dev
# ▸ http://localhost:4321

niyase-plugin dev runs your plugin inside a true-to-life generic shell (AppBar / sidebar / tabs), executing it with <iframe sandbox> + postMessage and connecting it to a MOCK backend. Use the DevBar at the top to switch theme, role, industry, language, and fault injection while you check it.

Because preview and production both run on the same useNiyase() contract, what you see here becomes the production look as-is.

Minimal plugin

// src/Root.tsx
import { useEffect, useState } from "react";
import { useNiyase } from "@niyase/plugin-sdk";

export function Root() {
  const niyase = useNiyase();
  const [items, setItems] = useState<{ id: string; title: string }[]>([]);

  useEffect(() => {
    niyase.data
      .list<{ id: string; title: string }>("task")
      .then((r) => setItems(r.items));
  }, []);

  return (
    <ul>
      {items.map((it) => (
        <li key={it.id}>{it.title}</li>
      ))}
    </ul>
  );
}

Next, check the contents of manifest.ts in Manifest.