---
name: orbito-modules
description: Build, test and publish Orbito modules with the omm CLI, and compose company automations from module triggers and actions. Use when the user mentions Orbito, an Orbito module, modules.orbi.do, omm, @orbito/api-lib, OVE views or Orbito automations, or wants to extend Orbito (orders, shipping, invoicing, integrations) with their own module.
---

# Orbito modules

## What Orbito is

- Orbito is a multi-tenant SaaS platform for running a company (orders, shipping, invoicing, marketplace and carrier integrations). Each company is a **tenant** with fully isolated data.
- The platform is a small **core**; everything else is a **module**: a standalone Node.js app (CommonJS) running in its own Docker container, with no direct network access (outgoing HTTP goes through `Core.fetch`).
- Installing a module in a company creates an **instance** with its own container, config and MongoDB collections. A module with `"singleton": false` can be installed several times in one company.
- A module talks to the core only through the SDK **`@orbito/api-lib`**. `@orbito/*` packages are not on npmjs.org: they live in the Orbito npm registry, which needs one scope line in `~/.npmrc` (`@orbito:registry=https://git.kozminski.net.pl/api/packages/orbito/npm/`) and no token.
- A module never ships front-end code. Its screens are **OVE views**: declarative YAML/JSON trees the Orbito front end renders, calling module methods over REST.
- Modules are published to the registry **modules.orbi.do** with the **`omm`** CLI, which also installs, inspects and calls them in a test company.
- One **Orbito account** (my.orbi.do) logs in to the panel, the registry and `omm`. A module belongs to a **namespace** (owner + members), its code is `<namespace>/<slug>`. Unreleased modules and drafts are visible only to namespace members and to companies granted access.

## Where the docs are

| What | URL |
|------|-----|
| Index of all pages | https://orbi.do/docs/llms.txt |
| All pages in one file | https://orbi.do/docs/llms-full.txt |
| Agent track (English) | https://orbi.do/docs/agents/ |
| Module anatomy | https://orbi.do/docs/agents/module-anatomy.html |
| The build loop | https://orbi.do/docs/agents/build-loop.html |
| Cheatsheet (SDK + OVE patterns) | https://orbi.do/docs/agents/cheatsheet.html |
| Example module `acme/hello` | https://orbi.do/docs/agents/hello-module.html |
| Company automations (`omm automation`) | https://orbi.do/docs/agents/automations.html |
| Public pages (no login) | https://orbi.do/docs/api/public-pages.html |
| Changelog of `omm` and the SDK | https://orbi.do/docs/agents/changelog.html |

Read **build-loop** before the first `omm` command and the **cheatsheet** before writing code. The Polish reference pages (linked from `llms.txt`) are the full API; where they disagree with the agent track, the agent track wins.

## Setup check

Run these before anything else:

```bash
npm i -g @orbito/omm --@orbito:registry=https://git.kozminski.net.pl/api/packages/orbito/npm/   # Node.js 18.13+
omm skill install                 # refreshes this skill and saves the @orbito scope line in ~/.npmrc for good
omm doctor --json                 # checks Node, omm version, npm scope, logins, working company, module SDK and the skill itself
omm whoami --json                 # registry: the account and its namespaces (modules belong to a namespace)
omm whoami --core --json          # Orbito Core: the user account and working company
omm company list --json           # companies of the user, * = working company
```

- `omm doctor --json` returns `checks` as `[{ name, status: ok|warn|fail, message, fix }]` and update notices under `notices`: fix what the checks report before you continue.
- `omm whoami --json` fails with `No token for <registry>` or `omm whoami --core --json` with `Not logged in to <core>`: ask the human to run `omm login` in their own terminal (one login covers the core and the registry), or to give you a token for `omm login --token <token>` (a core JWT logs in to both, `omm_...` to the registry only).
- `namespaces` is empty in `omm whoami --json`: ask the human which namespace to use. They create one (`omm namespace create <name> --json` with the name they chose; it is permanent and part of every module code) or the owner of an existing one invites their e-mail (`omm namespace invite <name> <email>`).
- **Never type, ask for or store a password.** Login is interactive and belongs to the human.
- A notice with `"kind": "core"`, a `core-login` check with `Orbito Core moved to https://my.orbi.do/api`, or `v2.orbito.pl` anywhere in the user's config or project: Orbito moved (see Orbito moved to my.orbi.do in Troubleshooting).
- No working company (`companyId` is `null` in `omm whoami --core --json`, no company with `"current": true` in `omm company list --json`): ask the human which company to test in, then run `omm company use <companyId>`.

