ObjectStackObjectStack

Environment

Environment protocol schemas

Environment Protocol (runtime container)

An Environment is the runtime container of an organization's data.

It owns a physically isolated database, a canonical hostname, a plan/quota

tier, and per-environment RBAC. An organization may own many environments

(dev/test/prod/sandbox/preview/…) — exactly one is marked is_default.

This file defines the Control-Plane schemas for the sys_environment,

sys_environment_credential and sys_environment_member tables. Business

data lives in each environment's own database — those data-plane DBs hold

no system tables.

See ADR-0006 v4: sys_environment was renamed to sys_environment; the

separate dev-workspace Project concept introduced in v3 has been

dropped — user code is now modelled as an implicit sys_package with

a per-org manifest_id (see ADR-0003), so a single package + version

  • installation model serves both Marketplace apps and user projects.

Split of concerns:

  • Control Plane: sys_environment (includes physical DB addressing),

sys_package_installation (with environment_id), sys_environment_credential,

sys_environment_member, sys_metadata (with environment_id).

  • Data Plane: each environment DB contains only business objects

(account, task, …). No system tables, no environment_id columns.

Source: packages/spec/src/cloud/environment.zod.ts

TypeScript Usage

import { Environment, EnvironmentCredential, EnvironmentCredentialStatus, EnvironmentDriver, EnvironmentMember, EnvironmentRole, EnvironmentStatus, EnvironmentType, EnvironmentVisibility, ProvisionEnvironmentRequest, ProvisionEnvironmentResponse, ProvisionOrganizationRequest, ProvisionOrganizationResponse } from '@objectstack/spec/cloud';
import type { Environment, EnvironmentCredential, EnvironmentCredentialStatus, EnvironmentDriver, EnvironmentMember, EnvironmentRole, EnvironmentStatus, EnvironmentType, EnvironmentVisibility, ProvisionEnvironmentRequest, ProvisionEnvironmentResponse, ProvisionOrganizationRequest, ProvisionOrganizationResponse } from '@objectstack/spec/cloud';

// Validate data
const result = Environment.parse(data);

Environment

Properties

PropertyTypeRequiredDescription
idstringUUID of the environment (stable, never reused)
organizationIdstringOrganization that owns this environment
displayNamestringDisplay name shown in Studio and APIs
isDefaultbooleanWhether this is the default environment for the organization
isSystembooleanWhether this is a system environment (platform infrastructure, not user data)
planEnum<'free' | 'starter' | 'pro' | 'enterprise' | 'custom'>Plan tier for this environment
statusEnum<'provisioning' | 'active' | 'suspended' | 'archived' | 'failed' | 'migrating'>Environment lifecycle status
createdBystringUser ID that created the environment
createdAtstringCreation timestamp (ISO-8601)
updatedAtstringLast update timestamp (ISO-8601)
databaseUrlstringoptionalFull connection URL for the environment database
databaseDriverstringoptionalData-plane driver key (turso, libsql, sqlite, memory, postgres)
storageLimitMbintegeroptionalStorage quota in megabytes
provisionedAtstringoptionalProvisioning timestamp (ISO-8601)
metadataRecord<string, any>optionalFree-form metadata
hostnamestringoptionalCanonical hostname for this environment. UNIQUE. Auto-set on creation; can be overridden for custom domains.
consoleUrlstringoptionalPre-computed admin Console URL for this environment
apiBaseUrlstringoptionalPre-computed REST API base URL for this environment
visibilityEnum<'private' | 'unlisted' | 'public'>Public exposure of this environment artifacts (private | unlisted | public).

EnvironmentCredential

Properties

PropertyTypeRequiredDescription
idstringUUID of the credential
environmentIdstringEnvironment this credential authorizes
secretCiphertextstringEncrypted auth token or secret (ciphertext)
encryptionKeyIdstringEncryption key ID used to encrypt the secret
authorizationEnum<'full_access' | 'read_only'>Authorization scope for this credential
statusEnum<'active' | 'rotating' | 'revoked'>Credential lifecycle status
createdAtstringCreation timestamp (ISO-8601)
expiresAtstringoptionalOptional expiry timestamp
revokedAtstringoptionalRevocation timestamp (if revoked)

EnvironmentCredentialStatus

Credential lifecycle status

Allowed Values

  • active
  • rotating
  • revoked


EnvironmentMember

Properties

PropertyTypeRequiredDescription
idstringUUID of the membership
environmentIdstringEnvironment this membership grants access to
userIdstringUser ID
roleEnum<'owner' | 'admin' | 'maker' | 'reader' | 'guest'>Per-environment role
invitedBystringUser ID that granted this membership
createdAtstringCreation timestamp (ISO-8601)
updatedAtstringLast update timestamp (ISO-8601)

EnvironmentRole

Per-environment role

Allowed Values

  • owner
  • admin
  • maker
  • reader
  • guest

EnvironmentStatus

Environment lifecycle status

Allowed Values

  • provisioning
  • active
  • suspended
  • archived
  • failed
  • migrating

EnvironmentType

Environment categorical tag (prod/sandbox/dev/test/…)

Allowed Values

  • production
  • sandbox
  • development
  • test
  • staging
  • preview
  • trial

EnvironmentVisibility

Public exposure of this environment artifacts (private | unlisted | public).

Allowed Values

  • private
  • unlisted
  • public

ProvisionEnvironmentRequest

Properties

PropertyTypeRequiredDescription
organizationIdstringOrganization that will own the new environment
displayNamestringDisplay name shown in Studio and APIs
driverstringoptionalDriver key (defaults to provisioning service config)
planEnum<'free' | 'starter' | 'pro' | 'enterprise' | 'custom'>optionalPlan tier
storageLimitMbintegeroptionalStorage quota in megabytes
isDefaultbooleanoptionalMark as the organization default environment
createdBystringUser ID that initiated the provisioning
metadataRecord<string, any>optionalFree-form metadata
hostnamestringoptionalCanonical hostname (auto-generated if omitted)
templateIdstringoptionalStarter package to seed into the new environment on first provisioning (e.g. "crm", "todo"). Defaults to "blank".
visibilityEnum<'private' | 'unlisted' | 'public'>Public exposure of this environment artifacts. private = auth required for every read (default); unlisted = downloadable when commit id is known; public = listed and freely downloadable via /pub/v1/environments/:id/*.

ProvisionEnvironmentResponse

Properties

PropertyTypeRequiredDescription
environment{ id: string; organizationId: string; displayName: string; isDefault: boolean; … }Provisioned environment (includes database addressing)
credential{ id: string; environmentId: string; secretCiphertext: string; encryptionKeyId: string; … }Freshly-minted credential for the environment DB
durationMsnumberTotal provisioning duration in milliseconds
warningsstring[]optionalNon-fatal warnings emitted during provisioning

ProvisionOrganizationRequest

Properties

PropertyTypeRequiredDescription
organizationIdstringOrganization being bootstrapped
defaultEnvironmentDisplayNamestringDisplay name for the default environment
driverstringoptionalDriver key
planEnum<'free' | 'starter' | 'pro' | 'enterprise' | 'custom'>optionalPlan tier
storageLimitMbintegeroptionalStorage quota in megabytes
createdBystringUser ID that initiated provisioning
metadataRecord<string, any>optionalFree-form metadata

ProvisionOrganizationResponse

Properties

PropertyTypeRequiredDescription
defaultEnvironment{ environment: object; credential: object; durationMs: number; warnings?: string[] }Default environment that was created
durationMsnumberTotal bootstrap duration in milliseconds
warningsstring[]optionalNon-fatal warnings

On this page