Template project for creating a new Orderly SDK plugin. It comes with:
- Plugin registration: exports a
registerPlugin()factory usingcreateInterceptorfrom@orderly.network/plugin-core - 3-layer widget architecture: widget wrapper → business logic hook → pure UI component
- i18n integration: external locale loading powered by
@orderly.network/i18n - Style build pipeline: uses
tailwindcssto builddist/styles.css
pnpm add @orderly.network/your-plugin-nameThis template declares the following peerDependencies (must be provided by the host app):
@orderly.network/hooks >= 2.10.1@orderly.network/i18n >= 2.10.1@orderly.network/plugin-core >= 2.10.1@orderly.network/ui >= 2.10.1react >= 18react-dom >= 18
registerOrderlyPlugin(options): Plugin registration function, pass toOrderlyPluginProvider.pluginsLocaleProvider: i18n provider componentOrderlyPluginTemplateOptions: TypeScript interface for plugin options
import { registerOrderlyPlugin } from "@orderly.network/your-plugin-name";
import { OrderlyPluginProvider } from "@orderly.network/ui";
function App() {
return (
<OrderlyPluginProvider plugins={[registerOrderlyPlugin({ className: "..." })]}>
<TradingPage />
</OrderlyPluginProvider>
);
}LocaleProvider is implemented on top of ExternalLocaleProvider from @orderly.network/i18n:
import { LocaleProvider } from "@orderly.network/your-plugin-name";
export function Root() {
return <LocaleProvider>{/* your widget here */}</LocaleProvider>;
}pnpm buildThis runs tsup to build the TypeScript and tailwindcss to build dist/styles.css.
Generate a new plugin from this template:
npx @orderly.network/cli create plugin --pluginId myplugin-a1b2c3 --template defaultThe CLI will replace handlebars placeholders ({{{pluginId}}}, {{{pluginName}}}, etc.) with your provided values.
src/
index.tsx ← Plugin entry, registerPlugin factory
types/
plugin.ts ← Plugin options interface
components/
pluginWidget/
index.ts ← Widget barrel export
pluginWidget.widget.tsx ← Layer 1: Widget wrapper
pluginWidget.script.tsx ← Layer 2: Business logic hook
pluginWidget.ui.tsx ← Layer 3: Pure UI component
i18n/
index.ts ← Re-export LocaleProvider
provider.tsx ← Wraps ExternalLocaleProvider
module.ts ← LocaleMessages + type
locales/
en.json ← Default locale
tailwind.css
pnpm dev # Watch mode
pnpm build # Production build