ObjectStackObjectStack

Environment

Environment protocol schemas

Environment-Per-Database Isolation Protocol

Each environment (dev/test/prod/sandbox) owns a physically isolated

database. The Control Plane stores all environment metadata; environment

DBs contain only business data rows.

Split of concerns:

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

sys_package_installation (with env_id), sys_metadata (with env_id),

sys_database_credential, sys_environment_member.

  • Data Plane: each environment DB contains only business objects

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

See docs/adr/0002-environment-database-isolation.md for the full

rationale.

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

TypeScript Usage

import { DatabaseCredential, DatabaseCredentialStatus, DatabaseDriver, Environment, EnvironmentDatabase, EnvironmentMember, EnvironmentRole, EnvironmentStatus, EnvironmentType, ProvisionEnvironmentRequest, ProvisionEnvironmentResponse, ProvisionOrganizationRequest, ProvisionOrganizationResponse } from '@objectstack/spec/cloud';
import type { DatabaseCredential, DatabaseCredentialStatus, DatabaseDriver, Environment, EnvironmentDatabase, EnvironmentMember, EnvironmentRole, EnvironmentStatus, EnvironmentType, ProvisionEnvironmentRequest, ProvisionEnvironmentResponse, ProvisionOrganizationRequest, ProvisionOrganizationResponse } from '@objectstack/spec/cloud';

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

DatabaseCredential

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)

DatabaseCredentialStatus

Credential lifecycle status

Allowed Values

  • active
  • rotating
  • revoked


Environment

Properties

PropertyTypeRequiredDescription
idstringUUID of the environment (stable, never reused)
organizationIdstringOrganization that owns this environment
slugstringSlug unique per organization (snake_case/kebab-case allowed)
displayNamestringDisplay name shown in Studio and APIs
envTypeEnum<'production' | 'sandbox' | 'development' | 'test' | 'staging' | 'preview' | 'trial'>Environment classification
isDefaultbooleanWhether this is the default environment for the organization
regionstringoptionalRegion where the physical database is deployed (e.g. us-east-1)
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

EnvironmentDatabase

Properties

PropertyTypeRequiredDescription
idstringUUID of the environment-database mapping
environmentIdstringEnvironment this database backs (UNIQUE)
databaseNamestringPhysical database name (immutable)
databaseUrlstringFull connection URL
driverstringData-plane driver key (e.g. turso, libsql, sqlite, postgres)
regionstringRegion of the physical database
storageLimitMbintegerStorage quota in megabytes
provisionedAtstringProvisioning timestamp (ISO-8601)
lastAccessedAtstringoptionalLast successful access timestamp
metadataRecord<string, any>optionalFree-form metadata

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 type (prod/sandbox/dev/test/…)

Allowed Values

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

ProvisionEnvironmentRequest

Properties

PropertyTypeRequiredDescription
organizationIdstringOrganization that will own the new environment
slugstringSlug unique per organization
displayNamestringoptionalDisplay name (defaults to slug)
envTypeEnum<'production' | 'sandbox' | 'development' | 'test' | 'staging' | 'preview' | 'trial'>Environment type
regionstringoptionalRegion preference for the physical DB
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

ProvisionEnvironmentResponse

Properties

PropertyTypeRequiredDescription
environmentObjectProvisioned environment (includes database addressing)
credentialObjectFreshly-minted credential for the environment DB
durationMsnumberTotal provisioning duration in milliseconds
warningsstring[]optionalNon-fatal warnings emitted during provisioning

ProvisionOrganizationRequest

Properties

PropertyTypeRequiredDescription
organizationIdstringOrganization being bootstrapped
defaultEnvTypeEnum<'production' | 'sandbox' | 'development' | 'test' | 'staging' | 'preview' | 'trial'>Env type for the default environment
defaultEnvSlugstringSlug for the default environment
regionstringoptionalRegion preference
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
defaultEnvironmentObjectDefault environment that was created
durationMsnumberTotal bootstrap duration in milliseconds
warningsstring[]optionalNon-fatal warnings

On this page