## The loop

Add `--json` to every command. Run commands in the module directory (or pass `-C <dir>`); code and version always come from `module.json`. Steps marked **Human** need an explicit answer first.

1. **Log in (Human)**: `omm login` (core session + registry publish token in one), then `omm whoami --json` for the namespaces.
2. **Scaffold**: `omm init "<Display name>" --namespace <name> --json`, then `cd <dir> && npm install`.
   - Creates the module card in the namespace (code `<namespace>/<slug>`; `--namespace` may be omitted with exactly one namespace) and writes `module.json`, `package.json`, `index.js`, `pages/hello.yaml`, `.gitignore`.
   - The human already has a card: `omm init "<Display name>" --code <namespace/name> --json`.
   - Other options: `--dir <dir>`, `--description <text>`.
3. **Write methods** in `index.js` (`Core.registerMethod`), then `node --check index.js`.
4. **Add OVE pages** in `pages/*.yaml` (`Pages.registerPages`), then `omm pack --dry-run --json`.
5. **Check the core session**: `omm whoami --core --json` (`omm login` saved it in step 1).
6. **Choose the test company (Human)**: `omm company list --json`, then `omm company use <companyId>` with the id the human named.
   - Drafts install for members of the module namespace in any company they belong to; the first install or update grants that company access for good (container restarts, other users). There is no dev-token any more.
7. **Publish a draft**: `omm publish --json`. Waits for the Docker build and prints build errors in full.
8. **Install**: `omm install --json` (a second instance of a non-singleton module: `--name "<instance name>"`), then `omm instances --json`.
9. **Check**:
   - `omm logs --json` and `omm logs --container --json` (always, right after install or update),
   - `omm logs --since <iso> --json`, `omm logs --day <YYYY-MM-DD> --json`,
   - `omm problems --json` (filter: `--status waiting|solved|discarded`),
   - `omm call <method> --params '<json object>' --json`.
10. **Fix**: change the code, keep the same `version`, then:
    - `omm publish --json` (overwrites the draft of this version),
    - `omm update --json` (same version: reloads the instance with the new draft image; `--instance <id>` when there are several),
    - back to step 9.
11. Repeat 9–10 until logs are clean, `omm problems` is empty and `omm call` returns what you expect. Ask the human to check the page in the panel.
12. **Release (Human)**: set `version` in `module.json` and `package.json` higher than the last released version, then `omm publish --release --changelog "<what changed>" --json`.

Secrets the module declares in `module.json` are set by the human: `omm secrets set <NAME>` (hidden prompt). `omm secrets list --json` shows their status, never values.

If the module lives in a git repository, run `omm repo set` once after `omm init` (inside the module directory it saves `git remote get-url origin`; or pass the URL). The link is visible only to members of the module namespace, so everyone working on the module knows where the code is; it never goes into `module.json` or the package. `omm repo --json` shows it, `omm repo unset` removes it. URLs with a password or token are rejected.

Namespaces: `omm namespace list --json` (your role), `omm namespace members <name> --json`; `create <name>`, `invite <name> <email>` and `remove <name> <email>` (owner only) run only when the human asks.

## Company automations

When the human asks for an automation, or the module registers triggers or actions to test. Full guide: https://orbi.do/docs/agents/automations.html

- Loop: `omm automation elements --json` → `omm automation element <type> --json` (params, outputs, emits/requires) → graph file → `omm automation create -f graph.json --json` → `omm automation get <id> --json` → `omm automation runs --automation <id> --json` / `omm automation run <runId> --json`; fix with `omm automation update <id> -f graph.json --json`.
- Module elements are `<moduleCode>:<code>` and need `params.__instanceId` (`omm instances -m <moduleCode> --json`). Never guess types or param names.
- **`create`/`update` save a draft; show the graph to the human; `omm automation enable <id>` only after they agree.**
- A 422 `Automation graph is invalid`: read `validation.errors` (`path`, `code`, `message`), fix that path, send the whole graph again.

## Business solutions and community

