@chidchanun/bcp 0.2.19 → 0.3.0

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,159 @@
1
+ # Migrating to BCP Framework 0.3.0
2
+
3
+ BCP Framework `0.3.0` establishes the Application Platform baseline while preserving the public entrypoints frozen in `0.2.19`.
4
+
5
+ > **Release state:** unreleased until RC validation, tagging and npm publication complete.
6
+
7
+ ## Compatibility goal
8
+
9
+ `0.3.0` intentionally adds one public server-only package entrypoint:
10
+
11
+ ```text
12
+ bcp/application
13
+ ```
14
+
15
+ No `0.2.19` public entrypoint is intentionally removed. Existing applications do not have to adopt the new application runtime immediately.
16
+
17
+ ## Upgrade
18
+
19
+ After `0.3.0` is published:
20
+
21
+ ```powershell
22
+ npm exec -- bcp-framework update --check
23
+ npm run update -- 0.3.0
24
+ ```
25
+
26
+ Then rebuild the application:
27
+
28
+ ```powershell
29
+ npm run typecheck
30
+ npm run build
31
+ npm exec -- bcp-framework doctor
32
+ ```
33
+
34
+ Do not reuse a `.bcp-framework/build` directory produced by `0.2.x`.
35
+
36
+ ## Existing 0.2.x composition remains valid
37
+
38
+ These imports remain public:
39
+
40
+ ```ts
41
+ import { db } from "bcp/database";
42
+ import { createAuth } from "bcp/auth";
43
+ import { createJobQueue } from "bcp/jobs";
44
+ import { createWorkflow } from "bcp/workflow";
45
+ import { createTransactionalOutbox } from "bcp/events";
46
+ import { createRealtime } from "bcp/realtime";
47
+ import { createCacheStore } from "bcp/cache";
48
+ import { createPluginHost } from "bcp/plugins";
49
+ import { createTracer } from "bcp/observability";
50
+ import { createDeploymentRuntime } from "bcp/deployment";
51
+ ```
52
+
53
+ You can continue owning lifecycle manually if that is already appropriate for the project.
54
+
55
+ ## Optional migration to createApp
56
+
57
+ New or gradually modernized applications can centralize composition:
58
+
59
+ ```ts
60
+ import {
61
+ createApp,
62
+ } from "bcp/application";
63
+
64
+ export const app =
65
+ createApp({
66
+ name: "my-app",
67
+ version: "1.0.0",
68
+ });
69
+ ```
70
+
71
+ Register shared service instances before startup:
72
+
73
+ ```ts
74
+ app.provide("database", database);
75
+ app.provide("cache", cache);
76
+ app.provide("jobs", jobs);
77
+ ```
78
+
79
+ Register lifecycle-owned resources:
80
+
81
+ ```ts
82
+ app.addResource({
83
+ name: "database",
84
+ start: () => database.connect(),
85
+ stop: () => database.close(),
86
+ });
87
+ ```
88
+
89
+ Then:
90
+
91
+ ```ts
92
+ await app.start();
93
+ ```
94
+
95
+ ## Lifecycle ownership
96
+
97
+ Do not allow both the application runtime and separate application code to independently start/stop the same resource.
98
+
99
+ Choose one lifecycle owner for each database pool, worker, scheduler, broker or other long-running resource.
100
+
101
+ The Application Platform starts:
102
+
103
+ ```text
104
+ plugins
105
+ resources
106
+ application hook
107
+ ```
108
+
109
+ and stops them in reverse dependency order.
110
+
111
+ ## Plugins and modules
112
+
113
+ Existing `definePlugin()` and `defineModule()` values work directly:
114
+
115
+ ```ts
116
+ const app =
117
+ createApp({
118
+ name: "my-app",
119
+ modules: [
120
+ backendModule,
121
+ ],
122
+ });
123
+ ```
124
+
125
+ No plugin rewrite is required for `0.3.0`.
126
+
127
+ ## Server-only boundary
128
+
129
+ `bcp/application` owns process lifecycle and infrastructure composition. Do not import it from React client pages or islands.
130
+
131
+ Use it from server bootstrap/application composition modules.
132
+
133
+ ## API baseline
134
+
135
+ `0.2.19` remains the previous compatibility baseline. The reviewed `0.3.0` API snapshot adds `bcp/application` and becomes the new release contract used by `npm run api:check`.
136
+
137
+ ## Validation checklist
138
+
139
+ For framework development:
140
+
141
+ ```powershell
142
+ npm run typecheck
143
+ npm run test:unit
144
+ npm run test:integration
145
+ npm run test:e2e
146
+ npm run test:package
147
+ npm run api:check
148
+ npm run release:readiness
149
+ npm run rc:check
150
+ ```
151
+
152
+ For an application upgrading from `0.2.19`:
153
+
154
+ ```powershell
155
+ npm run typecheck
156
+ npm run build
157
+ npm exec -- bcp-framework routes
158
+ npm exec -- bcp-framework doctor
159
+ ```
@@ -1,8 +1,8 @@
1
1
  # Framework Platform Contract
