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_project 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 (on the metadata tables, environment_id is deprecated in favor of organization_id — ADR-0006 v4).
  • 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 { EnvironmentSchema, EnvironmentCredentialSchema, EnvironmentCredentialStatusSchema, EnvironmentDriverSchema, EnvironmentMemberSchema, EnvironmentRoleSchema, EnvironmentStatusSchema, EnvironmentTypeSchema, EnvironmentVisibilitySchema, ProvisionEnvironmentRequestSchema, ProvisionEnvironmentResponseSchema, ProvisionOrganizationRequestSchema, ProvisionOrganizationResponseSchema } 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 = EnvironmentSchema.parse(data);

Environment

Properties

PropertyTypeRequiredDescription
idstringUUID of the environment (stable, never reused)
organizationIdstringOrganization that owns this environment
displayNamestringDisplay name shown in Studio and APIs
isDefaultbooleanoptional (default: false)Whether this is the default environment for the organization
isSystembooleanoptional (default: false)Whether this is a system environment (platform infrastructure, not user data)
planstringoptional (default: "free")Plan tier for this environment
statusEnum<'provisioning' | 'active' | 'suspended' | 'archived' | 'failed' | 'migrating'>optional (default: "provisioning")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'>optional (default: "private")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'>optional (default: "full_access")Authorization scope for this credential
statusEnum<'active' | 'rotating' | 'revoked'>optional (default: "active")Credential lifecycle status
createdAtstringCreation timestamp (ISO-8601)
expiresAtstringoptionalOptional expiry timestamp
revokedAtstringoptionalRevocation timestamp (if revoked)

EnvironmentCredentialStatus

Credential lifecycle status

Allowed Values

  • active
  • rotating
  • revoked

EnvironmentDriver

Data-plane driver key (e.g. turso, libsql, sqlite, postgres)

Type: string


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)
planstringoptionalPlan 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'>optional (default: "private")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
hostnameAssignment{ requestedHostname: string; assignedHostname: string }optionalPopulated ONLY when the control plane auto-renamed the requested hostname to avoid a collision. Absent means the requested hostname was assigned unchanged — never read absence as "unknown".

Nested Shape: ProvisionEnvironmentResponse.environment

PropertyTypeRequiredDescription
idstringUUID of the environment (stable, never reused)
organizationIdstringOrganization that owns this environment
displayNamestringDisplay name shown in Studio and APIs
isDefaultbooleanoptional (default: false)Whether this is the default environment for the organization
isSystembooleanoptional (default: false)Whether this is a system environment (platform infrastructure, not user data)
planstringoptional (default: "free")Plan tier for this environment
statusEnum<'provisioning' | 'active' | 'suspended' | 'archived' | 'failed' | 'migrating'>optional (default: "provisioning")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'>optional (default: "private")Public exposure of this environment artifacts (private | unlisted | public).

Nested Shape: ProvisionEnvironmentResponse.credential

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'>optional (default: "full_access")Authorization scope for this credential
statusEnum<'active' | 'rotating' | 'revoked'>optional (default: "active")Credential lifecycle status
createdAtstringCreation timestamp (ISO-8601)
expiresAtstringoptionalOptional expiry timestamp
revokedAtstringoptionalRevocation timestamp (if revoked)

Nested Shape: ProvisionEnvironmentResponse.hostnameAssignment

PropertyTypeRequiredDescription
requestedHostnamestringHostname the caller asked for (explicitly, or as auto-derived from displayName)
assignedHostnamestringHostname actually assigned after the collision-avoiding rename; equals environment.hostname

ProvisionOrganizationRequest

Properties

PropertyTypeRequiredDescription
organizationIdstringOrganization being bootstrapped
defaultEnvironmentDisplayNamestringoptional (default: "Production")Display name for the default environment
driverstringoptionalDriver key
planstringoptionalPlan 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

Nested Shape: ProvisionOrganizationResponse.defaultEnvironment

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
hostnameAssignment{ requestedHostname: string; assignedHostname: string }optionalPopulated ONLY when the control plane auto-renamed the requested hostname to avoid a collision. Absent means the requested hostname was assigned unchanged — never read absence as "unknown".

On this page