- `omm solution publish [dir] | list | unpublish <slug> --json`: curated sets of published modules with automation templates, **only for members of the `core` namespace** (Orbito); anyone else gets 403. The directory holds `solution.yaml`, optional `README.md` and cover, and automation files in the `omm automation create -f` format without `isEnabled` and `params.__instanceId`. Format and rules: https://orbi.do/docs/spolecznosc/business-solutions.html
- Reviews, questions under a module and the forum live on https://modules.orbi.do; `omm` has no commands for them. Send the human there.

## Hard rules

- **`--json` on every `omm` command.** Errors arrive on stderr as `{ "error", "status" }` with a non-zero exit code; read them instead of guessing.
- **Read update notices.** `omm` prints update notices on stderr (text: lines starting with `!`; `--json`: one line `{"notices":[…]}`). Read them: a newer `omm`, SDK or skill may change the commands below. When the skill is outdated, run `omm skill install` (project copies: `omm skill install --project`).
- **After every `omm install` and `omm update`, run `omm logs --json` and `omm logs --container --json`.** A clean install message proves nothing; the container may crash a second later.
- **Draft before release, always.** Never run `omm publish --release` on code that was not installed and checked as a draft.
- **One version per draft cycle.** Keep the same `version` while iterating on a draft; bump it only right before `--release`, and set the next higher version before the first draft after a release. A released version is immutable.
- **No secrets in the package.** No API keys, passwords or tokens in code, `module.json`, pages or committed files. Application keys go to `module.json` `secrets` (names only) and reach the container as `process.env.NAME`; per-company settings go to config blocks (`Config.registerConfigBlocks`).
- **The response envelope.** A method result over REST is a one-element array. In OVE read it as `$response.0` (for example `{{ $response.0._id }}`), errors as `$error.message`. Datatables unwrap it themselves.
- **Validate params in the handler.** `params` in `Core.registerMethod` is documentation only; the core never validates it. Compile the schema with `fastest-validator` and throw `INVALID_PARAMS: ...` on bad input.
- **CommonJS only.** `'use strict';`, `require` / `module.exports`, no `"type": "module"`. `package.json` `main` is `index.js`; runtime dependencies go to `dependencies`.
- **`Core.onEnabled` fires once per installed version**, not on every container start. Do one-off setup there (indexes, migrations); start background jobs (timers, polling) at top level too, idempotently, or they die with the first container restart.
- **Register at top level** of `index.js` (methods, hooks, pages, config blocks). `Pages.registerPages` replaces the whole set: register all pages in one call.
- **Public pages (SDK 4.5.0+).** A page anyone can open without logging in is registered with `Pages.registerPublicPages` (address `https://orbi.do/p/<instanceId>/<pageCode>/?param=…`, build links with `Pages.publicUrl`, never by hand). The page code is one path segment; input goes only in the query (`{{ $page.urlParams.<param> }}`). It may call only methods registered with `public: true`; their `ctx` has no user (`ctx.userId === null`), so validate every input and return the minimum data, no personal data. The key in the URL must be random (uuid v4 / long token), never a database `_id`. Details: https://orbi.do/docs/api/public-pages.html
- **`module` is required** in every OVE `dataSource` and `callMethod`, and must equal `name` from `module.json`.
- **Do not guess the API.** Before using an SDK call, OVE view type or action you have not seen in the cheatsheet, look it up in `llms.txt` / `llms-full.txt`.

## Ask the human before

- logging in (`omm login`) or using any token,
- creating a namespace or changing its members (`omm namespace create`, `invite`, `remove`),
- choosing or changing the company (`omm company use`),
- installing in any company other than the test company the human named,
- `omm publish --release`,
- `omm solution publish` and `omm solution unpublish` (visible to every company),
- `omm secrets set` (the value is a secret; the human types it),
- creating a new module card when the human may already have one (`omm init` without `--code`),
- enabling, deleting or changing an enabled automation (`omm automation enable`, `delete`, `update`).

Ask, then wait for the answer. Never pick a default on the human's behalf.

## Troubleshooting

