@feltdb/feltkit 0.3.14 → 0.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,116 @@
1
+ # FeltKit → AppBoundry deployment contract
2
+
3
+ **Status: proposed by FeltKit for the AppBoundry workstream to implement (2026-11-04).** FeltKit owns the client
4
+ (`packages/sdk/src/cli/deploy-appboundry.ts`); AppBoundry owns the server, its authorization, and everything
5
+ about execution. Where this contract matches what the portal already serves (M1a), it says so. Where it
6
+ needs something new, it is marked **(new)**. FeltKit implements nothing on AppBoundry's side.
7
+
8
+ The principle: FeltKit builds the application and its immutable artifact. AppBoundry receives, registers,
9
+ governs, deploys, executes and operates it. FeltKit never generates, sees or depends on the execution
10
+ environment.
11
+
12
+ ```
13
+ npx feltkit deploy --target appboundry # build → upload → register if needed → deploy → wait for evidence
14
+ npx feltkit status # what AppBoundry says now
15
+ ```
16
+
17
+ ## 1. Configuration (client side)
18
+
19
+ | Variable | Flag | Meaning |
20
+ |---|---|---|
21
+ | `APPBOUNDRY_URL` | `--portal` | Portal origin. `https://` required; `http://` only to loopback |
22
+ | `APPBOUNDRY_TOKEN` | (environment only) | A deploy token (§2). Never printed, logged or written to disk by FeltKit |
23
+ | `APPBOUNDRY_HOST` | `--host` | Execution host. Required by M1a; **optional once AppBoundry places deployments (§5)** |
24
+
25
+ ## 2. Authentication: deploy tokens (new)
26
+
27
+ The M1a operator API accepts only a signed-in platform owner's browser session. Automated deployment needs a
28
+ machine credential.
29
+
30
+ - **Issued** by a platform owner (later: an organization owner) in the portal, for a scope: one application,
31
+ or all applications in an organization. Shown once. Stored as a hash. Revocable, with an optional expiry.
32
+ - **Presented** as `Authorization: Bearer <token>`. A recognisable prefix (suggested `abd_`) so it can be
33
+ found by secret scanners.
34
+ - **Grants** exactly the deployment operations below for its scope: register, upload, deploy, read status,
35
+ stop. It never grants host registration, host tokens, or another scope's records.
36
+ - **Not subject to the browser CSRF origin check** (it carries no ambient cookie). Every use is logged with the
37
+ token id (never the token) as the actor in `requestedBy`/`uploadedBy`.
38
+ - **Errors**: missing, unknown, revoked or expired → `401 AUTHENTICATION_REQUIRED`; valid but out of scope →
39
+ `403 FORBIDDEN`. Both with a JSON body `{ error, code }`. FeltKit shows the message and the hint to create a
40
+ token in the portal.
41
+
42
+ ## 3. Endpoints
43
+
44
+ All JSON bodies are `application/json`; all errors are `{ "error": string, "code": string }` with the status
45
+ codes M1a already uses.
46
+
47
+ ### 3.1 `GET /api/applications/{applicationId}/hosting` (M1a)
48
+
49
+ FeltKit reads `registered` (boolean). It must answer for an application that does not exist yet
50
+ (`registered: false`) rather than 404, so the client can decide to register.
51
+
52
+ ### 3.2 `POST /api/applications/{applicationId}/artifacts` (M1a, plus registration: new)
53
+
54
+ - Body: the artifact folder as a gzip'd ustar archive, files at the root (`manifest.json`, `module.wasm`,
55
+ `assets/…`). FeltKit writes it deterministically (sorted, fixed modes and times), so the same artifact always
56
+ has the same archive digest.
57
+ - Headers: `content-type: application/gzip`, `x-archive-sha256: <hex>`.
58
+ - AppBoundry verifies the archive itself (M1a ingestion) and stores it immutably.
59
+ - **(new) Registration from the artifact.** If the application is not registered and the token's scope allows
60
+ it, AppBoundry registers it from the verified manifest (application id, name, version, published
61
+ capabilities, runtime type and integrity) in the same request, and says so: `{ registered: true,
62
+ registeredNow: true }`. Without that scope: `404 APPLICATION_NOT_REGISTERED` (as today).
63
+ - Response `201` (new artifact) or `200` (same bytes again):
64
+ `{ artifact: { artifactId, module: { sha256 }, … }, created, registeredNow? }`.
65
+ - FeltKit refuses to continue if `artifact.module.sha256` differs from the module it built.
66
+
67
+ ### 3.3 `POST /api/applications/{applicationId}/deployments` (M1a; host optional: new)
68
+
69
+ - Body: `{ artifactId, hostId? }`. **(new)** Without `hostId`, AppBoundry places the deployment and returns the
70
+ host it chose.
71
+ - Header: `Idempotency-Key` (FeltKit sends one per command run: a retried request returns the same deployment).
72
+ - Response `202` (created) or `200` (same key): `{ deployment, created }`.
73
+
74
+ ### 3.4 `GET /api/applications/{applicationId}/deployments/{deploymentId}` (M1a; address: new)
75
+
76
+ `{ deployment }` with at least: `deploymentId`, `applicationId`, `hostId`, `artifactId`, `moduleSha256`,
77
+ `state` (`Requested | Starting | Running | Failed | Stopped | Superseded`), `attempt`, `runtime { package,
78
+ version }`, `evidence { observedModuleSha256, health: "ready", startedAt, observedAt } | null`,
79
+ `failure { code, message, at } | null`, and **(new)** `address` (the URL where the running application is
80
+ served) once routing exists.
81
+
82
+ ### 3.5 `POST /api/applications/{applicationId}/deployments/{deploymentId}/stop` (M1a)
83
+
84
+ Used by a future `feltkit undeploy`. Not called today.
85
+
86
+ ## 4. What FeltKit treats as true
87
+
88
+ - **Running** only when `state === "Running"` and `evidence.observedModuleSha256` equals the module this build
89
+ produced and `evidence.health === "ready"`. An accepted upload or request is never reported as running.
90
+ - `Failed`, `Stopped`, `Superseded` are final for this command and shown with `failure`.
91
+ - Still `Requested`/`Starting` after the wait (default 5 minutes): reported as pending; `feltkit status` asks
92
+ again later.
93
+ - FeltKit records what it requested in `.feltkit/appboundry/deployment.json` (portal, application, artifact,
94
+ module, deployment ids). AppBoundry stays the authority on what is running; `feltkit status` always asks it.
95
+
96
+ ## 5. What AppBoundry still owns, and FeltKit does not assume
97
+
98
+ Placement and capacity, the execution mechanism (containers today, anything tomorrow), isolation between
99
+ tenants, routing and domains, application users and sessions (`appboundry admin` today), logs and metrics,
100
+ replacement and recovery, and metering. FeltKit will show `address`, logs or usage when AppBoundry exposes them
101
+ through this API, and not before.
102
+
103
+ ## 6. Acceptance (both sides)
104
+
105
+ The recording of `feltkit deploy --target appboundry` happens only when all of these pass against a running
106
+ portal and execution host:
107
+
108
+ 1. A deploy token created in the portal deploys a newly created FeltKit app that was never registered.
109
+ 2. A second deploy of the same build stores no new artifact (same `artifactId`) and creates a new deployment.
110
+ 3. A changed build supersedes the running deployment; the old one ends `Superseded`.
111
+ 4. A revoked token is refused with 401 and nothing changes.
112
+ 5. A token for application A cannot read, upload to or deploy application B (403).
113
+ 6. `feltkit status` reports Running with evidence that matches the build, and `address` once routing exists.
114
+ 7. Stopping the portal or the host mid-deploy never yields a false Running; the command reports pending or failed.
115
+
116
+ FeltKit's side of 1–7 is covered against a stand-in for this API in `packages/sdk/test/deploy-appboundry.test.ts`.
@@ -35,6 +35,52 @@ npx feltkit build --target appboundry # [--out <dir>]
35
35
  `{ configuration: {...} }`); jobs and webhook events are recorded (`t.host.jobs`,
36
36
  `t.host.webhookEvents`), not run. It is for verification, not serving.