2
2
 
3
- BCP Framework `0.2.x` exposes an explicit, machine-readable application-platform contract rather than relying on private repository structure.
3
+ BCP Framework exposes an explicit, machine-readable application-platform contract rather than relying on private repository structure.
4
4
 
5
- The current development baseline is **`0.2.19Stability & API Freeze`** and remains unreleased until the complete RC sequence passes, the exact release commit is tagged and npm publication completes.
5
+ The current development baseline is **`0.3.0BCP Application Platform`** and remains unreleased until the complete RC sequence passes, the exact release commit is tagged and npm publication completes.
6
6
 
7
7
  ## Sources of truth
8
8
 
@@ -14,17 +14,17 @@ docs/api-manifest.json
14
14
  -> public package source/environment/documentation ownership
15
15
 
16
16
  docs/api-freeze-snapshot.json
17
- -> frozen 0.2.19 CLI and prepared npm export contract
17
+ -> reviewed CLI and prepared npm export baseline
18
18
 
19
19
  docs/docs-web-manifest.json
20
20
  -> documentation routes and release navigation
21
21
  ```
22
22
 
23
- Framework source and tests remain authoritative for runtime behavior. The manifests make that supported surface testable during release validation.
23
+ Framework source and tests remain authoritative for runtime behavior. The manifests make the supported surface testable during release validation.
24
24
 
25
- ## Frozen public entrypoints
25
+ ## Public entrypoints
26
26
 
27
- The `0.2.19` baseline supports:
27
+ The `0.3.0` baseline supports:
28
28
 
29
29
  ```text
30
30
  bcp
@@ -43,18 +43,47 @@ bcp/testing
43
43
  bcp/plugins
44
44
  bcp/observability
45
45
  bcp/deployment
46
+ bcp/application
46
47
  bcp/server
47
48
  bcp/server-only
48
49
  bcp/middleware
