|
| 1 | +--- |
| 2 | +title: Architecture |
| 3 | +description: How ObjectOS, the control plane, and the framework fit together. |
| 4 | +--- |
| 5 | + |
| 6 | +# Architecture |
| 7 | + |
| 8 | +ObjectOS is one of three layers in the ObjectStack platform. Customers |
| 9 | +usually deploy only ObjectOS; understanding the boundary between the |
| 10 | +three layers makes deployment, security review, and incident response |
| 11 | +easier. |
| 12 | + |
| 13 | +## The three layers |
| 14 | + |
| 15 | +```text |
| 16 | ++--------------------------+ +--------------------------+ +--------------------------+ |
| 17 | +| ObjectStack framework | | Control plane | | ObjectOS | |
| 18 | +| (npm packages, source) | -> | (authors, publishes | -> | (customer-hosted | |
| 19 | +| | | artifacts) | | runtime distribution) | |
| 20 | ++--------------------------+ +--------------------------+ +--------------------------+ |
| 21 | + runtime, plugins, projects, environments, executes artifacts, |
| 22 | + drivers, services metadata authoring, owns runtime HTTP, |
| 23 | + artifact storage business database |
| 24 | +``` |
| 25 | + |
| 26 | +- **Framework** — the open-source `@objectstack/*` packages: kernel, |
| 27 | + ObjectQL, plugins, drivers, services. Customers do not need to |
| 28 | + understand or modify framework source to operate ObjectOS. |
| 29 | +- **Control plane** — where applications are authored and where the |
| 30 | + compiled `objectstack.json` artifact is published. May be the hosted |
| 31 | + ObjectStack Cloud or a customer-operated control plane. |
| 32 | +- **ObjectOS** — the runtime container customers deploy. It consumes |
| 33 | + artifacts, builds a per-project kernel, talks to the customer-managed |
| 34 | + business database, and serves application APIs and UI. |
| 35 | + |
| 36 | +## What runs inside ObjectOS |
| 37 | + |
| 38 | +```text |
| 39 | + +-------------------------------------+ |
| 40 | + HTTP --> | HTTP dispatcher | |
| 41 | + | /health · /api/v1/* · /api/v1/auth | |
| 42 | + +-----------------+-------------------+ |
| 43 | + | |
| 44 | + +-----------------v-------------------+ |
| 45 | + | KernelManager (LRU cache) | |
| 46 | + | per-project ObjectKernel instances | |
| 47 | + +-----------------+-------------------+ |
| 48 | + | |
| 49 | + +-----------------v-------------------+ |
| 50 | + | Base plugins (always loaded) | |
| 51 | + | ObjectQL · Security · Auth · i18n | |
| 52 | + +-----------------+-------------------+ |
| 53 | + | |
| 54 | + +-----------------v-------------------+ |
| 55 | + | Optional capabilities (per app) | |
| 56 | + | audit · storage · jobs · queue · | |
| 57 | + | realtime · feed · automation · | |
| 58 | + | analytics · ai · settings | |
| 59 | + +-------------------------------------+ |
| 60 | +``` |
| 61 | + |
| 62 | +Key properties: |
| 63 | + |
| 64 | +- One ObjectOS host can serve many projects. Each project gets its own |
| 65 | + `ObjectKernel` instance, isolated database connection, and auth scope. |
| 66 | +- Kernels are cached in an LRU (`OS_KERNEL_CACHE_SIZE`, default 32) with |
| 67 | + an idle TTL (`OS_KERNEL_TTL_MS`, default 15 min) so cold-start cost is |
| 68 | + amortised. |
| 69 | +- Capabilities listed in the artifact's `requires` array are loaded |
| 70 | + lazily from optional `@objectstack/*` packages bundled in the image. |
| 71 | + |
| 72 | +## Boot modes |
| 73 | + |
| 74 | +| Mode | When to use | Hostname resolution | |
| 75 | +|---|---|---| |
| 76 | +| Cloud-connected (`OS_CLOUD_URL`) | Multi-project deployments, hosted control plane, dynamic project lifecycle | Resolved from the control plane's `/cloud/*` API | |
| 77 | +| File-backed (`controlPlaneUrl: 'file'` + `OS_ARTIFACT_FILE`) | Single project, demo, air-gapped, smoke tests | Every hostname resolves to the same packaged project | |
| 78 | + |
| 79 | +The ObjectOS app wrapper (`apps/objectos/objectstack.config.ts`) picks |
| 80 | +the mode based on the presence of `OS_CLOUD_URL`. |
| 81 | + |
| 82 | +## Request lifecycle |
| 83 | + |
| 84 | +```text |
| 85 | +1. Ingress / load balancer (TLS termination, X-Forwarded-For) |
| 86 | +2. ObjectOS HTTP dispatcher (security headers, request id) |
| 87 | +3. Hostname → environment (cached for OS_ENV_CACHE_TTL_MS) |
| 88 | +4. KernelManager.acquire (build on miss, reuse on hit) |
| 89 | +5. AuthPlugin (session/cookie or bearer/API key) |
| 90 | +6. SecurityPlugin (RBAC + RLS + FLS) |
| 91 | +7. Route handler (generated REST, custom action, auth route) |
| 92 | +8. Driver (ObjectQL → SQL / Mongo / memory) |
| 93 | +9. Response (X-Request-Id propagated) |
| 94 | +``` |
| 95 | + |
| 96 | +## Data ownership |
| 97 | + |
| 98 | +| Data | Where it lives | Owned by | |
| 99 | +|---|---|---| |
| 100 | +| Compiled artifact (`objectstack.json`) | Control plane or local file | Application/release team | |
| 101 | +| Business records (your domain data) | Customer-managed database | Customer | |
| 102 | +| Identity (`sys_user`, `sys_session`, …) | Same database as business records | Customer | |
| 103 | +| Settings (`sys_setting`) | Same database as business records | Customer | |
| 104 | +| Secrets baseline (`OS_AUTH_SECRET`, OIDC client secret, DB creds) | Customer secret manager | Customer | |
| 105 | +| Audit log (`sys_audit_log`) | Same database (when `audit` capability is enabled) | Customer | |
| 106 | + |
| 107 | +ObjectOS never copies business data back to the control plane. |
| 108 | + |
| 109 | +## Security boundary |
| 110 | + |
| 111 | +- ObjectOS only needs to make one outbound connection during operation |
| 112 | + (to the control plane Artifact API) in cloud-connected mode, plus any |
| 113 | + customer-configured integrations (SMTP, object storage, webhook |
| 114 | + targets, identity providers). |
| 115 | +- Air-gapped mode removes the control-plane call entirely. |
| 116 | +- See [Production readiness](/docs/operate/production) for the |
| 117 | + go-live checklist. |
0 commit comments