A complete, working plugin — Notes, notes operators leave on subscriptions — to copy and make your own. It shows every kind of contribution a plugin can make:
| What | Where |
|---|---|
| Its descriptor: id, version, what it adds, which Rahdar it supports | src/main/resources/META-INF/rahdar/plugin.json |
| Its own database schema, migrated on activation, with rollbacks | src/main/resources/db/changelog/plugin/acme-notes/ |
| A JPA entity and an audited service | Note.java, NotesService.java |
An API behind Rahdar's permissions (acme-notes:read, acme-notes:write) |
NotesController.java |
| Assistant (MCP) tools: one on a subscription, one that names several clusters | NotesTools.java |
| An estate API listing the clusters the caller may count notes on, checked per cluster | NotesEstateController.java |
| A setting on Rahdar's Settings page | NotesSettings.java |
| Its table under Rahdar's data retention, quotas and purge (Administration → Data) | NotesStore.java |
| A page in each cluster, a navigation entry, a panel in every subscription's details, live updates | web/src/ |
| An estate page outside any cluster, in the estate sidebar under Plugins, gated by a global permission | web/src/NotesEstateView.tsx |
mvn verifyThat builds target/acme-notes-1.0.0.jar — descriptor, classes, database changes and UI in one jar — and
checks it exactly as Rahdar will when it is uploaded: the build fails on anything Rahdar would refuse, and
says how to fix it. Install it from Administration → Plugins in Rahdar.
You need Java 25 and Maven. Node is downloaded by the build.
Rahdar installs only a plugin it can tell who built. Sign the jar with a key of your own; an installer trusts your key once and every later version you sign is accepted. An unsigned jar is refused unless an installer switches on Allow unverified plugins in Administration → Plugins.
-
Make a key, once. Keep the keystore private and back it up: losing it means your users must trust a new key.
keytool -genkeypair -alias acme -keyalg EC -groupname secp256r1 -sigalg SHA256withECDSA \ -validity 36500 -dname "CN=Acme Ltd, O=Acme" -keystore acme.p12 -storetype PKCS12 -
Build with it. The password comes from the environment so it never lands in shell history or the pom:
export PLUGIN_SIGNING_STOREPASS=… mvn verify -Dplugin.signing.keystore=acme.p12 -Dplugin.signing.alias=acmeThe build signs the jar and then checks it as Rahdar will; it prints
Signed by …, key <fingerprint>. Withoutplugin.signing.keystorethe jar is unsigned and the build warns[plugin-unsigned]. -
Publish your certificate, next to your downloads, so installers can compare its fingerprint:
keytool -exportcert -rfc -alias acme -keystore acme.p12 -file acme.pem
-
Check a build against it. The build fails unless the jar was signed by that key, and also when it is unsigned:
mvn verify -Dplugin.signing.keystore=acme.p12 -Dplugin.signing.alias=acme -Drahdar.plugin.certificate=acme.pem
An installer sees your key's fingerprint on the review screen, compares it with the one you published, and chooses Trust this key; keys are managed under Administration → Plugins. The fingerprint is that of the key, so renewing the certificate for the same key changes nothing. Sign every version with the same key: an update signed by a different trusted key is allowed, but the installer must confirm the change.
- Pick an id: lowercase kebab-case, your organisation first, as in
acme-notes. Rename it everywhere —plugin.json, the changelog directory,@RequestMapping, the permission, setting, topic and tool names, andweb/src/api.ts. Rename the packagecom.acme.notesand setbasePackageandconfiguration. - Set
rahdar.versioninpom.xmlto the oldest Rahdar you support. The plugin compiles against that version's API and Rahdar refuses it on anything older. Use the same version of@rahdar/plugin-sdkinweb/package.json. - Keep to your namespace. Rahdar refuses a plugin whose classes are outside its
basePackage, whose API is outside/api/v1/p/<id>and/api/v1/clusters/{clusterId}/p/<id>, whose routes are outsidep/<id>, or whose permissions, settings, topics and tools are not prefixed with its id. - Use only types marked
@PluginApifrom Rahdar: those are kept stable within a contract version. Anything else can change in any release.
-
A paid plugin can ask for a license. Add
"requiresLicense": truetoplugin.jsonand Rahdar stores the file an administrator uploads, shows its state on the Plugins tab and tells the plugin when it changes. InjectPluginLicense, readfile(), check it your own way andreport(...)the verdict. Notes needs none, so the descriptor leaves it out. See Licensing in the plugin guide. -
A table that grows with use is a store. Contribute a
HousekeepingContributor, the wayNotesStoredoes, rather than a pruning job: operators then see it, set its retention and quota, and preview a purge on Administration → Data, and Rahdar purges it in small batches on one instance and audits each purge. -
No
@Scheduled,@Asyncor threads of your own. Contribute aScheduledJobbean; Rahdar runs it and stops it with the plugin. Give it a scope:INSTALLATIONfor work on shared rows (it runs on one Rahdar instance per tick),INSTANCEfor work on this instance's own state (it runs everywhere). -
Describe every permission, and declare its scope. Each
permissionsentry needs adescription, which the role editor shows, and ascope. A permission your guards check without a cluster (@perm.can('acme-notes:admin')) takes effect only through a global grant, so declare it"scope": "global"; one checked against a cluster is"cluster"; one checked against a subscription or destination is"resource"and also names theresourceTypes("subscription","destination") it acts on, and is checked withClusterAccessGuard.requireResourceandPermissionResolver.filter, asNotesControllerdoes, so a team member holds it on the subscriptions their team owns and nowhere else. An assistant tool guarded by one is"scope": "resource"and names itsresourceArgandresourceType. A permission that is only useful together with another lists it underrequires(acme-notes:writerequiresacme-notes:read), and the role editor adds it. The role editor and the effective-permissions preview show the scope. Rahdar'spermissionshealth check (in/actuator/health/rahdar) reports a guard or manifest entry naming a permission you did not declare. -
Deciding whether other operations may run? Declare
"approvalProvider": { "approverPermission": "acme-notes:approve" }inplugin.json(the permission must be one you declare) and expose oneApprovalProviderbean. This template is not one, so its descriptor has no such block. At most one active plugin may declare it. See Approval providers in the plugin guide. -
Audit every change with
AuditService, the wayNotesServicedoes. Operators rely on Rahdar's audit log being complete. -
Your schema is yours alone. No foreign keys into Rahdar's tables and nothing created outside your schema; store ids and handle their deletion.
-
Give every changeset a rollback. An update that applies one without a rollback cannot be rolled back, and the review screen says so before anyone confirms it.
-
Bundling a library? Rahdar refuses classes outside your
basePackage, so shade it and relocate it under your package:<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals><goal>shade</goal></goals> <configuration> <createDependencyReducedPom>false</createDependencyReducedPom> <artifactSet><includes><include>org.example:some-library</include></includes></artifactSet> <relocations> <relocation> <pattern>org.example</pattern> <shadedPattern>com.acme.notes.shaded.org.example</shadedPattern> </relocation> </relocations> </configuration> </execution> </executions> </plugin>
-
In the UI, import from
@rahdar/plugin-sdk,@mantine/core,@mantine/hooks, React and TanStack only — Rahdar shares those with your bundle, and the build refuses anything else from Mantine. Show notifications with the SDK'snotify. -
Never turn a string into markup or script. Rahdar's page refuses
innerHTML,outerHTML,insertAdjacentHTML,document.write,eval,new Worker(url)and inline event attributes, andjavascript:is not a link. Render with React, and keep a library that sets raw HTML out of the bundle.
The full guide: https://rahdar.dev/guide/plugins.