Apps
Apps are pluggable, installable units that extend a Foir project with credentials, operations, lifecycle hooks, custom UI, and inbound or outbound data flows. They’re the single concept the platform uses for every third-party or first-party extension.
Two ways in. Browse the marketplace and install from a listing, or paste the URL of a manifest you or someone else published. The listing is the shorter path and the safer one; the URL is how a developer installs an app that is not listed, including their own while they build it.
Several things you might expect to find as apps are not apps here, because the platform absorbed them. Redirects are lookups; translation is built into the AI surface; search is full-text and semantic over your own records; image transforms are part of the media API. None of those needs installing.
Overview
An app is described by a single JSON manifest at a URL the developer chooses. The manifest declares what the app contributes. Installing an app means choosing it, from the marketplace or by pasting its URL, reviewing what will be added to your project, and deciding which of your project’s models each source or sink type the app declares lands in.
Choose the app → Review → Install → Connect its account → Choose from what the account holds → EnabledAn app that connects to an account installs held, with nothing mapped yet, because where its data lands is chosen from what that account actually holds. Once you have connected it and made those choices, the app is live: its operations are callable, its hooks fire on the lifecycle events it subscribed to, and any UI it contributes appears in the console.
What an app can contribute
| Capability | What it means |
|---|---|
| Credentials | A credential slot the app needs (OAuth, API key, SSH key, shared secret, or none). |
| Operations | Named operations the platform calls to run the app’s logic. |
| Hooks | Lifecycle subscriptions that fire app operations when records change. |
| UI placements | Iframes embedded in the console: full-page dashboards, main-editor tabs, sidebars, or field-level editors. A full page acts as the user viewing it; see Embedded app consoles. |
| Inbound webhooks | An endpoint that receives webhooks from an external service. |
| Source types | Inbound data shapes the app can deliver. Mapped onto a project model at install. |
| Sink contracts | Outbound data shapes the app needs. Mapped onto a project model at install. |
Apps never own models. Models always live in your project’s foir.config.ts. Apps describe abstract shapes they produce or consume; mapping each shape onto a concrete project model is your decision at install time.
Shapes an app can take
Not a catalogue — these are the four shapes the manifest supports, so you can recognise which one the thing you want to build is.
| Shape | What the manifest declares | What that gets you |
|---|---|---|
| Source | A source type plus an inbound webhook | An external system owns the data; the app brings it in and maps it onto one of your models |
| Sink | A sink contract plus hooks | Your project owns the data; the app pushes it out on every change |
| Surface | UI placements plus operations | A dashboard, an editor tab or a sidebar panel that works against your records |
| Widget | One UI placement, nothing else | A static iframe replacing the default input on a field — no credentials, no backend |
The widget is the friction floor: a manifest at any URL, an HTML file at any URL, no credentials to authorize. Install it by pasting one URL.
How apps differ from project-written extensions
Both apps and project-written code use the same platform primitives — operations, hooks, schedules, grants. The difference is lifecycle and ownership:
| Project-written | App | |
|---|---|---|
| Where it’s declared | foir.config.ts operations / hooks arrays | App manifest at a URL |
| When it gets pushed | foir push reads your config | Someone in the console clicks Install; CLI reads apps.<name> block of your config |
| Who owns the URL | Your project’s repo | The app developer’s deployment |
| Update mechanism | Edit code, foir push | foir apps update <name> (or Check for updates on the app’s page in the console) |
| Reusability | One project | Same manifest installs into many projects |
Use project-written operations for one-off project logic. Build an app when something will be reused across projects, and ship it with a manifest. See Building an App.
The manifest
When you install an app, you provide a URL pointing at its manifest. The manifest is a JSON document the app developer authored; you’ll typically read its contents from the install preview rather than fetch it directly. Required fields are name and version, plus middleware.url (an https URL) once the manifest declares operations or an inbound webhook; everything else is optional.
The manifest URL must be https and must be one the internet can reach. Foir fetches it server-side, so it refuses any URL that resolves to a private or internal address, and it refuses a redirect to one. The same applies to the app’s middleware URL, which Foir calls whenever it dispatches one of the app’s operations. See Endpoints must be public.
{
"name": "redirector",
"version": "1.2.0",
"metadata": {
"displayName": "Cloudflare Redirector",
"description": "Sync redirect records to a Cloudflare Worker + KV.",
"icon": "redirect",
"author": "Bob's Country Bunker"
},
"credentials": {
"strategy": "API_KEY",
"schema": {
"type": "object",
"properties": {
"cloudflareApiToken": { "type": "string" },
"cloudflareAccountId": { "type": "string" }
},
"required": ["cloudflareApiToken", "cloudflareAccountId"]
}
},
"middleware": { "url": "https://redirector.example.com" },
"settings_schema": {
"type": "object",
"properties": {
"cloudflareZone": { "type": "string" },
"workerName": { "type": "string" }
}
},
"sinks": {
"redirect": {
"label": "Redirect",
"natural_key": "source",
"fields": {
"source": { "type": "text", "semantic": "source-url", "required": true },
"target": { "type": "text", "semantic": "target-url", "required": true },
"status": { "type": "select", "semantic": "status-code", "required": true },
"priority": { "type": "integer", "semantic": "priority", "required": false }
}
}
},
"operations": [
{
"key": "redirect-sync",
"name": "Sync Redirects to Edge",
"endpoint": "/operations/redirect-sync",
"grants": ["appsecrets:read", "records:read:$redirect", "status:write"]
}
],
"hooks": [
{
"key": "sync-on-create",
"event": "RECORD_CREATED",
"filter": { "sinkContract": "redirect" },
"operation": "redirect-sync"
}
]
}Things to notice when you read a manifest before installing it:
- Placeholders like
$redirectreference theredirectsink contract from the same manifest. They’re resolved to your actual project model key when you mapredirectto a model during install. - Grants carry model placeholders too:
records:read:$redirectbecomesrecords:read:redirect-rulesif you map the sink to aredirect-rulesmodel. The list of grants tells you exactly what the app can read or write — the install preview surfaces this. - Reserved operation keys start with
__.__uninstallruns when you remove the app (so the app can clean up external resources);__validate_credentialsruns when you submit credentials so bad values are rejected before they’re saved;__discoverreads the connected account and reports what it holds, so setup can offer the account’s own fields.__discoverruns while the app is held, which is why it may declare onlyappsecrets:readandappconfig:read: it reaches the account and nothing of your project’s. run_after_install: truemeans an operation runs once automatically after install — typically used for one-time setup like provisioning a Cloudflare Worker.runs_on_mapped_sources: truemeans an operation works on whichever of its sources you map. Declining an optional source then leaves that source’s grants out of the operation, and the operation keeps running for the rest. Without it, declining a source drops every operation whose grants name it, because such an operation may not cope with fewer grants than it declared. A sync that covers several sources at once, such as products, collections and users, is the usual case.
For the project-side declaration shape (what goes in foir.config.ts), see Defining Apps.
Storage the app keeps
Some sources are storage the app writes itself (provision_only): nothing syncs in from an outside system, and the app keeps rows there for its own features, such as a shopper’s saved items or a request to hear when a size is back in stock. The install preview shows these as App-owned.
Storage can be optional, like any source. Optional storage the app recommends ("recommended": true) starts ticked in the guided setup; the rest starts unticked, as a feature you have not turned on. A log the app answers a store’s privacy requests from is the usual recommended case. You can still untick it, and declining it drops the operations that write to it, as declining any optional source does. recommended is only for optional storage: a manifest that sets it on a required source, or on a source synced from the account, is refused, because whether a synced source starts ticked is for the app’s discovery of that account to say.
Storage can also say who owns each row (owner):
"saved_item": {
"label": "Saved item",
"natural_key": "itemKey",
"provision_only": true,
"owner": "STORAGE_OWNER_USER",
"fields": { "itemKey": { "type": "text" }, "productId": { "type": "text" } }
}owner | What it means for the model you map it onto |
|---|---|
STORAGE_OWNER_USER | Each row belongs to one user. Only that user, and your project, can read it. |
STORAGE_OWNER_ORGANIZATION | Each row belongs to one organisation of your project. |
STORAGE_OWNER_PROJECT | Every row belongs to the project. |
| (absent) | The app says nothing, and any model will do. |
When a source declares an owner, the model has to be owned the same way. The guided setup creates it that way, and mapping the source onto a model owned at another level is refused, at install, on a remap and on an update, naming both. This is what keeps a list that is personal to a user personal: a project-owned model’s records start public, so the same rows there would be readable with your project’s publishable key. An app that has declared an owner for a source cannot later change it to another, because the rows it already wrote belong to the first.
A field can also say the app counts or groups its records by it ("queryable": true), as an app keeping stock alerts counts them by variant. The guided setup creates that field indexed, which is what lets the app ask Foir for the count instead of reading every row. It changes nothing about who can read the field. On a model of your own, the app’s count is refused, naming the field, until you mark it indexed in the model’s schema.
An app writing a user’s row names that user with records:attribute:<model> (see Writing for a user from an operation).
Features
An app can group what it does beyond keeping data in step into features you turn on and off as a whole in its setup, such as a store’s preorders, back-in-stock alerts or saved items. Each feature names the storage it keeps, and that storage exists only while the feature is on: nothing is created until you turn it on, and the setup lists what it will create before you save.
"features": [
{
"key": "back-in-stock",
"title": "Back in stock",
"description": "Shoppers ask to hear when a sold-out variant is back.",
"setting": "backInStockEnabled",
"sources": ["back_in_stock_request"]
},
{
"key": "saved-items",
"title": "Saved items",
"description": "Signed-in shoppers keep a list of their own.",
"sources": ["saved_item"]
}
]A feature can also name a setting, when the app itself has to know it is on: for example because being on changes what the app asks the other system for. The setup writes that setting as the feature’s switch, and when turning a feature on asks for more access, the finished setup offers to connect the account again so it can be granted. A feature without a setting is on while its storage is mapped.
How the feature behaves once it is on, such as a preorder’s deposit, is the app’s own to configure, usually in its console. The setup only turns it on and off.
A manifest is refused when a feature:
- names storage that is not optional, since turning the feature off declines it;
- names storage another feature already keeps, since turning one off would take the other’s rows;
- names a setting that
settings_schemadoes not declare as a boolean; - names neither a setting nor any storage, since turning it on would change nothing.
An install set up before its app declared a feature keeps the storage it already maps, even while that feature reads as off. Turning the feature off in the setup is what declines it.
The notification category a feature sends under
A project that has notification categories takes every notification under one of them, so that what a user chose about a category is honored. A feature that sends notifications says so, so that it is given a category the project has and nobody types a key:
{
"key": "back-in-stock",
"title": "Back in stock",
"setting": "backInStockEnabled",
"sources": ["back_in_stock_request"],
"notificationCategory": {
"setting": "notificationCategory",
"key": "back_in_stock",
"name": "Back in stock alerts",
"description": "When something you asked about is back.",
"optIn": false
}
}setting is the string in settings_schema that holds the category’s key: your app reads it and names that key on every send. key, name and description are the category the app proposes, and optIn says a user has to opt in before anything is sent under it.
In the setup, a feature that is on shows a Notification category choice: the project’s categories, and Create for the app’s own. Choosing Create makes the category in the project and writes its key to the setting. It is sent under once it is released, like any category.
On a project with no categories there is nothing to choose. Any category is taken on a send there, so the setting is given the key the app proposes and no category is made. When the project makes its first category, the one each feature sends under is made beside it and released with it, so the day the project starts taking notifications only under its categories, its apps have theirs. See a project’s first category.
The platform holds the setting to that. While a feature is on at a running install, saving its settings is refused when the setting names a category the project does not have, a retired one, or nothing. The refusal names the feature. A key an install already kept before its app could say what it sends under may stay on a project with no categories: users may have opted out under it.
A manifest is refused when a feature’s notificationCategory:
- names a setting that
settings_schemadoes not declare as a string, or the setting that identifies the app’s account; - proposes a key that is not lowercase letters, digits and
_, starting with a letter, or proposes no name; - shares its setting with another feature that proposes a different category.
The notification category a feature keeps consent in
A feature that carries what a user chose to or from another system, such as a store’s marketing consent, sends nothing itself. It reads and writes a user’s consent on one channel. That is consent only in a category the user opts in to on that channel: nothing is sent to them there until they say yes. The feature says where it keeps consent, so that it is given such a category and nobody types a key:
{
"key": "marketing-consent",
"title": "Marketing consent",
"setting": "marketingConsentEnabled",
"consentCategory": {
"setting": "marketingConsentCategory",
"key": "marketing",
"name": "Marketing",
"description": "News and offers from the store, by email.",
"channel": "email"
}
}setting is the string in settings_schema that holds the category’s key: your app reads it. channel is the channel whose consent the feature keeps: email, push or in_app. key, name and description are the category the app proposes, which is always one a user opts in to, on every channel.
In the setup, a feature that is on shows a Consent category choice: the project’s categories a user opts in to on that channel, and Create for the app’s own where the project has no category of its key. Choosing Create makes the category, opt-in on every channel, and writes its key to the setting.
On a project with no categories there is nothing to choose. The setting is given the key the app proposes and no category is made. When the project makes its first category, the one each feature keeps consent in is made beside it as opt-in on every channel, whoever else sends under it.
The platform holds the setting to that. While a feature is on at a running install, saving its settings is refused when the setting names nothing, a category the project does not have, a retired one, or one a user does not opt in to on the feature’s channel. A channel that is on by default is not opt-in, and neither is one a user cannot turn off. The refusal names the feature and says which of those it is. Installing with the feature on, changing the install’s mapping and releasing a held install are asked the same. A key an install already kept before its app could say where it keeps consent may stay on a project with no categories.
An update that first says it applies. Where the install’s setting already names a category a user opts in to on the channel, nothing changes. Where it names nothing, and the project has the proposed key as such a category or has no categories at all, the update writes the proposed key and says so in its review. Anywhere else the review says what is wrong and leaves the setting as it is: choose the category in the setup afterwards. Until then the app’s page says so under Needs attention, and saving the install’s settings is refused.
A manifest is refused when a feature’s consentCategory:
- names a setting that
settings_schemadoes not declare as a string, or the setting that identifies the app’s account; - names a setting that a feature’s
notificationCategoryuses, since the setup offers one choice for a setting; - proposes a key that is not lowercase letters, digits and
_, starting with a letter, or proposes no name; - names a channel other than
email,pushorin_app; - shares its setting with another feature that proposes a different category or keeps another channel’s consent.
Users of the app’s own system
Some apps connect a system that has users of its own: a store, a booking system, a membership platform. Those users are also your project’s users, and the app has to know which is which. It never finds one by email. It names each by who they are at its own system, such as a store’s user number, which is also the subject of their sign-in with that system.
A manifest says so with userSignIn:
"userSignIn": {
"description": "Your store's users, by their user number."
}In the setup you then choose which of your sign-ins those users come through: one OAuth or OIDC sign-in at the level the app is installed at. The choice is yours, never the app’s or the platform’s guess, because pairing the wrong sign-in would attach one person’s data to another. It belongs to the install as a whole, so it does not depend on any storage being on.
A project kept in foir.config.ts says the same thing with apps.<name>.userSignIn: see The user sign-in.
Three things work through the pairing, and none can be on without it:
- Storage that names its users by identity (
identityon a source): each row is one user’s own record, found by the user rather than a key. - A feature that finds users through it (
"userSignIn": trueon a feature), such as keeping a user’s marketing consent the same in both systems. The setup asks for the sign-in at the feature’s switch and will not save the feature on without one. - An operation that asks who a user is at the app’s system (the
identities:readgrant). It is registered only while a sign-in is paired.
The app reads the pairing in both directions and through no other sign-in: which of your users holds an identity, and which identities one of your users holds. A user who has never signed in that way holds none, and is known once they do, or once the app’s sync saves them with their email.
A manifest is refused when a source names an identity, a feature sets userSignIn, or an operation declares identities:read, and the manifest declares no userSignIn.
A key the other system lets people change
A source is keyed on its natural key, the value a record is addressed by. The most useful key is often one people can change: a product’s handle is the address a storefront routes on, and a merchant can rename it. A source keyed that way names the other system’s own id for the object as the field its records are found by (lookup):
"product": {
"label": "Product",
"natural_key": "handle",
"lookup": ["shopifyId"],
"fields": {
"handle": { "type": "text", "required": true },
"shopifyId": { "type": "text", "required": true }
}
}The model you map the source onto needs a lookup on the field the id maps to, so no two records carry the same id. The guided setup creates the model with it. Mapping the source onto a model without it is refused, at install, on a remap and on an update, naming the field, until you add the lookup in the model’s schema. A mapping keyed on the id itself needs no lookup, since that key never changes.
When the other system renames an object, the app’s next write under the new key is refused by that lookup, because a record already holds the object’s id. The app renames that record to the new key and writes again, so the object stays one record, and whatever references it by id still reaches it. The lookup names one to four of the source’s fields, each a required text, integer, decimal, boolean or enum.
Reading a source live
An app can offer to read a source live instead of syncing a copy of it. Foir then keeps each record and the host’s key for it (a product’s handle, say), and the host keeps the data. When a record is read, Foir calls the host for the live fields itself and returns them on the record, so nothing is copied and nothing goes stale.
Each source the app offers this for is a choice at install: Read live (the default for a new install) or Keep a copy in Foir. Keep a copy when you need to filter or sort on the host’s fields inside Foir, because a live field is not stored and cannot be filtered or sorted on. Filter on the host instead, as a storefront already does for its catalogue, or keep a copy.
The live fields appear on the mapped model as one field named for the app and the source:
No SDK equivalent: a live field is an operation answered when the record is read, not a stored field, and the data client’s manifest reports it as unclassified rather than selecting it, so the typed per-model operations do not return it. Read it over
/graphql.
query {
product(id: "prod_123") {
title
shopifyProduct { price available }
}
}Live answers are shared across callers for the time the app sets (a minute unless it says otherwise), which is what keeps a host’s rate limit affordable. When the host cannot be reached, the live field returns an error and the rest of the record is served.
The live field is an operation, keyed <app>.<source> (shopify.product above), so reading it takes operations:execute:shopify.product or the wider operations:execute. An admin key or a member that holds either reads it. A storefront’s publishable or server key reads it for a visitor once what the key gives names it, as baselineGrants: ['operations:execute:shopify.product'].
From the CLI, name the choice on the source’s mapping: mode: 'reference' reads live and mode: 'sync' keeps a copy. Leave it out and a new install reads live wherever the app offers it, and a push never changes an existing install’s choice.
An app offers a source live by adding a reference to it in the manifest:
"sources": {
"product": {
"label": "Product",
"natural_key": "handle",
"fields": { "handle": { "type": "text" }, "title": { "type": "text" } },
"reference": {
"key_field": "handle",
"fields": { "price": { "type": "number" }, "available": { "type": "boolean" } },
"endpoint": "https://{{credential.shopDomain}}/admin/api/2025-07/graphql.json",
"hosts": ["*.myshopify.com"],
"request": {
"method": "POST",
"headers": { "X-Shopify-Access-Token": "{{credential.accessToken}}" },
"body_template": "{\"query\": \"query($h: String!) { productByIdentifier(identifier: {handle: $h}) { priceRangeV2 { minVariantPrice { amount } } totalInventory } }\", \"variables\": {\"h\": \"{{parent.handle}}\"}}"
},
"response_transform": "{price: (.data.productByIdentifier.priceRangeV2.minVariantPrice.amount | tonumber), available: (.data.productByIdentifier.totalInventory > 0)}",
"cache_max_age_seconds": 60
}
}
}The read is made by Foir, not by the app’s service, so there is nothing of yours to host or keep up for it:
{{parent.<key_field>}}is the record’s key,{{credential.<field>}}is the install’s own credential, read from the vault when the call is made, and{{context.<value>}}is the call’s context. Nothing a caller sends reaches the request, and no project secret can be named.- The endpoint’s host may be filled from the credential (a store’s own domain), and only within
hosts: a host outside them, or one that resolves to a private address, is refused before anything is sent. - The host is sent only what the request writes: no Foir token. Values are escaped for where they stand, and a GraphQL body passes them as
variables.
Installing an app
Credentials come before configuration. That order is the whole point, and it is the opposite of what a config-first flow would do: an app cannot show you a Shopify store’s own product fields until it can talk to that store, so asking you to map fields first means asking you to map fields you cannot see.
From the marketplace
- Open Apps → Install app in the console, which shows the marketplace, and choose an app
- Review what it will add: operations, hooks, UI placements, the grants each operation carries, and the source and sink types it brings
- Install into the project, or the organisation, you are standing in. The app is installed held — it has nothing to authenticate with yet, so nothing dispatches to it and no webhook reaches it
- Authorize credentials — see Authorizing credentials
- The app reads its own remote schema, and you choose from what is actually there: which fields, which optional sources, locales, settings
- Models are provisioned for the sources you kept, or mapped onto models you already have
- The app is enabled, and starts work
Steps 3 to 7 are one screen you can leave and come back to. Nothing dispatches to the app’s middleware at any point before step 7.
Either everything installs or nothing does. There’s no partially-installed state.
Installing from a URL
Choose Install from a manifest URL on the marketplace picker instead of a listing, and paste the URL. Everything after that is identical — the listing is discovery, not machinery.
Held, and what releases it
An app whose manifest asks for credentials installs held: enabled is false, operation dispatch is refused (except its __discover, so setup can read the account), and inbound webhooks for it are dropped rather than delivered. That is not an error state and there is nothing to repair. Finishing configuration enables it; so does foir apps enable <name>.
Before Authorize, the setup screen asks for what connecting needs: the settings the app’s schema requires, and the one that names the account it connects to, such as a Shopify store’s domain. They are saved to the install, which is also how the account’s own deliveries, a store’s privacy requests among them, find it. Once the app is connected, that account setting is fixed, because the credentials are that account’s: to connect a different store, uninstall the app and install it again. After discovery, the setup screen lists the settings the app suggests from what the account holds. A ticked one is saved with the setup, and one you had already chosen starts unticked, so saving setup never overwrites your choice silently.
A held install needs nothing mapped. A project with no models at all can install an app whose sources are required: the setup screen creates or picks the model for each one once it can see the account. Enabling is where the mappings have to be complete. Until every source and sink the app needs is mapped, enabling is refused, and the refusal names the first one that is not. An optional source you declined is not missing.
An app that declares no credentials has nothing to wait for and installs running.
Operations declared run_after_install: true do not fire while an app is held, and they are not quietly skipped either — they run at the moment it is enabled, exactly once.
Where an install sits
An install sits at one level: the project, or one organization. Install while standing in the project and every organization uses it. Install while standing in an organization and that organization, and everything beneath it, uses its own. The marketplace asks which level before it installs.
- Each organization can connect its own account. Two organizations can each install the same app with different credentials, a store each. Neither can read the other’s credentials, settings or status.
- Beneath an install, you use it. An organization with no install of its own is served its nearest ancestor’s, else the project’s. It sees that install, marked as inherited, and cannot change it: mappings, settings, credentials, enabling, updates, a manual trigger and uninstalling all happen at the level the install sits at. To use a different account, install the app in that organization. Its install replaces the inherited one there and beneath it.
- The app acts at its install’s level. Whatever level starts a run, the app reads, writes and reports its status at the install’s level. A run started beneath the install, by a user or an event in a descendant organization, can read but not write.
- Events reach the served install. An organization’s events reach the one install it is served, and each install has its own inbound webhook address naming its level, so a vendor’s events land on the install they belong to.
- An organization that may not operate has read-only installs. While it is suspended or pending deletion, its installs can be read but not installed, changed, triggered or removed, and their credentials cannot be written.
- Uninstalling removes one level’s install. Other levels’ installs of the same app, and their credentials, are untouched.
From the CLI
Declare the app in foir.config.ts:
apps: {
redirector: {
source: 'https://redirector.example.com/manifest.json',
settings: { cloudflareZone: 'bobscountrybunker.com', workerName: 'foir-redirects-bcb' },
mappings: {
sinks: {
redirect: {
toModel: 'redirect',
naturalKey: 'sourcePattern',
fields: {
source: 'sourcePattern',
target: 'targetPattern',
status: 'statusCode',
priority: 'priority',
},
},
},
},
},
},Then foir push. The CLI fetches the manifest, validates your mappings, and installs.
For ad-hoc installs without writing config, use foir apps install with inline mapping flags — see CLI Commands.
Authorizing credentials
After install, credentials still need to be written. They’re never carried in foir.config.ts — secrets stay out of repos.
OAuth apps
- From the app’s detail page, click Set up, then Authorize
- The platform redirects you through the app’s OAuth flow
- After consent, the app records its credentials and you’re returned to the console
API-key apps
- From the app’s detail page, open its Credentials section
- Fill the form (the fields are driven by the manifest’s
credentials.schema) - Click Save credentials
If the app declares __validate_credentials, the platform tests your credentials before persisting them. Bad credentials are rejected at submit time with the error returned by the app — you never end up with a saved-but-broken credential slot.
Updating an app
Apps update via an explicit flow. The platform never silently re-fetches manifests in the background.
From the console
- From the app’s detail page, click Check for updates
- Review it. The review answers two questions apart.
- What changes. Each change says whether it may stop something that works:
- Safe changes apply when you click Apply.
- Confirm changes may stop something: an operation loses a grant, a hook is removed, a setting’s held value no longer fits.
- Rejected changes block the update (a mapped sink was removed, say; clear the mapping first).
- What the app gains. Everything the new version lets the app do that it cannot do today, each named: a grant an operation is given, everything a new operation arrives holding, a hook that starts running an operation, an inbound route the app starts to receive on.
- What changes. Each change says whether it may stop something that works:
- If the app gains anything, tick I accept what the app gains. Apply waits for it.
- Click Apply.
Nothing in a manifest changes without a line in the review.
From the CLI
# Show the review without applying
foir apps update redirector --dry-run
# Apply
foir apps update redirectorAn update with any rejected change is blocked. Resolve it (clear a mapping, say) before the update can proceed.
When an update lets the app do more
An update that gives the app something is never applied in the run that first shows it. The review prints what the app gains and a code that stands for exactly those gains:
$ foir apps update shopify
[safe] version: version "1.4.0" → "1.5.0"
What the app gains:
operation "sync" is given users:read.all
new operation "purge" arrives holding records:delete:order
Error: this update lets the app do more, so nothing was applied. Read what the app gains, then apply it with: foir apps update shopify --accept-gains 9f2c…Run it again with --accept-gains <code> to apply. The rule is the same at a terminal and in a pipeline: there is no prompt, and a pipeline pins the code somebody reviewed. If anything about what the app gains has changed since, the code no longer matches, nothing is applied, and the review is printed again with its new code. --force does not stand in for it.
What an app gains is measured against what its installed operations hold, with the models you mapped written in. Narrowing a grant gains nothing. You also have to hold what you give: an update that gives an operation a grant you do not hold yourself is refused, naming it.
An update that only takes away, or only changes how the app is described, asks for no acceptance.
When an update changes a setting’s shape
A new version can drop a key from one of its settings, reshape one, or remove one. Where your install holds a value the new version would refuse, the review says so, naming the setting, and applying the update repairs it:
- a key the setting no longer has is dropped, and the rest of the value is kept;
- a value that still does not fit is cleared, so the app’s default applies;
- a setting the app no longer has is dropped.
Each is a line to confirm, and the repair is recorded in the app’s history. A version that changes nothing about the settings you hold adds nothing to confirm.
When an update asks for a user sign-in
An update can be what makes an app’s users come through a sign-in: the new manifest declares userSignIn where the installed one did not, or makes a feature you have on find its users through it. The update is where the app starts asking, so it is where you answer:
- In the console, the review shows the sign-in choice. While something you have on works through it, Apply waits for a choice.
- From the CLI, name it:
foir apps update shopify --user-sign-in shopify.
An update that needs a sign-in and is given none is refused, and says which feature needs it: choose the sign-in, or turn that feature off and update. An install that already pairs a sign-in is not asked, and keeps it. If a new manifest stops declaring a user sign-in, the review says the pairing is removed with the update (--no-user-sign-in from the CLI).
There is an override. foir apps update --force proceeds past a rejected diff. It is there for the case where the manifest is right and the installed state is the problem, and it is deliberately not the default — everything the rejection was protecting is still broken afterwards, so use it knowing what you are stepping over.
When an update says what a feature sends under
An update can be what first says which notification category a feature sends under. The review says so, as a line to confirm, and the update applies: the choice is offered only once that version is installed.
- On a project with no categories, where the feature is on and keeps no key, applying the update writes the key the app proposes into the setting. The review says it, and the app’s history records it.
- On a project with categories, the update chooses nothing. The feature keeps what it kept, and the app’s detail page says under Needs attention that a category has to be chosen. Until it is, the feature’s sends are refused.
What changes how
| Change | Class |
|---|---|
| Added operation / hook / placement | Safe |
| Added source type / sink contract (you’ll be prompted to map after) | Safe |
| Changed metadata (description, icon, name) | Safe |
| Changed operation timeout / retry policy | Safe |
| Added or removed a feature (a removed one leaves its storage and setting as they are) | Safe |
| Changed the setting or storage a feature switches | Requires confirmation. The feature can read as off where it was on, and the setup’s next save declines what an off feature keeps |
| Removed operation | Requires confirmation — always. There is no execution-history branch: hooks and schedules still pointing at it start failing either way |
| Changed an operation’s endpoint or grants | Requires confirmation |
| Changed credential strategy (you’ll need to reauthorize) | Requires confirmation |
Changed middleware.url | Requires confirmation — every operation endpoint is rewritten to the new host, and scoped tokens will be sent there |
| Removed a hook, or a placement that does not replace a default | Requires confirmation |
| Changed a source-type field schema (type change) | Rejected |
| Removed a source type or sink contract | Rejected — always, whether or not anything maps it. Clear the mappings first |
Removed a placement with replaces_default: true | Rejected. It is not confirmable: the default it replaced is not restored by removing it |
Changed the manifest’s name | Rejected |
Uninstalling an app
From the console
- From the app’s detail page, click Uninstall
- If the app declared
__uninstall, the platform calls it first so the app can tear down external resources it created (workers, indexes, registered webhooks) - The platform removes everything the app added: operations, hooks, placements, the credential slot, the inbound webhook route
- Your models stay — the project owns them
If the app’s service is unreachable, Force Uninstall removes the platform-side state without calling __uninstall. External resources may be orphaned; the warning is recorded in the app’s event log.
From the CLI
foir apps uninstall redirector
foir apps uninstall redirector --force # skip __uninstall, remove anywayGrants
Each operation an app contributes declares the grants its calls can use, in the permission catalogue’s names. They are shown in the install preview and on the app’s detail page so you always know what an app can read or write.
| Grant | What it lets the app do |
|---|---|
appconfig:read | Read its own configuration at the install: its settings and mappings |
appsecrets:read, appsecrets:list | Read and list this app’s own stored credentials |
appsecrets:put, appsecrets:delete | Store, replace and delete this app’s own credentials (the OAuth flow writes them) |
status:write | Update the app’s status (last sync time, errors) |
records:read:<model> | Read records of a specific model |
records:write:<model> | Change records of a specific model |
records:create:<model> | Create records of a specific model |
records:delete:<model>, records:publish:<model> | Delete / publish records of a specific model |
records:attribute:<model> | Name the user a record it creates belongs to |
files:read | Read and list the project’s own files and the ones made public. A run started by a user reads that user’s |
files:write | Upload files, and change the project’s own |
files:delete | Delete the project’s own files |
files:read.all, files:write.all, files:delete.all | The same for every owner’s files, every user’s included |
users:create | Create users, such as the buyer at a guest checkout |
users:read.named | Read one user it names, by id or by their exact email address. It cannot list users |
users:read.all | Read users at its own level: one it names, and the list |
identities:read | Find which user holds an identity at the app’s own system, and which identities a user holds there, through the sign-in the install pairs. Nothing else about them |
identities:delete | Remove the identity a user has at its own system, as a privacy request asks, and the account when nothing else is theirs |
organizations:create | Make an organisation, with one of the project’s users as its first member in the role the project names for a founder. With the write of the project’s organisation settings model, the new organisation’s settings record too. It changes no organisation that is there |
organizations:delete | Schedule the deletion of the organisation a run acts in, with everything beneath it. It names no other organisation and cannot undo a deletion |
notifications:read | Read the notifications of the user a run acts for |
notifications:write.named | Notify the project’s users. An app installed at an organisation reaches only that organisation’s users |
notifications:consent | Set whether a user receives a category of the project’s notifications, on the user’s behalf |
operations:complete | Mark its own long-running operations as finished |
Apps must always name a specific model on a record grant. records:read with no model is refused: operations only see the models they explicitly listed.
Each grant stands for itself. Changing a record and creating one are two grants, so an operation that does both declares records:write:<model> and records:create:<model>. Reading its own credentials is a grant too: an operation that calls the vendor declares appsecrets:read.
Nobody gives an app what they do not hold themselves. Whoever installs an app, confirms an update of it, or maps a model to it must hold each grant that gives the app’s operations, with the model chosen for it. Otherwise the platform refuses and names the grant.
A manifest that still declares capabilities is refused, and the refusal names Operation permissions, which lists every grant, and what each name used before is written as now.
How an app reaches Foir
An installed app has two ways in, and only two:
- GraphQL on the public API, for everything it reads and writes. Each call carries the token Foir gave it: the dispatch token on an operation or hook call, or the scoped token its install’s exchange ticket minted.
- The exchange ticket,
POST /auth/exchange-ticket, the one way it obtains a session. The console issues a single-use ticket during an install (at the end of an OAuth grant, for example) and the app redeems it for a scoped token.
Foir’s own internal service credentials are not a way in. Presented at the public API they are refused, with a reason that names them.
Managing installed apps
The app’s detail page in the console shows:
- The manifest it was installed from, and the app’s health as it last reported it (auth status, last sync)
- Operations contributed, with a Trigger button for manual runs
- Hooks contributed, each with the operation it calls
- UI placements contributed
- Needs attention: what the platform sees for itself, before a run fails for it. A feature that sends notifications and keeps no category the project takes them under is named here: nothing chosen, a category the project retired, or one created and not yet released. Where the sends are still taken and the project’s next release would stop them, it says that instead, so you can choose before you release
- Set up, where mappings and settings are edited
- Turn on / Turn off
- Check for updates, which fetches the manifest again and shows what a new version changes
- Uninstall
Via the CLI
# List installed apps
foir apps list
# Get an installed app
foir apps get <name>
# Install from a manifest URL (uses inline flags for ad-hoc; foir.config.ts is the golden path)
foir apps install <manifestUrl>
# Validate a manifest without installing
foir apps validate <manifestUrl>
# Trigger an operation contributed by an app
foir apps trigger <appName> <operationKey> --data '{"key":"value"}'
# Check for updates
foir apps update <name> --dry-run
# Apply available updates
foir apps update <name>
# Uninstall (calls __uninstall first if declared)
foir apps uninstall <name>
# Force-uninstall (skip the __uninstall call)
foir apps uninstall <name> --forceThe golden path for project-owned mappings is foir push — declare apps in foir.config.ts under apps.<name> and let the CLI reconcile. Inline --source-map / --sink-map flags on foir apps install are for ad-hoc console work.
See Defining Apps and Push and Remove.
Building your own app
Apps are simple to ship: host a manifest JSON at any URL, deploy your service (if the app needs one), and share the URL. No package publish, no platform registry submission, no SDK lock-in. See Building an App for an end-to-end walkthrough.
Best practices
- Declare every operation’s grants precisely. The fewer grants an operation needs, the smaller its blast radius.
- Use
__validate_credentialsfor any app where bad credentials would silently fail later — the validate hook surfaces the error at submit time, not on the first real call. - Use
run_after_install: truefor one-time setup operations (deploy a worker, create indices). You don’t have to remember to click Trigger after install. - Use sinks for outbound, sources for inbound. Don’t model “sync to Cloudflare” as a source — the project owns the data, the app pushes it out.
- Apps don’t auto-update. The platform never re-fetches a manifest in the background. Update is always explicit, so an installed app keeps working even if the developer changes the URL or breaks the manifest.
- Keep manifests small. If something doesn’t apply (no credentials, no middleware, no inbound webhook), omit it. A widget’s manifest is six lines.
Next Steps
- Defining Apps — Project-side
foir.config.tsdeclaration - Building an App — Step-by-step guide to building and shipping an app
- Operations — Operation contract and execution modes
- Editor SDK — Build app UI placements