Concept · 13 min

Workspaces, instances and hosting

Archestack is usually rolled out by an implementation partner: a company that builds an app on Archestack and delivers it to its clients. This page follows one example throughout: a software company that has built an app for testing laboratories, the companies that analyse food, water and materials for other businesses. The app follows every sample from intake to certificate, and the software company rolls it out to one laboratory after another. Each laboratory is a client, and each has business customers of its own: the food producers, water companies and manufacturers that send in samples.

Three words carry the rest of this page:

  • Client: a company the partner delivers the app to. In this example, each laboratory.
  • Workspace: the isolated environment a client works in, with its own app, its own data and its own members. Its technical name is tenant.
  • Instance: one running copy of Archestack. It runs one workspace or many.

In short: a client works in a workspace, and a workspace runs on an instance. The sections below cover what a workspace is and what keeps it apart, the two ways to host your clients' workspaces, how a laboratory lets its own customers in, how Archestack itself is hosted, and how a new version of your app reaches every client.

What a workspace is

A workspace is the isolated environment one client works in. It holds the whole app, the data that app works on and the people allowed in, and it is closed off from every other workspace. Every laboratory gets one.

Tenant is the technical name for the same thing. The screens say workspace; the API and the code say tenant, the word behind single-tenant and multi-tenant hosting. Workspace and tenant are not two layers, and neither contains the other: one laboratory has one workspace, and the API calls that workspace a tenant. This page says workspace throughout.

Archestack instance
One backend for every workspace
API
Background jobs
Shared by every workspace on the instance
Accounts Module Store Platform version
Token for Lab 1
Token for Lab 2
Lab 1
Workspace (tenant)
Core
Runtime
Members and roles
Lab 2
Workspace (tenant)
Core
Runtime
Members and roles
Two laboratories on one instance. One backend, the API and the background jobs, serves both workspaces; each workspace has its own Core, Runtime and members, and a request's token opens one workspace only.

What is inside a workspace

A workspace holds three things:

  • Core, a PostgreSQL database that holds the app itself: business entities, pages, business events, script modules, scheduled events, PDF templates, packages, releases, test suites, Data API endpoints and API keys, MCP tokens, branding, app layouts, translations, settings, mail accounts and the outbox, and the preferences and notifications of its users. Passwords and other secrets stored here are encrypted, and API keys and MCP tokens are kept only as a hash.
  • Runtime, a PostgreSQL database that holds the business data: the tables and the rows in them, in this example the samples, analyses, results, certificates of analysis and invoices. The Schema Designer shows its structure exactly as it is in the database.
  • Members: the people allowed in, each with a role in this workspace. Invitations are sent per workspace.

Because the app lives in Core, two laboratories running the same app each have a copy of their own. A change made in one workspace stays there until you ship it to the others, which is what packages are for. A workspace can also have an address of its own, such as peeters.labapp.example.com. On Archestack's hosting it can be served on a domain of the company's own as well, such as app.peeters.be: an administrator adds it on the builder's Domains page and proves it with one DNS record, and the certificate follows by itself.

What keeps workspaces apart

The API and the background jobs serve every workspace on the instance, but each request and each scheduled job works for exactly one workspace:

  • Separate databases. One workspace's pages, business entities and queries cannot reach another workspace's tables.
  • One token, one workspace. Every signed-in request carries a signed token that names exactly one workspace, and only that workspace's databases are opened.
  • No fallback. A token naming a workspace that does not exist or is suspended is refused, never redirected to another workspace.
  • Keys that name their workspace. API keys and MCP tokens carry the name of the workspace they belong to and work only there.
  • Jobs that stay in their workspace. Scheduled jobs run inside the workspace that owns them.
  • Backups per workspace. Backups, restores and exports cover one workspace's Core and Runtime, so one client's data can be restored or exported without touching another's.

One account, a role per workspace

Accounts belong to the instance, memberships belong to the workspace. A person has one account on an instance, with one email address and one password, and can be a member of several workspaces with a different role in each. The partner's consultants can be admin in the workspace of every laboratory they look after, while a laboratory's staff are members of their own workspace only.

Someone who belongs to several workspaces switches between them from the avatar menu. The switch issues a new token, which opens the other workspace and only that one. Removing someone from one workspace leaves their other memberships alone.

Signing in with Microsoft

