The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.
Cloud Apps in the platform control plane
Cloud Apps use the existing cloud API, organization identity, PostgreSQL, resource services, and deployment pipeline. The first deployment targets the dev stage and provisions new Apps.
Scope and contracts
- Place Apps in the Applications navigation group, after CI and at the same level; use the existing OIDC session and selected organization.
- Keep the CLI manifest, deployment workflow, Supervisor protocol, application authentication, and Neon project/branch capabilities.
- Store control-plane records in platform PostgreSQL and source objects in configured object storage. App databases remain on the official Neon API.
- Scope every App to a platform organization. Organization API keys authorize Apps through their existing resource permissions; resource creation still applies platform admission and organization state.
- Deploy through mstage, mbuild, and mdeploy. A platform worker owns deployment, schedule, and cleanup execution.
Implementation
CloudAppModule owns the public Nest controllers and injects persistence, platform resources, credentials, and configuration into the App engine. Existing TypeScript route handlers may remain internal to the engine while the Nest boundary supplies platform authentication and organization scope. They do not start a second control-plane server or establish a second platform identity.
The management namespace is /api/v1/:organizationId/apps. Console projections use explicit view routes in that namespace; CLI deployment routes retain their manifest and error contracts. Internal Supervisor callbacks are separately authenticated with environment-scoped credentials. HTTP and WebSocket entry points apply equivalent scope checks.
Box ownership
The platform box row owns the App relationship. Nullable app_id and
environment_id identify its App and provisioning environment; both are null for
a standalone Box. A nonunique organization/App/environment index supports several
Boxes for the same environment. Creating an App Box validates the environment in
the organization and persists ownership with the Box, before waiting for startup.
Labels and process environment variables cannot assign ownership.
erDiagram
ORGANIZATION ||--o{ APP : owns
ORGANIZATION ||--o{ BOX : owns
APP o|--o{ BOX : owns
APP ||--|{ ENVIRONMENT : contains
ENVIRONMENT o|--o{ BOX : provisions
For example, one App can own web-main, worker-main, and web-staging, while
an organization's scratch Box has no App. Environment active_box_id selects
the Box used by the existing deployment and ingress flow; it does not enumerate
ownership. Deployment box_id remains immutable execution history. Runtime
replacement changes the active selection without detaching the previous Box.
App deletion stops every owned Box. Purge deletes every owned Box before volumes; environment deletion and pause apply to all Boxes of that environment. Queries include organization, App and optional environment, and exclude destroyed Boxes.
| Model | Decision | Reason |
|---|---|---|
Nullable references on box |
Adopt | Same child-owned model as App volumes; supports standalone Boxes and many Boxes per App. |
| Environment's single Box pointer | Use for active routing only | Selecting a runtime and enumerating owned resources are separate operations. |
| App/Box join table | Reject | A Box has at most one owning App, so a many-to-many table adds no supported relationship. |
The nullable-column and check-constraint behavior follows PostgreSQL constraints and the project's pinned TypeORM 0.3.31 column mapping. Ownership uses application validation, matching App volumes: destroyed Box rows remain as history after an App is purged, so cascading App foreign keys would remove that history.
The pre-deploy migration backfills current and deployment-recorded Boxes and
synchronizes old and new active-runtime columns during rollout. The post-deploy
migration removes envs.box_id and the temporary synchronization trigger. Checks
cover multiple Boxes in one environment, independent Boxes, organization scope,
ownership persistence, active selection, migration rollback, and complete cleanup.
Organization API keys
Apps use the existing organization API keys without adding columns or indexes to api_key.
Creating an App returns its configuration and an initialization prompt without issuing a credential.
Key creation, revocation and expiry remain in the platform API Keys workflow; deleting an App does
not revoke organization keys. The App-specific key endpoints and controls are removed.
When POST /api/api-keys omits permissions, it requests all supported organization resource
permissions. Existing delegation and member-role checks still apply: a restricted caller must
request a permitted subset. Explicit permission arrays, including an empty array, retain their
meaning, and existing keys are not widened. The dashboard continues to select the permissions its
current user can delegate. The added Apps permission enum values remain available for explicit grants.
boxlite auth login stores credentials in the selected platform context. boxlite auth whoami
shows its identity, and boxlite app status --json shows the selected App and environment. Project operations select an App with --app or through
the project link. A credential can operate on multiple Apps in its organization. Management and
application ingress reject credentials from another organization, and application forwarding removes
recognized platform credentials.
Agent prompts include the organization API URL, App name and environment. Users sign in with
boxlite auth login and link the project with boxlite app init --app <name>.
Validation covers unchanged API-key table columns, permission defaults and explicit restrictions, same-organization multi-App access, cross-organization rejection, credential-free App creation and deletion, and CLI login and deployment with an explicitly selected App.
PostgreSQL repositories replace synchronous SQLite access. Platform migrations create App tables and their organization associations. Deployment allocation and idempotency are transactional. Workers poll PostgreSQL and hold renewable Redis leases while publishing each environment. Worker ownership expires or is released on shutdown, and starting an API instance never fails another instance's deployment.
Neon project creation locks the owning App row and rechecks the project reference, so environments first provisioned by different workers share one project. Project references commit before branch provisioning. Supervisor callbacks, deployment events and screenshots are persisted in PostgreSQL; workers and API replicas can read each other's results. Runtime replacement deletes the old Box, and final App purge removes the source namespace before deleting its database records.
The first healthy deployment publishes a stable preview URL for the environment. To bind an
organization-owned hostname, claim it in the Dashboard and run boxlite domain bind HOST --type app --app NAME --env ENV
for that environment. The proxy forwards HTTP and WebSocket traffic for either hostname to the
API's AppGateway. The gateway retains App access, OAuth/session and identity behavior and forwards
to a private Box tunnel. Proxy service credentials and application Authorization remain separate.
Tunnel credentials and Supervisor secrets remain server-side.
Neon keys, organization and region, platform/app OAuth, SMTP, signing/session secrets, runtime images and artifact URLs come from typed configuration. Dynamically created App credentials are persisted using platform encryption and injected into the relevant runtime. Frontend configuration contains only public values.
Reuse and trade-offs
The baseline is main 4ad1423bd1511f15a4d22f44fd3cd95a60706fe1; the feature source is bd04f20b65412a0fc3faad041edb8b52898461d0.
Existing BoxService, VolumeService, organization guards, encryption service, Redis leases and job claiming patterns provide the platform integration points. App Box creation preserves the commerce admission limit used by BoxliteBoxController. Domain bindings resolve App environment targets through the shared proxy.
The first ingress includes an API forwarding hop to preserve the existing TypeScript authentication behavior. App builds continue inside their environment Box. Independent build pools, multi-replica application serving, cross-Box release rollback and detailed Neon billing are subsequent capabilities.
The existing platform uses TypeORM 0.3.31, PostgreSQL and ioredis. PostgreSQL's row locking supports transactional queue claiming. Neon's official project API retains the current provider contract. Cloud Run CPU allocation requires an explicit hosting decision for background work; request handling alone does not provide a persistent worker.
App-owned volumes
Platform volume rows carry target_type, app_id, and environment_id.
Ordinary organization volumes use target_type = 'box' with null App references.
App volumes use target_type = 'app' and both stable references. The row records
the provisioning environment, while the App is the sharing boundary. A Box of
that App can mount the volume across environments. Other Apps and standalone
Boxes receive a permission error at the shared Box creation boundary.
Cloud App creation passes its environment as an internal BoxService option.
The volume service resolves its App and organization from PostgreSQL before
authorizing mounts. Request labels and environment variables supplied to the
public Box API grant no App ownership. App volume provisioning, listing and
cleanup query the platform volume owner directly. Runtime code uses this owner
instead of an environment-to-volume mapping table or name-based adoption.
Migration consumer checks recognize box.app_id when Box ownership is present;
the older runtime pointer remains usable until that ownership migration runs.
The pre-deploy migration adds the ownership columns, backfills existing mappings, and installs a temporary trigger for mappings written by old API instances during rollout. The post-deploy migration removes the trigger and mapping table. An existing volume claimed by multiple environments or mounted outside its App requires the conflicting mount to be removed before migration. The migration rolls back on such a conflict. Row checks enforce complete ownership fields, and the volume service checks the live App and environment at creation and mounting. This follows the platform migration lifecycle and PostgreSQL's distinction between row constraints and transactional triggers.
Validation covers migration backfill and rollback on real PostgreSQL, rollout writes, same-App mounts, denied standalone and other-App mounts, misleading public labels, and environment cleanup preserving another environment's volumes.
Validation and rollout
- Repository tests verify organization isolation, organization credential permissions, atomic deployment allocation, callbacks and worker recovery against actual production services/repositories.
- PostgreSQL integration tests use an isolated schema in the provided test database; resource/provider tests keep network effects explicit.
- Dashboard checks cover navigation, selected-organization requests and late responses after organization switching.
- API and proxy checks cover App domain routing, access decisions, application Authorization preservation and WebSocket upgrades.
- The BoxLite executable bundles the App commands. The API image includes the agent instructions and Supervisor binaries. Stage configuration checks verify required secrets and object permissions without printing secret values.
- Dev smoke creates an App, deploys a database-backed example, opens it, deploys an update, restarts the control plane, and removes its resources. Existing Box operations remain available.
An existing-data import is separate from feature integration. Migration and deployment failures retain their actual status; successful local builds do not establish a successful cloud deployment.