A package adds to DrootERP without touching its core: an app (models, fields, views, navigation, flows, automations, roles, settings, document layouts, seed data), an extension of an installed app (fields, record tabs, list actions), or a connector (a connection, operations, inbound webhooks). Packages are metadata the system renders with its own design system: declarative first, so they look and behave like the built-in apps.
The tools are open source (Apache-2.0): the droot CLI (sdk/cli), the test harness (sdk/testing), the starters
(sdk/starters), the package schemas (sdk/schemas) and the API client generator. The CLI talks to a system only over
its HTTP APIs; it never needs the system's source.
1. Install the CLI
The CLI runs on Node 20 or later. Until it is published, run it from a checkout:
npm install # once, at the repository root
alias droot="npx tsx $PWD/sdk/cli/src/bin.ts"
droot --help
2. Log in
Two ways, depending on what you need:
# As yourself (installing packages needs this: a person holding the Apps permission in every company)
droot login https://sandbox.example.com --email dev@example.com
# As an OAuth app (API v1 only: types, data). An administrator registers a public app in
# Setup › Integrations › Apps and Access with the redirect URI http://127.0.0.1:8976/callback
droot login https://sandbox.example.com --client-id dca_… --scopes "crm.read offline_access"
droot whoami
Tokens go to the OS keychain (macOS Keychain, Linux Secret Service), else to ~/.config/droot/credentials.json
readable only by you. The last system you logged in to is the default; --system or DROOT_SYSTEM picks another.
Develop on a sandbox, never on a system with real customer data: a sandbox company in a shared developer system for most work, a small dedicated system for upgrades and migrations.
3. Create a package
droot app init gate-pass --publisher acme # an app (from the Visitor Log starter)
droot app init chat-relay --template connector --publisher acme
droot app init vendor-score --template extension --publisher acme
droot app init asset-tags --template blank --publisher acme
The package id is <name>@<publisher> (gate-pass@acme): every key in the package starts with it
(gate-pass@acme.visit), and a field it adds to another app's model is named gate_pass__acme__<name>. The folder:
gate-pass/
droot.json the manifest: id, publisher, version, scopes, dependencies, display
metadata/models/ one folder per kind; any number of .json files in each (one per model, say)
metadata/fields/ views/ nav/ flows/ automations/ settings/ role-templates/ templates/ …
seed/ records installed with the package ({ model, key, records })
tests/ node:test files using @drooterp/testing; fixtures in tests/fixtures
README.md .gitignore
Every metadata kind is described by a JSON Schema in sdk/schemas (generated from the system's own contracts), and the
extension points are listed in extension-points.md. Document numbers come from number series (numbering.md).
A button that calls a route is an endpoint action (handler: "endpoint", with endpoint: { method, path, params, body, success, openPath, openUrl }). It calls the route as the signed-in user, so the route's own checks decide. It may call
the system's own routers (/api/fx, /api/matching), and an app's own routes once that app's manifest declares them ("routes": ["<app key>"]:
the routes its server module serves under /api/<app key>/). A path under a prefix no installed app declares is
refused at install. What the button does with the answer:
| The route answers | The button |
|---|---|
| JSON | Toasts success and refreshes the page; with openPath it opens a page instead: {result.id}, or a nested key such as {result.putaway.id}, names the record the call created; with openUrl (platform ^2.10.6) it opens, in a new tab, the web link at that key of the answer ("openUrl": "url", or a nested key such as recording.url: a temporary download or playback link). Only http and https links open; the dialog shows the link too (and the rest of the answer, such as an expiry) in case the browser blocks the tab. openPath and openUrl don't go together |
A file (content-disposition: attachment, or any answer that isn't JSON) |
Saves it under the name the route gives (a cheque's PDF, a payment file, labels) |
A GET with no parameters and no confirmation runs on the click: it saves the file, opens the answer's link (openUrl), or opens openPath (an answer's {result.id} may be new, which opens a new record's form); anything else opens the action's dialog first.
Conditions a record keeps on other records (a segment's audience, a scoring or assignment rule) are a json field with
"schema": { "kind": "filter", "model": "crm.lead" }, or { "kind": "filter", "modelField": "source", "models": { "lead": "crm.lead", "party": "partners.party" } } when another field of the record chooses the model. The value is a
record filter in the list filter language (OR groups included). The form edits it with the list's condition editor
and shows it as chips. Every save is checked against the target model's fields, so a condition on a field that model
lacks is refused.
A time of day with no date (opening hours, a shift start) is a time field, or a time column of a table field. The
value is the text "HH:mm" (24-hour, zero-padded: "09:30"), or "HH:mm:ss" with "time": { "seconds": true }, so
stored values sort and compare as the clock does; a list filters it by equals, before ($lt), after ($gt) and
between ($gte with $lte). The optional time spec also takes min and max (the earliest and latest time a save
may set, in the same form) and step (minutes between allowed times, counted from min, else midnight), for example
{ "fieldKey": "opensAt", "label": "Opens At", "type": "time", "time": { "min": "06:00", "max": "22:00", "step": 15 } }.
Every write is checked against them; a filter may name any time. Writes and imports take 9:30, 09:30:00 or
9:30 pm and store 09:30 or 21:30; an export writes the stored text. In expressions and conditions the value is
text: { "op": "lt", "args": [{ "ref": "opensAt" }, { "const": "09:00" }] }. Screens show it in the company's locale
and clock (Setup › Companies › Locale › Time Format: 12-hour, 24-hour or the locale's own).
A field holding a large or secret value (a signed file, a hash, a token) can keep its values out of the record
timeline with "history": "hidden": the timeline says only that it changed ("Licence File changed"), and the audit
log still records the values in full.
4. Check it
droot app validate # schemas, structure, scopes vs what the package touches, size limits
droot app lint # the above plus the guidelines: Title Case labels, no raw colours, no vendor names
Scopes say what the package reads and writes outside its own models, and are shown to an administrator before
install: adding a field to business partners needs partners.write, a lookup to them partners.read. Lint flags a
scope the package needs but doesn't declare, and one it declares but doesn't use.
5. Test it
droot app test
Runs tests/**/*.test.ts against an in-memory system with the package's dependencies and the package installed
through the real installer:
import { after, before, test } from "node:test";
import assert from "node:assert/strict";
import { startTestSystem, type TestSystem } from "@drooterp/testing";
let sys: TestSystem;
before(async () => { sys = await startTestSystem(); await sys.install(); });
after(async () => sys?.stop());
test("a visit is checked in", async () => {
const visit = await sys.create("gate-pass@acme.visit", { visitorName: "Asha Rao" });
const done = await sys.transition("gate-pass@acme.visit", visit.id, "check-in", { badgeNumber: "V-12" });
assert.equal(done.status, "checked-in");
await sys.drain(); // automations and other background work
});
sys.fixtures("visits") loads tests/fixtures/visits.json; sys.kernel reaches the rest.
6. Develop against a sandbox
droot app dev --system https://sandbox.example.com --company DEV-01
Installs the package as a private package, activates it in the sandbox company only, and re-uploads it on every saved change: each change is validated locally first, and the system's verdict (what changed, or why it refused) is printed.
7. Pack and install
droot app pack # dist/gate-pass@acme-0.1.0.zip and its .sha256
droot app install --system https://erp.example.com --dry-run
droot app install --system https://erp.example.com --company HQ
The archive is deterministic: the same package always packs to the same bytes and checksum. Install uploads it for a
dry run first and shows what will be created, updated or removed, then asks before installing (--yes skips the
question). A newer version is an upgrade: bump version in droot.json; data changes go in migrations/<id>.json.
droot app publish packs for the marketplace, which comes later; until then packages are installed privately.
8. Deprecate before you remove
Customers build on your package: their own automations run your transitions, their pages show your fields, their menus open your pages. A version that deletes one of those outright breaks them, and the update can't install until they are fixed. So a version deprecates what it is going to remove, keeps it for at least one minor (or major) version, and only a later version deletes it (as managed packages and solutions do on other platforms).
Mark the row, or a flow's stage or transition, with deprecated:
{ "key": "tender-start", "label": "Start Tender", "from": ["draft"], "to": "tender",
"deprecated": { "since": "2.8.0", "replacedBy": "start-tender", "reason": "Tenders start from the bid now" } }
since is the version that deprecates it (never later than the package's own version). replacedBy is optional and
names what to use instead: a sibling key for a field (a field of the same model), a stage or a transition (of the
same flow), the full key for a page, action, menu entry or automation; it must exist and not be deprecated itself.
A deprecated thing keeps working for whatever already uses it, and is offered for nothing new:
| What | Marked by | While deprecated |
|---|---|---|
| Transition | deprecated on the transition |
Not offered; refused when a person runs it (a bulk move too). Automations, approvals, automatic triggers and server code naming it still run it |
| Stage | deprecated on the stage |
Records in it stay and move on; a transition into it counts as deprecated. Never the initial or an entry stage |
| Field | deprecated on the field |
Left out of forms, lists and the import template; its values stay stored and readable (API, reports, prints, automations). Never required |
| Select option | moved from options to retiredOptions |
Records keep it and it still shows; no write sets it anew |
| Page (view) | deprecated on the view |
Left out of the menu; it still opens by its path |
| Menu entry (nav) | deprecated on the entry |
Left out of the menu |
| Action | deprecated on the action |
Not offered on any page |
| Automation | deprecated on the rule |
Keeps running unchanged until a later version removes it |
When an administrator inspects your update, every row of their own that uses something you deprecate or remove is
listed, with your replacedBy (finding reference-deprecated or reference-removed, and replacedBy in the
inspection data), so they can switch to the replacement before your next version removes it. Their rows that still
use a deprecated thing are listed in Review After Upgrade too. Taking the marker away again (a later version without
it) brings the thing back.
The release check. Before you publish, compare the release with the one released before it. A removal of
something the previous release did not deprecate is reported (removed-without-deprecation), and so is one removed in
the same minor version that deprecated it (removed-too-soon: deprecated in 2.8.0, removed in 2.8.1); "deprecated
since 2.8.0, removed in 2.9.0" is fine (removed-after-deprecation). Both are warnings by default and errors in strict
mode, which is what CI should run. What the release newly deprecates is listed too, for your release notes. Only
fields, options, stages, transitions, pages, actions, menu entries and automations are compared; the removal of a
whole record type or flow is not checked by it (it removes what it held).
9. Types and the API
droot types # types/models.ts for the package's models
droot types --system https://sandbox.example.com # plus types/client: the typed API v1 client of that system
See oauth.md for API access, sign-in-security.md for two-step sign-in and SSO, webhooks.md for events, and cli.md for every command.