@chidchanun/bcp 0.2.18 → 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.
@@ -1,63 +1,62 @@
1
- # Migrating to BCP Framework 0.2.0
1
+ # Migrating within BCP Framework 0.2.x
2
2
 
3
- BCP Framework `0.2.0` establishes the Framework Platform baseline while preserving the public application model from `0.1.29`.
3
+ BCP Framework `0.2.19` is the final `0.2.x` stability/API-freeze baseline before `0.3.0`.
4
4
 
5
- > **Release state:** unreleased development target until RC validation and npm publication complete.
5
+ > **Current development target:** `0.2.19 Stability & API Freeze`
6
+ >
7
+ > Release state remains unreleased until the complete RC sequence, tagging and npm publication finish.
6
8
 
7
9
  ## Compatibility goal
8
10
 
9
- There are no intentional public-entrypoint removals from the `0.1.29` baseline in this milestone.
11
+ `0.2.19` declares no intentional breaking changes from `0.2.18`.
10
12
 
11
- Applications already running on `0.1.29` should normally be able to move to `0.2.0` without rewriting routing, loaders, guards, actions, middleware, storage or authentication code.
13
+ The supported `0.2.x` public entrypoint/package-resolution contract is frozen in:
12
14
 
13
- BCP remains pre-1.0, so every application should still validate the upgrade before production deployment.
15
+ ```text
16
+ docs/api-freeze-snapshot.json
17
+ ```
14
18
 
15
- ## 1. Check the current project
19
+ Applications should continue importing documented `bcp/*` entrypoints and avoid framework-private `packages/*` paths.
16
20
 
17
- From the application root:
21
+ ## 1. Inspect the current application
18
22
 
19
23
  ```powershell
20
24
  npm exec -- bcp-framework doctor
21
25
  npm exec -- bcp-framework inspect --json
26
+ npm exec -- bcp-framework update --check
22
27
  ```
23
28
 
24
- Resolve blocking `FAIL` results before upgrading, especially duplicate framework dependency declarations or invalid production-hardening settings.
29
+ Resolve blocking diagnostics before upgrading.
25
30
 
26
- ## 2. Check the available framework update
27
-
28
- ```powershell
29
- npm exec -- bcp-framework update --check
30
- ```
31
+ ## 2. Upgrade explicitly
31
32
 
32
- After `0.2.0` is published, update with:
33
+ After `0.2.19` is published:
33
34
 
34
35
  ```powershell
35
- npm exec -- bcp-framework update 0.2.0
36
+ npm exec -- bcp-framework update 0.2.19
36
37
  ```
37
38
 
38
- Generated projects can also use:
39
+ Generated applications can also use:
39
40
 
40
41
  ```powershell
41
- npm run update -- 0.2.0
42
+ npm run update -- 0.2.19
42
43
  ```
43
44
 
44
- ## 3. Keep one framework dependency
45
-
46
- The recommended project dependency remains:
45
+ The recommended dependency remains one BCP installation:
47
46
 
48
47
  ```json
49
48
  {
50
49
  "dependencies": {
51
- "bcp": "npm:@chidchanun/bcp@0.2.0"
50
+ "bcp": "npm:@chidchanun/bcp@0.2.19"
52
51
  }
53
52
  }
54
53
  ```
55
54
 
56
- Do not keep both `bcp` and a second direct `@chidchanun/bcp` dependency in the same application. Two installed framework copies can produce separate React/framework contexts.
55
+ Do not keep both the `bcp` alias and a second direct `@chidchanun/bcp` dependency in the same application.
57
56
 
58
- ## 4. Preserve server-only boundaries
57
+ ## 3. Keep public import boundaries
59
58
 
60
- Continue importing public APIs through supported entrypoints such as:
59
+ Examples:
61
60
 
62
61
  ```ts
63
62
  import {
@@ -65,37 +64,61 @@ import {
65
64
  } from "bcp";
66
65
 
67
66
  import {
68
- auth,
67
+ createAuth,
69
68
  } from "bcp/auth";
70
69
 
71
70
  import {
72
71
  db,
73
72
  } from "bcp/database";
74
73
 
74
+ import {
75
+ createJobQueue,
76
+ } from "bcp/jobs";
77
+
78
+ import {
79
+ createDeploymentRuntime,
80
+ } from "bcp/deployment";
81
+
75
82
  import {
76
83
  cookies,
77
84
  } from "bcp/server";
78
85
  ```
79
86
 
80
- Do not migrate application imports to framework-internal `packages/...` paths.
87
+ The frozen entrypoint list is documented in [Framework Platform Contract](platform-contract.md) and [Stability & API Freeze](stability-api-freeze.md).
81
88
 