37
37
 
38
+ ## Deploying through AppBoundry: `feltkit deploy --target appboundry`
39
+
40
+ FeltKit builds the application and its immutable artifact. AppBoundry registers, deploys, executes and
41
+ operates it. The developer never generates or manages the execution environment: whether an AppBoundry
42
+ host runs artifacts in Docker, Podman, a microVM or something else is AppBoundry's choice, and FeltKit
43
+ does not depend on it.
44
+
45
+ ```bash
46
+ npx feltkit deploy --target appboundry # APPBOUNDRY_URL, APPBOUNDRY_TOKEN (APPBOUNDRY_HOST while M1a needs it)
47
+ npx feltkit status
48
+ ```
49
+
50
+ | Output | Owner | What it is |
51
+ |---|---|---|
52
+ | Application artifact | FeltKit build | `.feltkit/appboundry/<name>.app`: manifest, module that imports nothing, frontend |
53
+ | Deployment request | FeltKit → AppBoundry | the artifact uploaded as a deterministic `.tar.gz` (with `x-archive-sha256`), then a deployment intent (`artifactId`, host, `Idempotency-Key`) |
54
+ | Execution environment | AppBoundry | never visible to FeltKit |
55
+
56
+ `src/cli/deploy-appboundry.ts` speaks AppBoundry's managed-hosting API (rkendel1/appboundry
57
+ `apps/cloud-portal`, M1a): `GET /api/applications/{id}/hosting`, `POST …/artifacts`, `POST …/deployments`,
58
+ `GET …/deployments/{id}`. AppBoundry verifies the upload itself and stores it immutably; the same build
59
+ always produces the same archive and the same artifact. FeltKit reports **Running** only when AppBoundry
60
+ says Running and its evidence (reported by the runtime, recorded by the portal) names the module this
61
+ build produced. `feltkit status` asks AppBoundry, using the request recorded in
62
+ `.feltkit/appboundry/deployment.json` (never the token).
63
+
64
+ **What AppBoundry still needs before this works against a production portal** (all on AppBoundry's side;
65
+ FeltKit's adapter is written to the contract and tested against a stand-in for it). The full contract FeltKit
66
+ expects, endpoint by endpoint, with acceptance tests for both sides: [APPBOUNDRY-DEPLOY-CONTRACT.md](APPBOUNDRY-DEPLOY-CONTRACT.md).
67
+
68
+ 1. **A deploy credential.** The M1a operator API accepts only a signed-in platform owner's browser session.
69
+ A CLI needs a scoped token AppBoundry issues and accepts as `Authorization: Bearer`.
70
+ 2. **Registration from the artifact.** Today the application is registered once in the portal UI; deploy
71
+ refuses an unregistered application with that instruction.
72
+ 3. **Placement.** M1a asks the caller for the execution host (`APPBOUNDRY_HOST`); AppBoundry should choose.
73
+ 4. **An address.** M1 has no public routing yet, so a Running deployment has no URL to report.
74
+
75
+ ### Running the AppBoundry runtime yourself: `--target appboundry-self-hosted`
76
+
77
+ A separate product with its own contract: `.feltkit/deploy` with the artifact, a Dockerfile that installs
78
+ the published `@appport/appboundry` (pinned, `APPBOUNDRY_DEPLOY_VERSION`), AppBoundry's artifact-runner
79
+ entrypoint (refuses any other module, verifies, bootstraps the operator), `docker-compose.yml`,
80
+ `deploy.json` and `DEPLOY.md`. Use it when you operate the execution environment; it is not how AppBoundry
81
+ deploys. Access: `appboundry admin users add` and `appboundry admin sessions issue` through
82
+ `docker compose exec`; the starter's sign-in screen accepts the issued session.
83
+
38
84
  ## What is in `my-app.app`
39
85
 
40
86
  | File | Contents |
package/docs/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # FeltKit 0.3.14 documentation
1
+ # FeltKit 0.3.15 documentation
2
2
 
3
3
  Shipped with `@feltdb/feltkit`. In a project: `node_modules/@feltdb/feltkit/docs/`, or run `npx feltkit docs`.
4
- Public copy: https://cdn.jsdelivr.net/npm/@feltdb/feltkit@0.3.14/docs/README.md
4
+ Public copy: https://cdn.jsdelivr.net/npm/@feltdb/feltkit@0.3.15/docs/README.md
5
5
 
6
6
  - [ARCHITECTURE.md](ARCHITECTURE.md): How FeltKit is put together: one FeltDB instance, AppPort, AppPort Services
7
7
  - [GUARANTEES.md](GUARANTEES.md): What FeltKit guarantees, and its known limitations
@@ -11,6 +11,7 @@ Public copy: https://cdn.jsdelivr.net/npm/@feltdb/feltkit@0.3.14/docs/README.md
11
11
  - [RESOLVER.md](RESOLVER.md): Model references: change the model a deployed app uses through Resolver, without a redeploy
12
12
  - [PATH-TO-PRODUCTION.md](PATH-TO-PRODUCTION.md): From a local app to production: deploy targets and what you must provide
13
13
  - [BACKUP.md](BACKUP.md): Backing up and restoring an environment's state
14
- - [APPBOUNDRY.md](APPBOUNDRY.md): The AppBoundry artifact target
14
+ - [APPBOUNDRY.md](APPBOUNDRY.md): The AppBoundry artifact, deploying through AppBoundry, and the self-hosted runtime
15
+ - [APPBOUNDRY-DEPLOY-CONTRACT.md](APPBOUNDRY-DEPLOY-CONTRACT.md): The deployment contract FeltKit expects from AppBoundry (proposed)
15
16
  - [WHY-FELTKIT.md](WHY-FELTKIT.md): Design choices, compared with Convex
16
17
  - [UPSTREAM-GAPS.md](UPSTREAM-GAPS.md): Known gaps in FeltDB, AppPort and AppPort Services, and their status
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feltdb/feltkit",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "description": "FeltKit: one application, one FeltDB instance, one developer experience. SDK, runtime, CLI, and dashboard.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -62,7 +62,7 @@
62
62
  "@appport/server": "1.1.5",
63
63
  "@appport/services": ">=0.15.0 <1.0.0",
64
64
  "@feltdb/core": ">=0.21.0 <1.0.0",
65
- "create-feltkit": "0.3.14",
65
+ "create-feltkit": "0.3.15",
66
66
  "esbuild": "0.25.12",
67
67
  "express": "4.22.3",
68
68
  "mailerport": ">=0.1.0 <1.0.0",
@@ -10,7 +10,7 @@
10
10
  "name": "feltkit",
11
11
  "source": "./",
12
12
  "description": "Skills for building and operating FeltKit applications.",
13
- "version": "0.3.14"
13
+ "version": "0.3.15"
14
14
  }
15
15
  ]
16
16
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
3
  "name": "feltkit",
4
- "version": "0.3.14",
4
+ "version": "0.3.15",
5
5
  "description": "Skills for building and operating FeltKit applications: project structure and SDK, AppPort Services, FeltDB data and consistency, the FeltKit agent over MCP, and operations. Guidance only: they grant no permission.",
6
6
  "author": {
7
7
  "name": "FeltKit"