Skip to Content
Self-HostingBuildpad Engine

Run the Studio on the Buildpad Engine

On the Buildpad Engine backend, you run two servers:

  • The Buildpad Engine serves the data API, the sign-in, the files, the hooks and cron jobs, and the MCP server. It holds the database.
  • The DaaS Studio is the administration interface. Its server serves the pages. The browser that shows the Studio sends its API calls directly to the Engine.

This page tells you how to connect the Studio to an Engine. It also summarizes the Engine settings that these docs refer to. The Engine ships with its own configuration reference, its README and its .env.example file, which list every setting.

A Studio that you switch from Supabase to the Engine does not take its data with it. To move a project’s data, see Move to the Buildpad Engine.

How the Studio Works on This Backend

  • One sign-in page. The Studio’s sign-in page signs in at the Engine. The Studio keeps the Engine session in browser cookies that its scripts can read, as the Supabase session is kept on the other backend.
  • Sign-out ends the session of that browser only. Other people who use the same account stay signed in.
  • Sign-in from the Buildpad platform. When the platform opens the Studio with a one-time sign-in link, the browser exchanges the link with the Engine (POST /api/auth/sso). The Engine needs BUILDPAD_SSO_SECRET for this. The Studio holds no secret for it.
  • What the Studio’s server still serves: the pages, the browser configuration (/api/env), the file proxy (/api/assets/:id, which forwards to the Engine), and the health routes.
  • What the Studio does not do on this backend: it runs no Supabase migrations at start, it ignores DEFAULT_ADMIN_PASSWORD, and it starts no hooks and no cron scheduler. The Engine does these things. The Studio answers the file-based extension endpoints (/api/ext/*) with 501 EXTENSIONS_UNAVAILABLE.

Connect the Studio to an Engine

Start the Engine

Start the Engine with its database and its Valkey, and run its seed step, which creates the Engine’s administrator. Set at least JWT_SECRET on the Engine. See Engine Settings. To run the Engine in your own AWS account, see Deploy the Buildpad Engine on AWS.

Set the Studio’s variables

Set these in the Studio’s environment:

DAAS_BACKEND=go DAAS_GO_URL=https://engine.example.com HOST_ORIGIN=https://studio.example.com

Restart the Studio

The Studio reads these variables when its server starts. A change needs a restart, not a new build. One Studio image serves both backends.

Check the setup

Send GET /api/server/health to the Studio. See Check the Setup.

Sign in

Open the Studio and sign in with an account of the Engine, for example the administrator that the seed step created.

Studio Settings

VariableDescription
DAAS_BACKENDSet to go for the Buildpad Engine backend. Any other value, or no value, selects the Supabase backend
DAAS_GO_URLThe Engine’s origin, for example https://engine.example.com: a scheme, a host and an optional port, with no path. The browser calls this origin, so it must be reachable from the browser. If it holds no usable origin, the Studio uses NEXT_PUBLIC_SUPABASE_URL when that holds one
HOST_ORIGINThe Studio’s own public origin. Set it behind a reverse proxy
NEXT_PUBLIC_PARENT_ORIGINThe one window that can theme the Studio when another page frames it
CORS_*The cross-origin rules for the Studio’s own routes. On this backend the Studio reads them from the environment only. The Engine has its own rules for the API
DAAS_BROWSER_TRACINGtrue makes one user action one trace, across the Studio and the Engine. Each call then carries a traceparent header. The Engine allows traceparent and tracestate by default. If you changed the Engine’s allowed headers, add both first
WEB_CONCURRENCYThe number of Studio worker processes. See Docker

When DAAS_GO_URL holds a usable origin, the Studio reads no Supabase variable. The Studio needs no Supabase project on this backend.

Check the Setup

GET /api/server/health on the Studio answers with no credentials:

{ "status": "ok", "backend": { "mode": "go", "engine_origin": "https://engine.example.com", "origin_variable": "DAAS_GO_URL" } }
  • backend.mode is go on this backend and supabase on the other one.
  • If no variable holds a usable Engine origin, engine_origin is empty, and backend.problem names the variable to correct.
  • On this backend, the route checks nothing outside the container. It does not call the Engine. The Studio stays healthy during an Engine outage. For liveness, use /api/server/ping.

The Engine has its own health route, /api/server/health on the Engine’s URL. It reports the database, the cache and the file storage.

Engine Settings

The Engine reads its settings from environment variables when it starts. Many settings stop the Engine at start if their value is not valid. The Engine then exits with code 78 and logs a line that names the variable, without its value.

These are the settings that these docs refer to:

AreaEngine settingsSee
Database and cacheDATABASE_URL (or DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD), VALKEY_URL—
Access tokensJWT_SECRET, AUTH_ACCESS_TOKEN_EXPIRES (default 1h), AUTH_REFRESH_TOKEN_EXPIRES (default 24h)Authentication
Refresh token reuse windowAUTH_REFRESH_TOKEN_REUSE_INTERVAL, 0 to 60 seconds (default 10)Refreshing the token
Multi-factor authenticationMFA_ENCRYPTION_KEY, MFA_FORCE_ENABLEDMulti-Factor Authentication
Sign-in from the Buildpad platformBUILDPAD_SSO_SECRET—
Sign-in with XAppHub or another identity providerAUTH_EXTERNAL_ISSUERS, and for each provider AUTH_EXTERNAL_<NAME>_ISSUER, AUTH_EXTERNAL_<NAME>_JWKS_URL, AUTH_EXTERNAL_<NAME>_ALGORITHMS, AUTH_EXTERNAL_<NAME>_TRUST_EMAILSign in with XAppHub
Password reset mailAUTH_PASSWORD_RESET_URL, MAIL_DRIVER, MAIL_SMTP_*Password Reset
File storageSTORAGE_DRIVER, STORAGE_LOCAL_PATH, AWS_S3_BUCKET, AWS_REGION, STORAGE_S3_ROOTFile Storage
File import from a URLSTORAGE_IMPORT_ALLOWED_NETWORKSFiles
Image transformsASSETS_TRANSFORM_*Image Transforms
Cron jobsCRON_ENABLEDCron Jobs
HooksRUNTIME_EXTENSIONS_ENABLEDExtensions
Stored codeEXTENSION_ALLOWED_DOMAINS, RUNTIME_ENV_WHITELIST_*, RUNTIME_PUBLIC_* and the other prefixesRuntime Env Whitelisting
Cross-origin rulesCORS_ALLOWED_ORIGINS, CORS_ALLOW_CREDENTIALSCORS

Set JWT_SECRET on every Engine. Without a signing key, the Engine signs tokens with a built-in development key, and anyone who knows that key can make a token.

For XAppHub, the Engine’s settings are:

AUTH_EXTERNAL_ISSUERS=my-apps AUTH_EXTERNAL_MY_APPS_ISSUER=https://xapphub.ai AUTH_EXTERNAL_MY_APPS_JWKS_URL=https://xapphub.ai/api/idp/jwks AUTH_EXTERNAL_MY_APPS_ALGORITHMS=RS256 AUTH_EXTERNAL_MY_APPS_TRUST_EMAIL=true

<NAME> is the provider name in upper case, with - written as _. The Engine needs outbound HTTPS to the key address. TRUST_EMAIL=true makes an email address in the provider’s tokens count as verified when the token does not say so. Set it only for a provider that verifies its addresses.

File Storage

The Engine keeps files on its own disk (STORAGE_DRIVER=local, the default) or in Amazon S3 (STORAGE_DRIVER=s3). For the full S3 setup, with an EC2 role, an access key, MinIO or Cloudflare R2, see File Storage on S3.

For S3 storage, set:

VariableValue
STORAGE_DRIVERs3
AWS_S3_BUCKETThe bucket name
AWS_REGIONThe bucket’s region. On EC2, the Engine can read the instance’s region when this is empty
STORAGE_S3_ROOTThe key prefix that holds every object of this Engine, for example projects/<project id>/. Many Engines can share one bucket

On EC2, do not set access keys. The Engine uses the instance role. When the Engine runs in a container, the instance needs an IMDSv2 hop limit of 2.

Give the role these S3 actions on the Engine’s prefix only: s3:GetObject, s3:PutObject, s3:DeleteObject, s3:AbortMultipartUpload and s3:PutObjectTagging on arn:aws:s3:::<bucket>/<root>*, and s3:ListBucket on the bucket with an s3:prefix condition for <root>*.

  • The bucket stays private. Clients never reach it. Downloads, signed URLs and signed uploads go through the Engine. The bucket needs no CORS rule.
  • Versioning. In a versioned bucket, a delete leaves an earlier version until a lifecycle rule removes it. The Engine marks every image transform result with the object tag buildpad-kind=rendition, so a lifecycle rule can remove their old versions sooner.
  • An unreachable bucket does not stop the Engine. The Engine starts, logs a storage.probe record, and its health route reports the storage as down.

Cross-Origin Rules

The browser that shows the Studio calls the Engine from the Studio’s origin. The Engine’s cross-origin rules must accept that origin.

The Engine applies the rules of the host to every request. An administrator of the host sets them in the Studio under Settings → CORS, or with the Engine’s CORS_ALLOWED_ORIGINS. Inside a tenant, the Studio does not show Settings → CORS, and the Engine refuses a change to the cross-origin rules with 403. See CORS.