| Symptom | What to check |
|---------|---------------|
| `npm i -g @orbito/omm` or `npm install` returns 404 for `@orbito/...` (not in this registry) | The `@orbito` scope line is missing from `~/.npmrc`. Run `npm config set @orbito:registry https://git.kozminski.net.pl/api/packages/orbito/npm/` and retry; no token is needed. |
| `npm i -g @orbito/omm` fails with `EACCES` / `permission denied` on `/usr/local/lib/node_modules` (or another global dir) | The global npm directory is root-owned (Node.js from the macOS .pkg or a Linux package). Either run only the install step with sudo: `sudo npm i -g @orbito/omm --@orbito:registry=https://git.kozminski.net.pl/api/packages/orbito/npm/`, then `omm skill install` without sudo; or move npm to a user-owned prefix: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally. |
| `Core rejected the session token (Access forbidden)` with the hint `Orbito Core moved to https://my.orbi.do/api` | The core address is the old `v2.orbito.pl`. See Orbito moved to my.orbi.do below. |
| `No token for <registry>` or `Not logged in to <core>` | Registry token or core session missing or expired. Ask the human to log in (see Setup check). |
| `<namespace/name> has N active instances: ... Choose one with --instance <id>` | Several instances in the company. Run `omm instances --json`, ask which one, pass `--instance <id>`. |
| `No active instance of <namespace/name> in this company` | Not installed in the working company yet, or disabled. Check `omm whoami --core --json` for the company, then `omm install --json`. |
| `omm publish` fails with a Docker build error | Read the printed build log: usually a missing package in `dependencies`, a bad `package.json`, or a `package-lock.json` out of sync. Fix, run `omm publish --json` again (same version). |
| `omm publish` returns 404 `Moduł "<namespace/name>" nie istnieje w repozytorium` (module does not exist) | No module card with that code. `omm init --code` will not help, it never creates a card: create it with `omm init "<Display name>"` and use the code it returns, or ask the human for the exact code of their existing card. |
| `omm init` fails with `You are not a member of any namespace` | Ask the human for a namespace (see Setup check). |
| `omm publish` returns 403, or 400 about the version | 403: the logged-in account is not a member of the module namespace (the part of the code before `/`; check `omm whoami --json`). Version not higher than the last released one, or already released: bump `version`. |
| `omm install` / `omm update` returns 404 `Module image not found` | The registry does not hand out the draft to this account and company: the logged-in account is not a member of the module namespace (`omm whoami --json`). Ask the human to log in with the right account or to get invited. |
| `omm logs --container` shows an exception at start | The module crashed before registering (syntax error, missing `require`, ESM syntax). Fix `index.js`, `node --check index.js`, publish, update. |
| `registerPages` / `registerConfigBlocks` errors in `omm logs` | The page or config block was rejected; the message names the field. Compare with the cheatsheet. |
| `omm call` answers `Method not found: ...` | The method is not registered in the running version: check the name, then `omm publish` + `omm update` and re-read the logs. |
| `omm automation create` / `update` fails with 422 `Automation graph is invalid` | Nothing was saved. Read `validation.errors` on stderr: each has `path` (e.g. `actions.wait.params.value`), `code` and `message`. Fix that place in the graph (`omm automation element <type> --json` for the schema) and send the whole graph again. |
| A public page gets 403 `METHOD_NOT_PUBLIC` | The page called a method registered without `public: true` (or in the short form, a bare function, which is never public). Register it in the descriptive form with `public: true`, publish, update. |
| A public page or its method gets 429 `RATE_LIMITED` | Limits: 120 requests/min per client IP, 600/min per instance (shared by all visitors). Wait for `Retry-After`; do not poll a method in a loop from a public page. |
| OVE page shows nothing after `callMethod` | Template reads `$response.x` instead of `$response.0.x`, or `module` is missing or wrong in the action. |

### Orbito moved to my.orbi.do (2026-10-25)

When `omm` prints the `core` notice or hint, or the user's config, scripts or docs mention `v2.orbito.pl`:

1. Tell the human: the Orbito panel and API are now at `https://my.orbi.do` (admin panel: `https://admin.orbi.do`). The old address only redirects, and the redirect drops the session, so they also have to log in again in the web panel.
2. Ask the human to run `omm login --core https://my.orbi.do/api` in their own terminal (it asks for the password; never type or ask for it yourself), or to give you a core JWT for `omm login --core https://my.orbi.do/api --token <token>`. Check with `omm whoami --core --json`.
3. Find `v2.orbito.pl` in the user's project (`OMM_CORE`, CI scripts, `.env`, README), show the human the places and replace them with `https://my.orbi.do/api` (or `https://my.orbi.do`) only after they confirm.