A workspace can let its people sign in with their work account from the company's own Microsoft Entra ID (Azure AD) directory. An admin or owner registers an app in that directory and enters its directory ID, application ID and a client secret under Sign in with Microsoft on the builder's Workspace page. The page shows the redirect URI to register and checks the three with Microsoft before it saves them. The workspace's sign-in page then offers Sign in with Microsoft; on an address that names no workspace, such as the builder's, people type their workspace's address first.

  • Who gets in. Members and invited people sign in the first time by their email address and after that by their Microsoft account. The workspace can also let in anyone in the directory, who then gets an account and a chosen role at their first sign-in, and can limit sign-in to the company's own email domains.
  • This workspace only. A directory vouches for people in the workspaces that chose it. A Microsoft sign-in opens this workspace, and any other that uses the same directory, never the account's other workspaces: for those, people sign in with their password.
  • Leaving the company. Microsoft is asked again after a day by default (anything from an hour to the workspace's session duration), so someone disabled in Entra ID has lost access by then. Turning Microsoft sign-in off, or moving to another directory, ends the sessions it started.

Passwords keep working beside it. Microsoft sign-in needs the built-in identity provider, and a customer organisation signs in through the app it belongs to.

Signing in with Google and other providers

The same Workspace page can add Google, and any OpenID Connect provider such as Okta, Auth0, Keycloak, Authentik or OneLogin, under Sign in with Google and other providers. For each one, an admin or owner creates a web application client at the provider with the redirect URI the page shows, then enters its client ID and secret, and for an OpenID Connect provider its issuer address. The page reads the provider's discovery document and checks the client with the provider before it saves. Each provider becomes a button on the sign-in page, both in the builder and in the published app.

  • The same rules as Microsoft. Members and invited people sign in the first time by their email address and after that by their account at the provider. Creating accounts for newcomers, the role they get, allowed email domains and how often the provider is asked again are set per provider.
  • Verified addresses only. An address the provider has not verified never matches an account and never creates one. A company's own directory that does not report verification can be marked as trusted; Google never can. With Google, set the allowed domains to your company's, or anyone with a Google account could get in where accounts are created.
  • This workspace only. A sign-in through a provider opens this workspace, and any other that uses the same client at the same provider, never the account's other workspaces. Removing a provider, switching it off or changing its client ends the sessions it started.

Roles from the provider, and when it is down

A provider can also bring people's roles along. Switch on Take people's roles from the provider, say where they are (the access token, the ID token or the userinfo endpoint) and which claim holds them, such as role, groups or scope. Then either map each value onto one of the workspace's roles, or copy every value as a role of its own under a prefix, such as carya:Dealer, and give those roles access to pages like any other role. The values people were sent at recent sign-ins are listed, so they can be mapped with a click.

  • Read at every sign-in, and while people work. With a refresh token from the provider (usually the offline_access scope), the roles are read again every few minutes while someone works, so a change at the provider arrives without signing in again.
  • Only its own roles. A role the provider granted goes when it stops giving it. A role an administrator granted in Archestack is never touched, and a provider can never grant admin or owner. With Only let in people it gives at least one of these roles, someone without one is kept out, and someone who loses the last one is signed out.
  • Public clients and APIs. A provider that registered Archestack as a public client gives no secret: tick Public client. When the provider wants to know which API the token is for, enter it as the Resource.

Everyone a provider signs in also has an Archestack account, so the provider being down does not stop the workspace:

  • Nothing changes while it cannot be reached. Everyone keeps the roles they last had. With Keep people working, someone due to sign in at the provider again stays signed in, checked again every hour, until it answers. Nobody new gets in until it is back.
  • Passwords as a fallback. The Archestack passwords of people a provider signed in can work always, never, or only while the provider cannot be reached. In that last case they sign in with the provider as usual, and during an outage with their Archestack password, which someone without one sets through Forgot password. Once the provider is back, that session ends within the hour and they sign in with the provider again.

The main workspace and new ones

Every instance creates a main workspace the first time it starts. A company that needs a single environment just works in it. A partner with many clients keeps the main workspace for its own team and creates one workspace per client. A new workspace is created in about a second and starts empty.

Purging or deleting a workspace

Someone with the owner role in a workspace can empty it or remove it, on the builder's Workspace page under Configuration or from VS Code. Either one asks for the workspace's address to be typed back first.

  • Purge starts the workspace again empty, as it was when it was created: Core and Runtime are made anew and its files are deleted. Its address, domains, backups and members with their roles stay, so restoring a backup brings the content back.
  • Delete removes the workspace for good: its databases, files and backups, the customer organisations inside it, and the accounts of members who belong to no other workspace. Its address becomes free for anyone to take.

The main workspace can be neither purged nor deleted, and a customer organisation has no databases of its own to purge.

Dividing a workspace

Two features divide one workspace further. Neither creates a new environment: both work inside the workspace, on its own Core and Runtime.

  • Business units divide it by team, so each team sees the pages and business entities that concern it. They do not hide data rows, so they are not a separation.
  • Customer organisations divide it by customer. They are not workspaces of their own. They live inside the laboratory's workspace, not next to it, with no databases of their own: the laboratory's customers use the laboratory's app, what they enter lands in the laboratory's Runtime, and each customer sees only its own rows. More on this below.

Two ways to host your clients

Every workspace runs on an instance: one running copy of Archestack, with its API, its background jobs and a PostgreSQL server that holds the databases of its workspaces. The workspaces on one instance share the instance around them, not each other's databases:

Each workspace has its own Shared by the workspaces on one instance
The appCore: pages, business entities, script modules, settings and the restThe platform version. An upgrade reaches every workspace at once.
The dataRuntime: its tables and rowsThe PostgreSQL server that holds the databases
PeopleMembers, roles and invitationsThe accounts: one email address and one password per person
Background workIts scheduled jobs, which run inside the workspaceThe background jobs and the job scheduler
ModulesThe packages it has installedThe Module Store catalogue

The workspaces on one instance also share its capacity: processor, memory and database connections. For every client, the partner decides whether its workspace gets an instance of its own or shares one with the workspaces of other clients. In both models every client has a workspace of its own with its own Core and Runtime. What differs is how many workspaces share an instance, and so what they share with each other.

One workspace per instance (single-tenant)

Lab 1
Archestack
API
Background jobs
Core
Runtime
Lab 2
Archestack
API
Background jobs
Core
Runtime
Lab 3
Archestack
API
Background jobs
Core
Runtime
One workspace per instance: every laboratory has an Archestack of its own, running only its workspace.

Each laboratory gets an instance of its own, with its own API and background jobs, and a workspace with its own Core and Runtime databases. It suits large clients, clients that decide where their data lives and clients that choose when to upgrade. The partner can run these instances, or install one in the laboratory's own cloud account or data centre.

Advantages

  • The strongest separation there is. Nothing is shared with other clients, not even the platform.
  • Capacity of its own. A busy laboratory never slows down another, and its instance is sized for it alone.
  • Upgrades on the client's schedule. Each instance moves to a new platform version when it suits that client.
  • The data lives where the client wants it: a region, a cloud account or their own servers.
  • A clean ending. Hand the instance over, or shut it down.

Disadvantages

  • Every instance has to be run: servers, certificates, backups, monitoring and upgrades, once per client.
  • A new version of your app has to be imported into every instance separately.
  • Your own staff need an account on every instance they work on.
  • The smallest client still needs a full instance.

Several workspaces per instance (multi-tenant)

Archestack
API
Background jobs
Lab 1
Core
Runtime
Lab 2
Core
Runtime
Lab 3
Core
Runtime
Several workspaces per instance: one Archestack serves every laboratory, each in a workspace with its own Core and Runtime.

One instance serves many laboratories. Each laboratory is still a workspace of its own, with its own Core and Runtime databases and, if you like, its own address such as peeters.labapp.example.com. The instance's administrators create a new workspace in about a second.

Advantages

  • Each client still has its own databases, its own backups and its own version of the app, adapted to how they work.
  • Adding a client takes about a second, and a quiet client costs almost nothing: a workspace nobody uses holds no database connections.
  • One instance to run, secure and upgrade.
  • Your consultants use one account and switch between clients from the avatar menu.

Disadvantages

  • Every client moves to a new platform version at the same moment.
  • Clients share the instance's capacity, so size it for all of them together. An instance with more than a few dozen workspaces in use at the same time also needs PostgreSQL's connection limit raised above its default of 100.
  • A new version of your app is still installed workspace by workspace, from the instance's Module Store or a ZIP.

Side by side

One workspace per instance Several workspaces per instance
Own databasesYes, on their own serverYes, on a shared server
CapacityPer clientShared
Platform versionPer clientShared
Where the data can liveAnywhere, including the client's own cloudWherever the partner runs the instance
Shipping a new app versionA ZIP imported into each client's workspaceInstalled into each client's workspace, from the instance's Module Store or a ZIP
Adding a clientA new instanceAbout a second
Cost per clientHigherLow

Mixing is normal: small laboratories share an instance, a large laboratory group gets one of its own, and the same packages ship to both. Development, test, acceptance and production are each a workspace of their own. Put development, test and acceptance on one instance and production on an instance of its own, so a platform upgrade reaches acceptance before it reaches production.

Customers inside a client's app

A laboratory has customers of its own: food producers, water companies and manufacturers that send in samples. They want to register the samples they send in and follow each one while the laboratory works on it. One food producer must never see another producer's samples; the laboratory sees them all. The laboratory can let these customers into the app the partner built for it, as customer organisations.

The partner builds the app and chooses the hosting, with either of the two models above. The laboratory does not notice which one, and neither do its customers. The laboratory then invites its customers, or lets them sign themselves up.

A customer organisation is not a workspace and has no databases of its own. It lives inside the laboratory's workspace: the app belongs to that workspace, each customer has members of its own, and everything they enter lands in the laboratory's Runtime database, stamped with the company that wrote it. Each customer sees only its own rows, the laboratory sees all of them, and a customer can have sub-units of its own: a food group, for example, with a sub-unit for each of its factories and one for each production line in a factory. Each unit sees its own rows and those of the units below it. Customers use the app as the laboratory publishes it and do not change it, and each customer's own administrator invites and removes colleagues.

Hosting infrastructure

Archestack ships as one container image that runs both the API and the background jobs: scheduled events, outgoing mail, test suite runs, syncs with other systems and the nightly backups. It scales horizontally: run more copies of the same image behind a load balancer as the number of users grows. The copies coordinate through PostgreSQL, so the scheduled work is shared between them and every job runs once.

Load balancer
Archestack image
API
Background jobs
Archestack image
API
Background jobs
PG
One image, as many identical copies as the load needs, over one PostgreSQL.

Running more than one copy asks a few things of the infrastructure around it:

  • No sticky sessions, but WebSockets must get through. Any copy can answer any request. Live updates (grids that refresh, who else is on a page, notifications) travel over WebSockets only, so a load balancer or network that blocks them leaves the app working without live updates.
  • Shared volumes for backups and files. The backups folder and the folder that holds every workspace's files (uploads, logos, files scripts write) have to be storage every copy mounts (in Kubernetes, a ReadWriteMany volume), or each copy only sees the backups and files it wrote itself.
  • A startup probe. Copies that start together take turns preparing the databases, and with many workspaces to migrate that takes a while. Give the containers a startup probe rather than a short liveness probe.
  • Rate limits are per copy. Three copies allow three times as many requests per caller as one.
  • Behind PgBouncer in transaction mode, point ConnectionStrings__Cluster straight at PostgreSQL: the copies talk to each other over a PostgreSQL connection that has to stay open.

Next to the containers, an instance needs PostgreSQL 16 and a proxy that handles TLS. It runs wherever containers run: a single server, a cloud account or a Kubernetes cluster. The partner can host it, Archestack can host it, or it can run in the client's own infrastructure. For Kubernetes there is a Helm chart, and an instance can also live under a path of a hostname another application owns, such as apps.example.com/archestack/.

A new instance has no users. The first person to open it creates the first administrator, so set it up before it can be reached from the internet.

Capacity and sizing has the measured figures: how many people and workspaces an instance serves, and the servers it needs for them. Hosting on AKS installs an instance on Azure Kubernetes Service and keeps it on the newest release by itself; Hosting with Docker does the same on one server.

Getting your app to every client

When every client has its own workspace, each new version of the app has to travel. A package is how it travels:

  1. Put the tables, business entities, pages, business events, script modules, PDF templates, scheduled events, test suites and app layouts of your app in a package, and export it as a ZIP.
  2. Import it into the client's workspace. The import shows a plan first, then applies the table changes to the workspace's Runtime database.
  3. Run the package's test suites there. Tests run in a separate sandbox database and never touch the client's data.
  4. Publish a release. That is the moment the new pages reach the client's users. A workspace that has never published a release shows its pages as soon as the import finishes.

Some things are set up in each workspace rather than shipped: Data API endpoints and keys, translations, users, roles, business units, branding, mail accounts and connections to other systems. Anything marked public arrives private, so installing a package can never put a client's data on the internet by itself.

On one instance, a module published to the Module Store as public is visible to, and can be installed by, every workspace on it, which saves the export and import. A private listing is visible only to the workspace that published it. Between instances, packages travel as ZIP files.

When the app lives in a git repository, Deployment strategy describes how a pipeline tests it and deploys it to each environment without downtime.

Gotchas

  • A platform upgrade reaches every workspace on the instance at once. A client that has to stay on a version needs an instance of its own.
  • A new workspace starts empty. Install your packages into it and invite its people; memberships do not carry over from other workspaces.

Where this goes next

Packages covers building and exporting the package you ship to each workspace. The Data API guide shows how a service connects to one workspace with an API key, and Database Backups covers the per-workspace backups.