82
- The current public entrypoint baseline is listed in `platform-manifest.json` and [Framework Platform Contract](platform-contract.md).
89
+ ## 4. Rebuild production artifacts
83
90
 
84
- ## 5. Validate generated-project metadata
91
+ Do not reuse an old `.bcp-framework/build` or `.bcp-framework/package` directory after changing framework versions.
85
92
 
86
- Projects created by `create-bcp-app` `0.1.29` or newer may contain:
93
+ Run:
87
94
 
88
- ```text
89
- bcp.project.json
95
+ ```powershell
96
+ npm run build
97
+ npm run package
98
+ ```
99
+
100
+ Then test the production runtime:
101
+
102
+ ```powershell
103
+ npm start
90
104
  ```
91
105
 
92
- This file is optional runtime metadata. Older applications do not need to create it manually to run on `0.2.0`.
106
+ ## 5. Deployment/runtime review
93
107
 
94
- If you choose to add it to an older application, keep it non-secret. Credentials, passwords, access keys, session secrets and tokens do not belong in this file.
108
+ For applications adopting Deployment Platform v2, consider registering long-lived resources such as:
109
+
110
+ ```text
111
+ database
112
+ cache/redis connections
113
+ background workers
114
+ realtime services
115
+ outbox dispatchers
116
+ workflow workers
117
+ ```
95
118
 
96
- ## 6. Validate production settings
119
+ in dependency order so reverse-order shutdown drains dependents before shared infrastructure closes.
97
120
 
98
- For standalone production, review:
121
+ Review production environment settings such as:
99
122
 
100
123
  ```dotenv
101
124
  BCP_REQUEST_TIMEOUT_MS=120000
@@ -105,35 +128,17 @@ BCP_SHUTDOWN_TIMEOUT_MS=10000
105
128
  BCP_TRUST_PROXY=false
106
129
  ```
107
130
 
108
- Only enable:
131
+ Deployment identity may additionally use:
109
132
 
110
133
  ```dotenv
111
- BCP_TRUST_PROXY=true
134
+ BCP_DEPLOYMENT_ID=
135
+ BCP_INSTANCE_ID=
136
+ BCP_RELEASE=
112
137
  ```
113
138
 
114
- when the BCP process is reachable only through a trusted reverse proxy/load balancer.
139
+ ## 6. Application validation
115
140
 
116
- ## 7. Rebuild the standalone artifact
117
-
118
- Do not reuse `.bcp-framework/build` from the previous framework version.
119
-
120
- Run:
121
-
122
- ```powershell
123
- npm run build
124
- ```
125
-
126
- Then test:
127
-
128
- ```powershell
129
- npm start
130
- ```
131
-
132
- The supported `0.2.0` production target remains the standalone Node.js artifact under `.bcp-framework/build/`.
133
-
134
- ## 8. Application validation checklist
135
-
136
- Recommended minimum after upgrading:
141
+ Recommended minimum:
137
142
 
138
143
  ```powershell
139
144
  npm run typecheck
@@ -142,32 +147,26 @@ npm exec -- bcp-framework routes
142
147
  npm exec -- bcp-framework doctor
