Appearance
Writing plugins
A plugin is a folder with a plugin.json, PHP classes that register what it adds, and, if it has a part in the interface, a script and a style. The example in examples/plugins/rating of the source package adds a star rating field type and a STARS() formula function. Start from it.
The plugin API grows with Qorekit
Until version 1.0, a minor version of Qorekit may change the plugin API. The changelog says so when it does.
The folder
rating/
├── plugin.json
├── src/
│ ├── RatingPlugin.php the entry class
│ ├── RatingType.php a field type
│ └── StarsFunction.php a formula function
├── migrations/ tables of its own, if it needs them
└── dist/
├── rating.js its part of the interface
└── rating.cssPeople install it by uploading a zip of this folder (the files at the top of the zip, or in one folder) in Administration › Plugins, or by copying it to plugins/{vendor}/{name}.
plugin.json
json
{
"id": "acme/rating",
"name": { "en": "Star rating", "tr": "Yıldız puanı" },
"description": { "en": "Rate records with stars." },
"version": "1.0.0",
"requires": { "qorekit": ">=0.2.0", "php": ">=8.3" },
"entry": "Acme\\Rating\\RatingPlugin",
"autoload": { "psr-4": { "Acme\\Rating\\": "src/" } },
"frontend": { "script": "dist/rating.js", "style": "dist/rating.css" },
"author": "Acme",
"homepage": "https://acme.example"
}| Key | Meaning |
|---|---|
id | vendor/name, in lowercase letters, digits and dashes. qorekit/ is kept for Qorekit's own |
name, description | Text, or text per language |
version | Like 1.0.0 or 1.1.0-beta.1 |
requires | Version constraints for Qorekit and PHP, as Composer writes them: >=0.2.0, ^0.2, >=8.3 <9 |
entry | The class that registers what the plugin adds |
autoload | PSR-4 namespaces and their folders. Qorekit's and Laravel's namespaces cannot be used |
frontend | A .js script and a .css style, loaded on every page while the plugin is on; browsers read them afresh whenever the files change, not only with a new version |
languages | For a language pack: codes and names, {"de": "Deutsch"}. See language packs |
The entry class
Qorekit makes the entry class on every request while the plugin is on and calls register() once, early. Register what the plugin adds there, and do nothing slow: no queries, no requests to other sites.
php
use Qorekit\Sdk\Plugins\Plugin;
use Qorekit\Sdk\Plugins\PluginContext;
final class RatingPlugin implements Plugin
{
public function register(PluginContext $context): void
{
$context->fieldType(new RatingType);
$context->formulaFunction(new StarsFunction);
}
}PluginContext offers:
| Method | What it adds |
|---|---|
fieldType(FieldType $type) | A field type. Its key must be free; start it with the plugin's name |
formulaFunction(FormulaFunction $function) | A function formulas can call. Its name must be free |
onRecord(string $event, Closure $listener) | Called after a record is created, changed, moved to the trash, restored or deleted for good (RecordCreated::class… or RecordEvent::class for all), or commented on (RecordCommented::class, asked for by name). A listener that fails is reported; the save stands |
adminPermission(string $key, array $description) | A permission of administration for roles, for the plugin's own pages |
adminPage(string $key, array $title, ?string $permission) | A page under Administration (below) |
route(string $method, string $path, Closure $handler, ?string $permission, bool $inDemo) | An endpoint of the plugin's (below) |
publicRoute(string $method, string $path, Closure $handler, bool $inDemo) | An endpoint for other servers, without signing in, such as a webhook (below) |
notice(Closure $check) | Something administrators should know, at the top of every page (below) |
recordScope(RecordScope $scope) | A scope roles can give for seeing, changing and deleting records, next to none, own and all (below) |
recordScopeSource(RecordScopeSource $source) | Scopes of one entity each, such as rules people write (below) |
checkFilter(string $entity, array $filter, bool $ownFieldsOnly) | Checks a filter against an entity; throws InvalidInput with what is wrong |
fieldPolicy(FieldPolicy $policy) | Field permissions: fields roles may only read, or not see (one plugin at a time) |
adminScopeSource(AdminScopeSource $source) | Administration permissions given for some modules, entities or choice lists only (one plugin at a time; below) |
twoFactorPolicy(TwoFactorPolicy $policy) | Roles whose people must use two-step verification, with days to set it up (one plugin at a time; below) |
twoFactorChannel(TwoFactorChannel $channel) | Another way to send the codes of two-step verification, such as text messages (below) |
textMessages(TextMessages $sender) | How Qorekit sends its own text messages, such as the codes that verify a mobile number on an account (one plugin at a time; below) |
demoContent(Closure $seed) | Sample data for a public demo, made once after each reset, after Qorekit's own |
inDemo(), workPaused() | Whether this is the public demo (send nothing to other servers or inboxes there; Qorekit sends no email itself), and whether maintenance pauses work (work a plugin runs outside scheduled tasks waits too) |
recordGuard(RecordGuard $guard) | A check on every change to a record before it is saved, that can refuse it (below) |
recordFiller(RecordFiller $filler) | Values set on every record about to be created or changed, before they are checked (below) |
importsMaySkipAutomation(string $adminPermission) | Offers Run automation rules for these rows in the CSV importer to people with this administration permission for the entity; unticked, the import's changes carry RecordContext::$automation (and RecordChange::automation()) false |
records(?int $actingFor, ?RecordCause $cause) | Records to read and write with every right, through the same checks and events as any change (below) |
mailer() | Email from the queue, in Qorekit's own layout (below) |
fieldsOf(string $entity) | An entity's fields (FieldDefinition), for settings that name them |
matches(string $entity, array $filter, array $values, ?int $me) | Whether a record's values match a filter on the entity's own fields, as form rules judge them |
checkExpression(string $entity, string $expression), evaluateExpression(…, array $values) | A formula written for a value (TODAY() + 3): checked (it says what it gives), and worked out for a record (below) |
notify(int $userId, string $entity, int $recordId, string $message, ?int $actorId) | A notification under a person's bell, about a record; false when they may not see it (below) |
recordAs(int $userId, string $entity, int $recordId), visibleToAll(string $entity, array $values) | A record as a person sees it; the values everyone who may see a record may read (below) |
seenAs(int $userId, string $entity, array $values) | Values read with every right (or about to be written) cut to what a person may see: hidden fields left out, sensitive text masked |
subRecordsAs(int $userId, string $entity, int $parentId, int $limit) | A record's sub-records of one sub-entity as a person sees them, oldest first |
recordsAs(int $userId, string $entity, array $filter, ?string $sort, int $limit, ?int $parentId, array $sums) | The records a filter finds as a person sees them, in an order, with how many there are in all and totals of number fields; a filter naming a field they may not see finds nothing |
fieldText(string $entity, string $field, mixed $value, ?int $userId) | A field's value as text, as a person reads it (labels, Yes or No, dates and times in their time zone); the value as records are read, or as a save takes it (a choice's key, a person's id) |
asRead(string $entity, array $values) | Values as a save takes them turned into values as records read them, with their labels: what a rule is about to write, shown |
headingOf(string $entity) | The key of the field that names an entity's records, or null |
recordUrl(string $entity, int $recordId), siteName() | The address of a record's page, for links in messages; the installation's name |
cleanHtml(string $html) | HTML cleaned as rich text fields clean it (no scripts, styles or event attributes) |
emailHtml(string $html) | HTML for an email's body (MailMessage::$html): cleaned as the extended editor's (which also keeps alignment, palette colours and highlights), with the inline styles mail programs need for tables, quotes and code |
people() | Who has a role (withRole), the super admins (superAdmins), a person's roles, whose account is active, people's names (names), who may see a record (whoMaySee), a record's followers, and teams |
codeSteps() | Code hooks of the kind "step", to run as a step of the plugin's own: those of an entity (of), and run for a record, in a person's name; asking for them makes Administration › Code hooks offer the kind |
backups() | Qorekit's database backups: all of them, one, its file once it is ready (file), a backup begun on a schedule (start(Backups::SCHEDULED), made by scheduled work) and deleting one; Qorekit leaves the number of scheduled backups to the plugin. inspect says what a backup file is and what restoring it means, and whether this installation made it (from_here); restore restores one in maintenance mode, as the command line does, backing up the database first if asked, and one the installation did not make only with trusted: true. Qorekit\Sdk\Backups\BackupCipher encrypts a backup for a passphrase, in chunks, as qorekit:backup:restore and qorekit:backup:decrypt read it |
task(string $key, Closure $work) | Work done every minute by Qorekit's scheduled work, for the seconds it is given (below) |
cronWorks(), timezone() | Whether cron runs the scheduled work; the installation's time zone |
storagePath(string $relative) | A folder of the plugin's own in Qorekit's storage, kept across updates |
id(), version(), path() | The plugin's id, version and a path inside its folder |
Everything a plugin registers is checked before any of it is kept: a key that is taken turns the plugin off with a message.
A field type
A field type implements Qorekit\Sdk\Fields\FieldType; extending BaseFieldType gives sensible defaults. It says how its values are stored (a column), checked (Laravel validation rules), read from text (imports and filters), written as text (exports) and filtered. See RatingType in the example. These interfaces add to it:
LabelledType: the type's name in the list of types, per language.UsableInFormulas: what its values are in a formula (a number, text…).ComputesValue: its value is worked out from the record's other values when the record is saved, and stored, as a formula's is.
frontend() names the interface's kinds for editing and showing a value; the plugin's script registers them (below). The settings of a field of the type are described by configSchema(), a JSON Schema; each setting's title labels it in the field dialog.
When a plugin is turned off, fields of its types keep their columns and values, unread and unchanged, until it is turned on again.
A formula function
A formula function implements Qorekit\Sdk\Formulas\FormulaFunction: its name, how many arguments it takes, what it gives for arguments of given types, and call() that works it out. The server's result is the one stored; a twin in the plugin's script lets forms show it while they are filled in.
Pages, endpoints and notices
A plugin can add pages under Administration, endpoints for them, and notices for administrators:
php
$context->adminPermission('desk.manage', ['en' => 'Manage the desk']);
$context->adminPage('note', ['en' => 'Desk note'], 'desk.manage');
$context->route('GET', 'note', fn (): array => ['text' => $this->read()], 'desk.manage');
$context->route('PUT', 'note', function (Request $request): array {
// …
}, 'desk.manage');
$context->notice(fn (): ?Notice => $this->read() === null ? new Notice('The desk has no note yet.', 'note') : null);- Who may. A page or an endpoint takes an administration permission (Qorekit's own or one the plugin adds),
nullfor administrators only, orPluginContext::SIGNED_INfor anyone signed in. Pages show in the Administration menu only to those who may open them. A permission given for some modules or entities only (Pro's administration scopes) lets the person in too: the endpoint checks which ones with$access->allowsOn($permission, $entityUuid).$access->isSuperAdmin()says whether the person is a super admin, for what is theirs alone (code). - Endpoints answer at
/api/v1/plugins/{vendor}/{name}/api/{path}; a path may hold parameters (items/{id}). The handler gets the request, the parameters and what the person may do (RecordAccess). It returns an array, sent as{"data": …},nullfor an empty answer, or a response of its own. ThrowInvalidInputfor a mistake in what was sent: it is answered as Qorekit's own errors are. Endpoints follow maintenance mode and viewing as a role like the rest of the API. - Public endpoints (
publicRoute) answer other servers at/api/v1/plugins/{vendor}/{name}/public/{path}, without signing in: a webhook, say. The handler gets the request and the parameters, and must tell who calls itself, with a secret in the path or a signature: Qorekit checks nothing about the caller. They answer 503 in maintenance mode, and each address may call them 120 times a minute. - In a public demo, an endpoint answers GET requests, and others only when it passes
inDemo: true. The demo starts afresh by dropping every table, so set it for an endpoint that changes only the database; leave it off for one that writes files, reaches other servers or changes what the demo itself needs, such as a licence. - Notices are checked each time an administrator opens Qorekit: keep the check quick, and return
nullwhen all is well. A notice may link to one of the plugin's pages. - Files the plugin keeps go in
storagePath(), never in its own folder, which an update replaces. Delete with its data removes them.
The page itself is drawn by the plugin's script (below).
A record scope
A record scope says which records of an entity a role's users reach, as own and all do. It implements Qorekit\Sdk\Records\RecordScope; Qorekit Pro adds its team and assignment scopes this way. The role screens offer it for seeing, changing and deleting, under its name().
php
final class RegionScope implements RecordScope
{
public function key(): string { return 'region'; }
public function name(): array { return ['en' => 'Their region']; }
// Its records always include the person's own: a person with both keeps this one.
public function covers(): array { return ['own']; }
public function apply(ScopeQuery $query): void
{
$query->orWhereCreatedBy([$query->actorId()]);
$query->builder()->orWhere($query->column('region'), $this->regionOf($query->actorId()));
}
}- Every path. The scope narrows one query, and Qorekit puts it in every read and write: lists, records by id, searches, filters, relations, lookups, rollups, sub-records, exports, quick filters, files, changes and deletes. Sub-records also need a parent the person may see; Qorekit adds that itself.
- OR. A person's scopes from all their roles add up: Qorekit joins them with OR, and all wins over the rest. Add each alternative with
orWhere…; a scope that adds nothing reaches nothing. ScopeQueryknows where fields keep their values:orWhereCreatedBy(),orWhereHolds($field, $ids)for a user or relation field with one value or several,assigningFields()(user fields that assign the record) andfieldsPointingAt($entity).teams()finds a person's teams, the teams below them and the people in them.remember()keeps what the scope works out for the rest of the request.- When the plugin is off, a role that gives its scope keeps it, and it counts as own. So a scope should reach the person's own records, and say so in
covers(). - Scopes of one entity come from a
RecordScopeSource:scopesFor($entity)lists an entity's,find($key)gives one by its key,name:id(rule:12). Roles offer them for that entity only; given on another, or no longer found, they count as own. A source reads its scopes once a request itself. orWhereMatches($filter)adds a filter in the filter language, for the person (me,{me.region}), on the entity's own fields; check it when it is saved withcheckFilter($entity, $filter, ownFieldsOnly: true).
A check on changes
A RecordGuard sees every change to a record before it is saved, after the values are validated: records created and changed, through the interface, the API, imports and changes to several at once. check(RecordChange $change) gets the record as it was (before(), null while it is created) and as it will be (after()), who changes it, and two helpers: matches($rule, after: true) for a rule on the record's own fields, and people($field) for the people a user field holds before or after (created_by for whoever created it). Throw NotAllowed::because($message) to refuse the change: the person gets the message, and nothing is saved. Qorekit Pro's separation of duties is one.
cause() says why the change is made when nobody made it by hand: a RecordCause with its kind (automation), key, label and depth (below).
Values set before saving
A RecordFiller sets values on a record about to be created or changed, through the same doors as a check: the interface, the API, imports, changes to several records at once, and plugins' own writes. fill(RecordChange $change) returns field key => value, as the API takes values; the keys it leaves out keep what was sent. It runs before the values are checked, so what it sets is checked like the rest (a wrong value refuses the change), the record's field permissions do not stop it, and the checks (RecordGuard) see the result. Each filler sees what the ones before it set. A filler must not write records itself; work that does belongs after the change (onRecord).
A filler may return a FilledValue instead of a bare value, to say who set it: new FilledValue($value, 'Automation: Price deals'). When the value is refused, the person is told who set it ("… (set by Automation: Price deals)").
Writing records, and why
records() gives the Records of code hooks: find, list, create and update by entity key, with every right, through the same checks, fillers and events as any other change; ids($entity, $filter, $limit, $parentId) finds records by a filter on the entity's own fields (matching() with their values, in an order), trash() moves one to the trash, and comment() adds a comment: written by the cause when there is one ("Automation: …"), else by the person the work is done for. validate($entity, $values, $id) checks values as create() (no $id) or update() would, writing nothing, and returns what would stop the save by field key ("" for the record as a whole), or []; fillers do not run. $actingFor names the person the work is done for: checks look at them, and created_by and updated_by name them. $cause says why, when no person made the change by hand:
php
use Qorekit\Sdk\Records\RecordCause;
$cause = RecordCause::automation((string) $rule->id, $rule->name);
$context->records(actingFor: $event->context->actorId, cause: $cause)
->update('tickets', $event->recordId, ['status' => 'assigned']);The change's events carry the cause in $event->context->cause. Its depth counts the links of a chain ($cause->then(...) for the next one), so that rules set off by rules can be stopped before they loop.
Email
mailer() sends email from the queue, with the installation's mail settings, in Qorekit's own layout: send($address, $message, $locale), or sendToUser($userId, $message) in the person's language (false when they cannot get email). A MailMessage has a subject, a heading, and either plain lines (escaped) or ready html for the body, plus perhaps an action button and a note. HTML is the plugin's to escape; text is its plain-text version (the HTML without its tags, when not given). replyTo is where replies go (the sender stays the installation's, so the email is not taken for spam), and attachments are files of Qorekit's by the id a file field's value gives (new MailAttachment($fileId)), read when the email goes out. Whether the recipient may have a file is the plugin's to judge.
php
use Qorekit\Sdk\Mail\MailMessage;
$context->mailer()->sendToUser($ownerId, new MailMessage(
subject: 'Ticket #12 closed',
heading: 'Your ticket is closed',
lines: ['Thanks for waiting.'],
action: ['label' => 'Open the ticket', 'url' => url('/records/tickets/12')],
));Conditions, formulas and messages
For rules people write about records, a plugin judges a record's values against a filter with matches() (check the filter first with checkFilter($entity, $filter, ownFieldsOnly: true)); a choice, a person or a related record is compared with in, as in lists. checkExpression() checks a formula of the entity's fields and variables and says what it gives (number, text, date, datetime, boolean); evaluateExpression() works it out for a record's values and gives the value as the API takes it.
notify() puts a message under a person's bell, linked to the record, if they may see the record (and have not turned such notifications off). To fill a message with a record's values, read the record as that person sees it with recordAs(), so that fields they may not see stay out. A text everyone with access reads, such as a comment, takes visibleToAll(): fields some role may not see, and sensitive fields, are left out.
Scheduled work
task('key', fn (float $seconds) => …) runs every minute from Qorekit's scheduled work (cron, or page requests without it), with the seconds the work may take, shared between the plugins' tasks. It waits while maintenance mode pauses work; one that fails is reported, and the others go on. Without cron it runs after page requests only: cronWorks() says whether cron runs it, so that work due at a time can tell administrators it may come late.
Field permissions
A FieldPolicy says which fields of an entity a person's roles may only read (FieldPolicy::READ) or not see (FieldPolicy::HIDDEN): restricted($entity, $roleIds) gets the roles that reach the entity and answers by field id. Qorekit does the rest on every path: a hidden field leaves records, lists, exports, filters, sorts, searches and imports, computed fields that read it go with it, and writes to read-only and hidden fields are refused. RecordAccess::restrictedFields($entity) gives the result by field key.
Administration scopes
An AdminScopeSource gives administration permissions for parts of the system: scopes($roleIds) answers, by permission key, a list of parts as ['type' => AdminScopeSource::MODULE, 'id' => 3] (or ENTITY, CHOICE_LIST). Only the permissions and types in AdminScopeSource::SCOPES count, and a permission the roles have for everything needs none. Qorekit checks every part on every path; without a source, nothing is given for parts.
Two-step verification
A TwoFactorPolicy says whether a person's roles require two-step verification: requiredFor($roleIds) answers the days they have to set it up (0: at once), or null. Qorekit counts the days from when it first applied to the person, reminds them meanwhile, and after that keeps them to setting it up.
A TwoFactorChannel sends codes another way than the app and email, such as text messages: its key() (lowercase letters, such as sms), its label() by language, destination($userId) (where codes would go, partly hidden; null when the person cannot be reached, and then they cannot choose it) and send($userId, $code, $minutes). Qorekit makes the codes, checks them, and limits tries and resends.
A policy that also implements TwoFactorMethodPolicy says which ways the roles accept: methodsFor($roleIds) answers a list of keys (totp, email, a channel's), or null for any. Qorekit offers people only those, and asks someone who uses another to choose again.
TextMessages lets people keep a mobile number on their account: available() says whether messages can be sent now, and send($phone, $text, $userId) sends one to a number in E.164 form (+14155550132). Without it, accounts have no mobile number. people()->mobiles($userIds) gives the numbers people verified, by id.
Tables of its own
Migrations in the plugin's migrations/ folder run when the plugin is turned on and after each update. Name its tables plg_{vendor}_{name}_… and its migration files after the plugin, so they never meet another's. Delete with its data rolls them back. Records of entities are read and written through Qorekit, never with SQL of the plugin's own.
The interface
The plugin's script runs before the application starts, and finds Qorekit's own Vue and components as window.Qorekit:
js
const { vue, ui, registerFieldInput, registerFieldDisplay, registerFormulaFunction } = window.Qorekit
// The editor of the "rating" kind: gets modelValue, field, id, invalid,
// describedBy and labelledBy, and emits update:modelValue.
registerFieldInput('rating', vue.defineComponent({ /* … */ }))
// How a value reads in lists, on record pages and in exports.
registerFieldDisplay('rating', (value, { locale, config }) => '★'.repeat(value))
// STARS() in the browser, for forms.
registerFormulaFunction('STARS', { call: ([value, most]) => '★'.repeat(value) })A page the plugin added with adminPage() gets its content from the component registered for it; Qorekit puts it under the page's title. api calls Qorekit's API as the person using the page, the plugin's endpoints included:
js
const { vue, api, registerAdminPage } = window.Qorekit
registerAdminPage('acme/desk', 'note', vue.defineComponent({
setup() {
const note = vue.ref(null)
vue.onMounted(async () => {
note.value = (await api.get('plugins/acme/desk/api/note')).data
})
// …
},
}))components.FilterBuilder is Qorekit's filter builder, for a page that keeps a filter: give it an entity's meta (api.get('meta/entities/deals')) as entity, ownOnly for the entity's own fields, and the builder's state as its v-model. filters.fromFilter() turns a filter into that state, filters.toFilter() back, and filters.emptyGroup() starts an empty one.
confirm() asks before something hard to take back, in Qorekit's own window rather than the browser's: if (await confirm({ title: 'Delete the note?', confirmLabel: 'Delete', tone: 'danger' })) …. It takes a description too, and typeToConfirm for what is gravest (the yes waits until that is typed).
suggestKey(name) makes a key from a name as Qorekit does for fields and entities: suggestKey('Café opening date') is cafe_opening_date.
components.FieldValueInput edits one value of a field as a record form does: a choice list, a person or record to pick, the calendar. Give it the field (from the entity's meta) as field and its entity's key as entityKey; its v-model is the value as the API takes it, but people and records come as {id, label}, so that their names show again (the API takes those too).
components.RichTextInput is the rich text editor of rich text fields: give it an id, and its v-model is the HTML. With extended it also has tables, alignment, text colours from a palette and highlights, as Pro's emails do. Through a template ref, its insert(text) puts text where the cursor is. The server cleans what it keeps (PluginContext::cleanHtml(), or emailHtml() for the extended editor's HTML in an email); the editor does not.
components.AppIcon shows an icon of Qorekit's icon set by its name (name, and a color if you like), as menus show entities' icons; components.IconPicker picks one by searching the set, with v-model:icon and v-model:color.
registerDesignPanel('permissions', component, title) adds a tab to the Permissions tab of an entity's design mode, beside Qorekit's own record permissions; the component gets entity, the entity's meta. registerFieldDialogTab(key, title, component, types) adds a tab to the dialogs that add and change a field, for administrators: the component gets entityKey, fieldKey (null while the field is being added) and fieldType, and may expose save(fieldKey), which the dialog calls once the field is saved. With types (['phone']), the tab shows for fields of those types only. registerRolePanel(section, component) adds a part to the role page, for administrators: in 'administration', after Qorekit's administration permissions, or in 'security', a section that shows when a plugin adds to it. The component gets roleKey, given (the administration permissions ticked for everything), administrator and editable, and may expose save(), called once the role is saved.
registerRecordActions(component) adds buttons beside Qorekit's own on a record (its page and its panel), while it is not in the trash; the component gets entity and record (as the API reads it, with _meta.can), and emits changed once it has changed the record, so that Qorekit reads it again, and leave to go back from the record to its list (or its parent record). registerBulkActions(component) adds buttons to the bar of a list's chosen rows: the component gets entity and ids, and emits changed. registerValueActions(component) adds small buttons after a field's value, in lists and on records: the component gets field, value, entityKey, recordId and mode ('cell' or 'full'), shows nothing for fields it does not act on, and stops its clicks from reaching the list's row. registerRecordPanel(component) adds a part under a record's fields, before its comments, while it is not being edited: the component gets entity and record, and shows nothing when it has nothing to show. registerBackupPanel(component) adds a part to Administration › System › Backups, under Back up now, for super admins: the component gets backups (the list as the page shows it) and emits changed once it has started or deleted backups. registerBackupActions(component) adds buttons to a row of that list, before Qorekit's own: the component gets backup. registerBackupRestore(component) adds a part to a backup's Restore window, above the command that restores it on the server: the component gets backup and emits close.
Use the components of ui (QButton, QInput…) so the plugin looks like the rest of Qorekit, and the theme's CSS variables (--qk-color-primary…) in its style, in a stylesheet of its own (frontend.style): Qorekit's CSS holds only the classes Qorekit uses. Give its classes a prefix of its own. The script can be written by hand, as in the example, or built with a bundler into one classic script that leaves vue and @qorekit/ui out and reads them from window.Qorekit.vue and window.Qorekit.ui (with Vite: build.lib with formats: ['iife'], both as external, and output.globals naming Qorekit.vue and Qorekit.ui).
window.Qorekit is there only when some plugin is on: an installation without plugins does not load it.
When a plugin fails
A plugin that throws while starting, or stops the request with a fatal error, is turned off and its message shown in Administration › Plugins. Safe mode starts Qorekit with every plugin off.