49
50
  ```
50
51
 
52
+ `bcp/application` is the one new entrypoint relative to the `0.2.19` baseline. No existing `0.2.19` public entrypoint is intentionally removed.
53
+
51
54
  Application code should use these entrypoints instead of private `packages/*` implementation paths.
52
55
 
53
- The prepared npm package also exposes `./package.json`; that package export is included in the freeze snapshot even though it is not an application API module.
56
+ The prepared npm package also exposes `./package.json`; that package export is included in the API snapshot even though it is not an application API module.
57
+
58
+ ## Application Platform baseline
59
+
60
+ `bcp/application` adds a server-only composition root:
61
+
62
+ ```ts
63
+ import {
64
+ createApp,
65
+ defineApp,
66
+ } from "bcp/application";
67
+ ```
68
+
69
+ The Application Platform reuses the existing Plugin and Deployment platforms for:
70
+
71
+ ```text
72
+ typed application config
73
+ shared services and hooks
74
+ plugins/modules
75
+ resource lifecycle
76
+ startup rollback
77
+ readiness/diagnostics
78
+ signal handling
79
+ graceful shutdown
80
+ ```
81
+
82
+ It does not replace existing database, jobs, cache, events, realtime or other subsystem APIs. Applications may use those independently or compose selected instances through the application root.
54
83
 
55
84
  ## CLI baseline
56
85
 
57
- The frozen command families are:
86
+ The command families remain:
58
87
 
59
88
  ```text
60
89
  bcp dev
@@ -83,21 +112,21 @@ build target: standalone-node
83
112
  package target: standalone-node
84
113
  ```
85
114
 
86
- Prepared server/runtime entrypoints resolve to compiled ESM where required by the package contract. Their exact `types`, `default` and `browser` targets are frozen in `api-freeze-snapshot.json`.
115
+ Prepared server/runtime entrypoints resolve to compiled ESM where required by the package contract. `0.3.0` adds compiled `application.mjs`.
87
116
 
88
117
  ## Compatibility policy
89
118
 
90
- For `0.2.19`:
119
+ For `0.3.0`:
91
120
 
92
121
  ```text
93
- previous baseline: 0.2.18
122
+ previous baseline: 0.2.19
94
123
  intentional breaking changes: false
95
- freeze state: frozen
124
+ baseline: application-platform
96
125
  ```
97
126
 
98
- Bug fixes may correct implementation behavior, but they must not silently remove a documented public entrypoint or change its prepared package-resolution/browser-boundary contract.
127
+ `0.2.19` remains the historical freeze point for `0.2.x`. `0.3.0` intentionally advances the reviewed API snapshot by adding `bcp/application` and becomes the next compatibility baseline.
99
128
 
100
- Intentional public-platform changes should normally move to `0.3.0` with explicit compatibility metadata and migration documentation.
129
+ Bug fixes must not silently remove a documented public entrypoint or change its prepared package-resolution/browser-boundary contract.
101
130
 
102
131
  ## API compatibility gate
103
132
 
@@ -107,13 +136,13 @@ npm run api:check
107
136
 
108
137
  The gate prepares the publish package, regenerates the current contract in memory and compares it to `docs/api-freeze-snapshot.json`.
109
138
 
110
- To intentionally regenerate the snapshot:
139
+ To intentionally regenerate the snapshot for a reviewed platform-baseline change:
111
140
 
112
141
  ```bash
113
142
  npm run api:snapshot
114
143
  ```
115
144
 
116
- Snapshot changes during `0.2.19` require explicit review; regeneration is not a routine fix for a failing compatibility check.
145
+ Do not regenerate the snapshot merely to silence an unexpected compatibility failure.
117
146
 
118
147
  ## Release readiness
119
148
 
@@ -122,11 +151,11 @@ npm run release:readiness
122
151
  npm run release:readiness:report
123
152
  ```
124
153
 
125
- The readiness gate checks version/lock/manifests parity, compatibility metadata, freeze parity, release docs and stability capabilities. The optional local report is written to `.bcp-framework/release-readiness.json`.
154
+ The readiness gate checks version/lock/manifests parity, compatibility metadata, application entrypoint ownership, API snapshot parity, release docs and Application Platform capability flags. The optional report is written to `.bcp-framework/release-readiness.json`.
126
155
 
127
156
  ## Release validation
128
157
 
129
- Before `0.2.19` is tagged or published:
158
+ Before `0.3.0` is tagged or published:
130
159
 
131
160
  ```bash
132
161
  npm run typecheck
@@ -141,4 +170,4 @@ npm run rc:check
141
170
 
142
171
  `rc:check` must pass on the exact commit used for the release tag.
143
172
 
144
- See [Stability & API Freeze](stability-api-freeze.md) and [Migrating to 0.2.x](migration-0.2.md).
173
+ See [Application Platform](application-platform.md), [Migrating to 0.3.0](migration-0.3.md), and the historical [Stability & API Freeze](stability-api-freeze.md).
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "framework": "bcp",
4
- "version": "0.2.19",
4
+ "version": "0.3.0",
5
5
  "releaseState": "unreleased",
6
- "baseline": "stability-api-freeze",
6
+ "baseline": "application-platform",
7
7
  "runtime": {
8
8
  "node": ">=24.11.0",
9
9
  "react": "19",
@@ -27,6 +27,7 @@
27
27
  "bcp/plugins",
28
28
  "bcp/observability",
29
29
  "bcp/deployment",
30
+ "bcp/application",
30
31
  "bcp/server",
31
32
  "bcp/server-only",
32
33
  "bcp/middleware"
@@ -95,6 +96,19 @@
95
96
  "compiledAuthRuntime": true,
96
97
  "compiledServerRuntime": true,
97
98
  "compiledMiddlewareRuntime": true,
99
+ "applicationPlatform": true,
100
+ "applicationDefinitions": true,
101
+ "applicationRuntime": true,
102
+ "applicationConfigSchemas": true,
103
+ "applicationServiceRegistry": true,
104
+ "applicationPluginComposition": true,
105
+ "applicationModuleComposition": true,
106
+ "applicationResourceLifecycle": true,
107
+ "applicationReadiness": true,
108
+ "applicationDiagnostics": true,
109
+ "applicationLifecycleRollback": true,
110
+ "applicationLifecycleIdempotency": true,
111
+ "compiledApplicationRuntime": true,
98
112
  "stabilityApiFreeze": true,
99
113
  "apiFreezeSnapshot": true,
100
114
  "apiCompatibilityGate": true,
@@ -230,9 +244,9 @@
230
244
  "s3-compatible"
231
245
  ],
232
246
  "compatibility": {
233
- "previousBaseline": "0.2.18",
247
+ "previousBaseline": "0.2.19",
234
248
  "intentionalBreakingChangesFromPreviousBaseline": false,
235
- "migrationGuide": "migration-0.2.md"
249
+ "migrationGuide": "migration-0.3.md"
236
250
  },
237
251
  "documentation": {
238
252
  "navigationManifest": "docs-web-manifest.json",
@@ -243,6 +257,7 @@
243
257
  "documentationPlatform": "documentation-platform.md",
244
258
  "apiReference": "api-reference.md",
245
259
  "stabilityApiFreeze": "stability-api-freeze.md",
260
+ "applicationPlatform": "application-platform.md",
246
261
  "environmentValidation": "environment-validation.md",
247
262
  "applicationPackaging": "application-packaging.md",
248
263
  "authentication": "authentication.md",
@@ -260,7 +275,7 @@
260
275
  "testingPlatform": "testing-platform.md",
261
276
  "pluginModulePlatform": "plugin-module-platform.md",
262
277
  "cachePlatformV2": "cache-platform-v2.md",
263
- "migrationGuide": "migration-0.2.md",
264
- "releaseNotes": "releases/0.2.19.md"
278
+ "migrationGuide": "migration-0.3.md",
279
+ "releaseNotes": "releases/0.3.0.md"
265
280
  }
266
281
  }
@@ -0,0 +1,129 @@
1
+ # BCP Framework 0.3.0 — Application Platform
2
+
3
+ `0.3.0` establishes the first BCP Application Platform baseline on top of the infrastructure and API freeze completed in `0.2.x`.
4
+
5
+ > **Release state:** unreleased until the complete RC gate passes, `v0.3.0` is tagged and both npm packages are published successfully.
6
+
7
+ ## Highlights
8
+
9
+ - Adds the server-only `bcp/application` public entrypoint.
10
+ - Adds `defineApp()` for validated application definitions.
11
+ - Adds `createApp()` for a unified application composition root.
12
+ - Reuses the existing Plugin Platform service registry and hook bus.
13
+ - Reuses existing plugin/module definitions without conversion.
14
+ - Reuses Deployment Platform resources, readiness, diagnostics, signal handling and shutdown hooks.
15
+ - Adds typed application-level config parsing.
16
+ - Adds deterministic application lifecycle ordering.
17
+ - Adds startup rollback and terminal cleanup through the deployment resource graph.
18
+ - Adds concurrent/repeated start and shutdown idempotency coverage.
19
+ - Publishes `application.mjs` as a compiled production runtime.
20
+ - Adds prepared-package smoke coverage for the new entrypoint and lifecycle.
21
+
22
+ ## Public API
23
+
24
+ ```ts
25
+ import {
26
+ ApplicationLifecycleError,
27
+ createApp,
28
+ defineApp,
29
+ } from "bcp/application";
30
+ ```
31
+
32
+ Key types:
33
+
34
+ ```text
35
+ Application
36
+ ApplicationConfigParser
37
+ ApplicationConfigSchema
38
+ ApplicationContext
39
+ ApplicationDefinition
40
+ ApplicationState
41
+ ```
42
+
43
+ ## Application composition
44
+
45
+ ```ts
46
+ const app =
47
+ createApp({
48
+ name: "orders-api",
49
+ version: "1.0.0",
50
+ plugins: [
51
+ authPlugin,
52
+ jobsPlugin,
53
+ ],
54
+ resources: [
55
+ databaseResource,
56
+ workerResource,
57
+ ],
58
+ });
59
+
60
+ await app.start();
61
+ ```
62
+
63
+ The application exposes the shared platform objects directly:
64
+
65
+ ```text
66
+ app.services
67
+ app.hooks
68
+ app.plugins
69
+ app.deployment
70
+ ```
71
+
72
+ Existing provider-native database, cache, job, workflow, event and realtime instances can be stored in the service registry or wrapped in deployment resources as appropriate.
73
+
74
+ ## Lifecycle
75
+
76
+ Startup:
77
+
78
+ ```text
79
+ application.setup
80
+ plugin setup/start
81
+ resources start in registration order
82
+ application.start
83
+ ```
84
+
85
+ Shutdown:
86
+
87
+ ```text
88
+ application.stop
89
+ resources stop in reverse order
90
+ plugin stop/dispose
91
+ application.dispose
92
+ ```
93
+
94
+ Startup failures roll back already-started resources in reverse order.
95
+
96
+ ## Compatibility
97
+
98
+ The `0.2.19` Stability & API Freeze release is the compatibility baseline for `0.3.0`.
99
+
100
+ `0.3.0` intentionally adds:
101
+
102
+ ```text
103
+ bcp/application
104
+ ```
105
+
106
+ No existing `0.2.19` public entrypoint is intentionally removed.
107
+
108
+ The API snapshot/compatibility tooling is updated to establish the reviewed `0.3.0` package baseline after the new entrypoint is added.
109
+
110
+ ## Validation
111
+
112
+ Before tagging:
113
+
114
+ ```bash
115
+ npm run typecheck
116
+ npm run test:unit
117
+ npm run test:integration
118
+ npm run test:e2e
119
+ npm run test:package
120
+ npm run api:check
121
+ npm run release:readiness
122
+ npm run rc:check
123
+ ```
124
+
125
+ Do not publish until these commands pass on the exact final release commit.
126
+
127
+ ## Next milestone
128
+
129
+ `0.3.1 — Dependency Injection & Service Container` is planned to add typed service tokens, singleton/scoped/transient lifetimes, request scopes, factories and testing overrides on top of the shared Application Platform service composition model.