143
148
  ```
144
149
 
145
- For applications using authentication, storage or database features, also exercise representative login/session, upload/download and database paths before production deployment.
150
+ For applications using authentication, databases, storage, jobs, workflows, events, realtime or cache, exercise representative production paths before rollout.
146
151
 
147
- ## Local storage projects
152
+ ## 7. What the 0.2.19 freeze means for applications
148
153
 
149
- Projects using the Local Server storage preset should keep the scaffold:
150
-
151
- ```text
152
- storage/
153
- ├─ .gitkeep
154
- └─ README.md
155
- ```
154
+ The freeze is a **framework release contract**, not a new runtime requirement for applications.
156
155
 
157
- Runtime storage objects remain ignored by Git.
156
+ Applications do not need to run the framework repository's `api:check` or `release:readiness` scripts. Those are maintainer release gates.
158
157
 
159
- ## Amazon S3 / Cloudflare R2 projects
158
+ The practical application rule is:
160
159
 
161
- No provider migration is required for the `0.2.0` platform baseline. Existing `createS3Storage()` configurations continue using server-only credentials/environment settings.
162
-
163
- ## What is not part of this migration
160
+ ```text
161
+ use documented bcp/* entrypoints
162
+ avoid private packages/* imports
163
+ validate upgrades before deployment
164
+ ```
164
165
 
165
- `0.2.0` does not introduce native executable compilation, desktop packaging, Android APK output or iOS application output.
166
+ ## 8. Moving from 0.2.19 to 0.3.0
166
167
 
167
- The supported build model remains:
168
+ `0.2.19` becomes the compatibility reference point for the next platform baseline.
168
169
 
169
- ```text
170
- BCP application -> bcp build -> standalone Node.js web application
171
- ```
170
+ If `0.3.0` intentionally changes the frozen public surface, its release should provide explicit compatibility metadata and migration guidance rather than silently changing a `0.2.x` contract.
172
171
 
173
- Future build targets can be added after the platform baseline without redefining the existing standalone contract.
172
+ Native executable/mobile/desktop compilation is still outside the current standalone Node.js web-application target.
@@ -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,30 +1,30 @@
1
1
  # Framework Platform Contract
2
2
 
3
- BCP Framework `0.2.0` establishes the first explicit framework-platform baseline. The goal is to make public entrypoints, supported runtime targets, CLI capabilities and documentation metadata visible and testable instead of relying on implicit package structure.
3
+ BCP Framework exposes an explicit, machine-readable application-platform contract rather than relying on private repository structure.
4
4
 
5
- > **Release state:** unreleased development target until local RC validation, tagging and npm publication complete.
5
+ The current development baseline is **`0.3.0 — BCP Application Platform`** and remains unreleased until the complete RC sequence passes, the exact release commit is tagged and npm publication completes.
6
6
 
7
- ## What the platform contract covers
7
+ ## Sources of truth
8
8
 
9
- The platform contract is represented by `docs/platform-manifest.json` and release/package smoke tests.
9
+ ```text
10
+ docs/platform-manifest.json
11
+ -> framework/runtime/capability/public-entrypoint contract
12
+
13
+ docs/api-manifest.json
14
+ -> public package source/environment/documentation ownership
10
15
 
11
- It records:
16
+ docs/api-freeze-snapshot.json
17
+ -> reviewed CLI and prepared npm export baseline
12
18
 
13
- - the framework version and release state,
14
- - the minimum supported Node.js runtime,
15
- - the supported production build target,
16
- - public package entrypoints,
17
- - documented CLI command families,
18
- - framework capability groups,
19
- - built-in/scaffolded storage-provider families,
20
- - compatibility expectations for the previous baseline,
21
- - documentation files used by `bcp-docs-web`.
19
+ docs/docs-web-manifest.json
20
+ -> documentation routes and release navigation
21
+ ```
22
22
 
23
- The manifest is metadata. Framework source, package exports and tests remain authoritative for actual runtime behavior.
23
+ Framework source and tests remain authoritative for runtime behavior. The manifests make the supported surface testable during release validation.
24
24
 
25
25
  ## Public entrypoints
26
26
 
27
- The `0.2.0` platform baseline recognizes these public application imports:
27
+ The `0.3.0` baseline supports:
28
28
 
29
29
  ```text
30
30
  bcp
@@ -35,125 +35,139 @@ bcp/validation
35
35
  bcp/error
36
36
  bcp/database
37
37
  bcp/auth
38
+ bcp/jobs
39
+ bcp/workflow
40
+ bcp/events
41
+ bcp/realtime
42
+ bcp/testing
43
+ bcp/plugins
44
+ bcp/observability
45
+ bcp/deployment
46
+ bcp/application
38
47
  bcp/server
39
48
  bcp/server-only
40
49
  bcp/middleware
41
50
  ```
42
51
 
43
- Application code should prefer these entrypoints instead of importing internal files under `packages/`.
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
+
54
+ Application code should use these entrypoints instead of private `packages/*` implementation paths.
55
+
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
+ ```
44
81
 
45
- The release package contract smoke test verifies that the prepared npm artifact still exposes these entrypoints. Accidentally removing one from the publish manifest should fail package validation before release.
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.
46
83
 
47
84
  ## CLI baseline
48
85
 
49
- The framework-platform CLI baseline includes:
86
+ The command families remain:
50
87
 
51
88
  ```text
52
89
  bcp dev
53
90
  bcp build
91
+ bcp package
54
92
  bcp start
55
93
  bcp routes
56
94
  bcp update
57
95
  bcp db ...
58
96
  bcp generate ...
97
+ bcp config ...
59
98
  bcp doctor
60
99
  bcp inspect
61
100
  bcp help
62
101
  bcp version
63
102
  ```
64
103
 
65
- The Windows-safe `bcp-framework` executable remains an alias for the same CLI.
104
+ The Windows-safe `bcp-framework` executable is an alias for the same CLI.
66
105
 
67
106
  ## Runtime baseline
68
107
 
69
- BCP `0.2.0` continues to target a standalone Node.js web application:
70
-
71
- ```text
72
- BCP source application
73
-
74
- bcp build
75
-
76
- .bcp-framework/build/
77
- ├─ client/
78
- ├─ public/
79
- └─ server/
80
- └─ server.mjs
81
- ```
82
-
83
- Minimum runtime:
84
-
85
108
  ```text
86
109
  Node.js >= 24.11.0
87
110
  React 19
111
+ build target: standalone-node
112
+ package target: standalone-node
88
113
  ```
89
114
 
90
- The platform baseline does not yet promise native `.exe`, mobile or desktop application compilation. Those remain future build-target work rather than part of `0.2.0`.
115
+ Prepared server/runtime entrypoints resolve to compiled ESM where required by the package contract. `0.3.0` adds compiled `application.mjs`.
91
116
 
92
- ## Compatibility policy for 0.2.0
117
+ ## Compatibility policy
93
118
 
94
- `0.2.0` is intended to preserve applications that already work on `0.1.29`. This milestone does not intentionally remove public entrypoints or change the current standalone runtime model.
119
+ For `0.3.0`:
95
120
 
96
- Because BCP remains pre-1.0, applications should still validate upgrades through:
97
-
98
- ```bash
99
- bcp update --check
100
- bcp doctor
101
- npm run typecheck
102
- npm run build
121
+ ```text
122
+ previous baseline: 0.2.19
123
+ intentional breaking changes: false
124
+ baseline: application-platform
103
125
  ```
104
126
 
105
- See [Migrating to 0.2.0](migration-0.2.md).
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.
106
128
 
107
- ## Package consistency validation
129
+ Bug fixes must not silently remove a documented public entrypoint or change its prepared package-resolution/browser-boundary contract.
108
130
 
109
- The `0.2.0` release process adds a platform-contract package smoke check. It verifies the staged npm artifact rather than only source files.
131
+ ## API compatibility gate
110
132
 
111
- The check covers:
112
-
113
- 1. framework version consistency,
114
- 2. required public package exports,
115
- 3. both BCP CLI executable aliases,
116
- 4. minimum Node.js engine declaration,
117
- 5. inclusion of platform/docs metadata in the packed framework,
118
- 6. docs-web target/version consistency,
119
- 7. create-bcp-app version parity with the framework release.
120
-
121
- This is additive to existing unit, integration, E2E, storage, production-hardening and Developer Experience package smoke checks.
133
+ ```bash
134
+ npm run api:check
135
+ ```
122
136
 
123
- ## Docs-web contract
137
+ The gate prepares the publish package, regenerates the current contract in memory and compares it to `docs/api-freeze-snapshot.json`.
124
138
 
125
- `bcp-docs-web` should use two machine-readable files for different purposes:
139
+ To intentionally regenerate the snapshot for a reviewed platform-baseline change:
126
140
 
127
- ```text
128
- docs/docs-web-manifest.json
129
- -> website sections, routes, source Markdown and release navigation
130
-
131
- docs/platform-manifest.json
132
- -> framework version, public entrypoints, runtime target and capability metadata
141
+ ```bash
142
+ npm run api:snapshot
133
143
  ```
134
144
 
135
- Do not duplicate the platform entrypoint list in application code when it can be sourced from `platform-manifest.json`.
145
+ Do not regenerate the snapshot merely to silence an unexpected compatibility failure.
136
146
 
137
- ## Stability labels
147
+ ## Release readiness
138
148
 
139
- Documentation should distinguish:
149
+ ```bash
150
+ npm run release:readiness
151
+ npm run release:readiness:report
152
+ ```
140
153
 
141
- - **platform baseline** public surface covered by the `0.2.0` contract,
142
- - **supported** — behavior covered by current tests/docs,
143
- - **experimental/roadmap** — not guaranteed by the current platform manifest,
144
- - **internal** — not a public application import contract.
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`.
145
155
 
146
156
  ## Release validation
147
157
 
148
- Before `0.2.0` is tagged or published:
158
+ Before `0.3.0` is tagged or published:
149
159
 
150
160
  ```bash
151
161
  npm run typecheck
152
162
  npm run test:unit
153
163
  npm run test:integration
154
- npm run test:package
155
164
  npm run test:e2e
165
+ npm run test:package
166
+ npm run api:check
167
+ npm run release:readiness
156
168
  npm run rc:check
157
169
  ```
158
170
 
159
- The release is not considered published until both `@chidchanun/bcp@0.2.0` and `create-bcp-app@0.2.0` are visible from npm.
171
+ `rc:check` must pass on the exact commit used for the release tag.
172
+
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).