@chidchanun/bcp 0.2.0 → 0.2.2

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.
package/docs/README.md CHANGED
@@ -2,23 +2,26 @@
2
2
 
3
3
  The `docs/` directory is the documentation source of truth for BCP Framework and is organized for **`bcp-docs-web`**.
4
4
 
5
- > **Documentation target:** BCP Framework `0.2.0`
5
+ > **Documentation target:** BCP Framework `0.2.2`
6
6
  >
7
- > **Release state:** unreleased development target. Do not label `0.2.0` as published until RC validation, tagging and npm publication complete.
7
+ > **Release state:** unreleased development target. Do not label `0.2.2` as published until RC validation, tagging and npm publication complete.
8
8
 
9
9
  ## Documentation architecture
10
10
 
11
- BCP `0.2.0` uses two machine-readable manifests:
11
+ BCP uses three machine-readable documentation contracts:
12
12
 
13
13
  ```text
14
14
  docs/docs-web-manifest.json
15
- -> website navigation, routes, Markdown sources and release pages
15
+ -> website navigation, routes, Markdown sources and release routes
16
16
 
17
17
  docs/platform-manifest.json
18
- -> framework version, runtime target, public entrypoints and capability metadata
18
+ -> framework version, runtime target, public entrypoints and capabilities
19
+
20
+ docs/api-manifest.json
21
+ -> public package entrypoints, source ownership and guide mapping
19
22
  ```
20
23
 
21
- Markdown files under `docs/` remain the authored content source.
24
+ Markdown files under `docs/` remain the authored documentation content.
22
25
 
23
26
  Recommended flow:
24
27
 
@@ -28,35 +31,41 @@ framework source/tests
28
31
  docs/
29
32
  ├─ Markdown content
30
33
  ├─ docs-web-manifest.json
31
- └─ platform-manifest.json
34
+ ├─ platform-manifest.json
35
+ └─ api-manifest.json
36
+
37
+ manifest-driven sync
32
38
 
33
39
  bcp-docs-web
34
40
  ```
35
41
 
36
42
  Framework source and tests remain authoritative for runtime behavior.
37
43
 
38
- ## 0.2.0 Framework Platform baseline
44
+ ## 0.2.2 Configuration & Environment v2
39
45
 
40
- `0.2.0` establishes an explicit compatibility/platform contract rather than introducing a new runtime architecture.
46
+ `0.2.2` adds an optional typed application environment schema while preserving the established framework configuration precedence.
41
47
 
42
- New platform documents:
48
+ New/updated documentation sources:
43
49
 
44
50
  | Source | Purpose |
45
51
  | --- | --- |
46
- | `platform-manifest.json` | Machine-readable platform/version/public-entrypoint metadata |
47
- | `platform-contract.md` | Human-readable public platform contract |
48
- | `migration-0.2.md` | Upgrade guide from the `0.1.x` baseline |
49
- | `releases/0.2.0.md` | Release notes for the milestone |
52
+ | `environment-validation.md` | `bcp.environment.*`, validation rules, CLI checks and secret/public boundaries |
53
+ | `configuration.md` | Framework configuration precedence and diagnostics workflow |
54
+ | `platform-manifest.json` | Declares typed environment/config diagnostics capabilities |
55
+ | `api-manifest.json` | Maps `bcp/config` to configuration and environment guides |
56
+ | `releases/0.2.2.md` | Configuration & Environment v2 release notes |
50
57
 
51
- Compatibility intent from `0.1.29`:
58
+ Primary command:
52
59
 
53
- ```text
54
- intentional public-entrypoint removals: none
55
- standalone runtime model change: none
56
- supported production build target: standalone-node
60
+ ```bash
61
+ bcp config check
57
62
  ```
58
63
 
59
- BCP remains pre-1.0, so application upgrades should still be validated before production deployment.
64
+ JSON diagnostics:
65
+
66
+ ```bash
67
+ bcp config check --json
68
+ ```
60
69
 
61
70
  ## Update rule
62
71
 
@@ -65,12 +74,13 @@ When framework behavior or public surface changes:
65
74
  1. Update framework source.
66
75
  2. Add/update regression tests.
67
76
  3. Update the matching Markdown guide.
68
- 4. Update `platform-manifest.json` when public entrypoints/runtime/capability metadata changes.
69
- 5. Update `docs-web-manifest.json` when website navigation/routes change.
70
- 6. Update `docs/releases/<version>.md`.
71
- 7. Change release state to published only after npm publication succeeds.
77
+ 4. Update `platform-manifest.json` when runtime/public-entrypoint/capability metadata changes.
78
+ 5. Update `api-manifest.json` when public API ownership/guide mapping changes.
79
+ 6. Update `docs-web-manifest.json` when website routes/navigation change.
80
+ 7. Update `docs/releases/<version>.md`.
81
+ 8. Change release state only after the release workflow reaches that state.
72
82
 
73
- ## Current docs-web navigation
83
+ ## Docs-web navigation
74
84
 
75
85
  `docs/docs-web-manifest.json` is the authoritative ordered navigation contract.
76
86
 
@@ -85,105 +95,110 @@ Runtime & Infrastructure
85
95
  Storage & Uploads
86
96
  Developer Experience
87
97
  Platform & Compatibility
98
+ API Reference
88
99
  Releases
89
100
  ```
90
101
 
91
- ### Getting Started
102
+ Important current routes:
92
103
 
93
104
  | Website route | Markdown source |
94
105
  | --- | --- |
95
- | `/docs/getting-started` | `getting-started.md` |
96
106
  | `/docs/configuration` | `configuration.md` |
97
- | `/docs/application-modules` | `application-modules.md` |
98
- | `/docs/project-metadata` | `project-metadata.md` |
99
- | `/docs/deployment` | `deployment.md` |
100
- | `/docs/updating` | `updating.md` |
107
+ | `/docs/environment-validation` | `environment-validation.md` |
108
+ | `/docs/platform-contract` | `platform-contract.md` |
109
+ | `/docs/documentation-platform` | `documentation-platform.md` |
110
+ | `/docs/migration-0.2` | `migration-0.2.md` |
111
+ | `/docs/api-reference` | `api-reference.md` |
112
+ | `/releases/0.2.2` | `releases/0.2.2.md` |
101
113
 
102
- ### Routing & Data
114
+ Every route/source pair is validated by unit tests.
103
115
 
104
- | Website route | Markdown source |
105
- | --- | --- |
106
- | `/docs/routing` | `routing.md` |
107
- | `/docs/server-data-loaders` | `server-data-loaders.md` |
108
- | `/docs/route-guards` | `route-guards.md` |
109
- | `/docs/form-actions` | `form-actions.md` |
110
- | `/docs/server-request-apis` | `server-request-apis.md` |
111
- | `/docs/validation` | `validation.md` |
112
- | `/docs/error-handling` | `error-handling.md` |
116
+ ## Configuration source model
113
117
 
114
- ### Authentication
118
+ Framework settings:
115
119
 
116
- | Website route | Markdown source |
117
- | --- | --- |
118
- | `/docs/authentication` | `authentication.md` |
119
- | `/docs/auth-route-guards` | `auth-route-guards.md` |
120
- | `/docs/session-auth` | `session-auth.md` |
120
+ ```text
121
+ bcp.config.ts
122
+ bcp.config.mts
123
+ bcp.config.js
124
+ bcp.config.mjs
125
+ ```
121
126
 
122
- ### Database
127
+ Application environment schema:
123
128
 
124
- | Website route | Markdown source |
125
- | --- | --- |
126
- | `/docs/database` | `database.md` |
127
- | `/docs/database-migrations` | `database-migrations.md` |
129
+ ```text
130
+ bcp.environment.ts
131
+ bcp.environment.mts
132
+ bcp.environment.js
133
+ bcp.environment.mjs
134
+ ```
128
135
 
129
- ### Runtime & Infrastructure
136
+ Only one file from each convention may exist at a time.
130
137
 
131
- | Website route | Markdown source |
132
- | --- | --- |
133
- | `/docs/middleware` | `middleware.md` |
134
- | `/docs/hydration` | `hydration.md` |
135
- | `/docs/development-logging` | `development-logging.md` |
136
- | `/docs/caching` | `caching.md` |
137
- | `/docs/security` | `security.md` |
138
- | `/docs/production-hardening` | `production-hardening.md` |
138
+ The environment schema is optional. Existing applications without `bcp.environment.*` continue to use the previous environment-loading behavior.
139
139
 
140
- ### Storage & Uploads
140
+ Configuration precedence remains:
141
141
 
142
- | Website route | Markdown source |
143
- | --- | --- |
144
- | `/docs/file-upload` | `file-upload.md` |
145
- | `/docs/storage` | `storage.md` |
146
- | `/docs/storage-ecosystem` | `storage-ecosystem.md` |
147
- | `/docs/s3-storage` | `s3-storage.md` |
142
+ ```text
143
+ CLI override
144
+
145
+ BCP_* environment
146
+
147
+ bcp.config.*
148
+
149
+ framework defaults
150
+ ```
148
151
 
149
- ### Developer Experience
152
+ See [Environment Validation](environment-validation.md).
150
153
 
151
- | Website route | Markdown source |
152
- | --- | --- |
153
- | `/docs/generators` | `generators.md` |
154
- | `/docs/developer-tools` | `developer-tools.md` |
154
+ ## Environment security boundary
155
155
 
156
- ### Platform & Compatibility
156
+ `BCP_PUBLIC_*` values may be embedded into browser bundles. They must never contain credentials/private secrets.
157
157
 
158
- | Website route | Markdown source |
159
- | --- | --- |
160
- | `/docs/platform-contract` | `platform-contract.md` |
161
- | `/docs/migration-0.2` | `migration-0.2.md` |
158
+ A variable declared with:
162
159
 
163
- ## Platform manifest
160
+ ```ts
161
+ secret: true
162
+ ```
164
163
 
165
- `docs/platform-manifest.json` is intended for tooling and `bcp-docs-web` metadata displays.
164
+ must not use the `BCP_PUBLIC_` prefix. The configuration validator treats that combination as an error.
166
165
 
167
- It records:
166
+ `secret: true` is validation/tooling metadata and does not encrypt a value.
167
+
168
+ ## Platform manifest
169
+
170
+ `docs/platform-manifest.json` describes the supported framework baseline, including:
168
171
 
169
172
  ```text
170
- schema version
171
- framework/version/release state
173
+ framework version/release state
172
174
  Node/React/runtime baseline
173
175
  production build target
174
176
  public package entrypoints
175
177
  CLI command families
176
- capability groups
177
- storage-provider families
178
+ capability flags
178
179
  previous-baseline compatibility intent
179
180
  documentation contract files
180
181
  ```
181
182
 
182
- Do not treat the manifest as executable runtime configuration. It describes the supported platform surface; framework source/tests remain authoritative.
183
+ `0.2.2` declares the additional capabilities:
184
+
185
+ ```text
186
+ typedEnvironmentSchema
187
+ configurationDiagnostics
188
+ configCheckCli
189
+ ```
190
+
191
+ The supported production target remains:
192
+
193
+ ```text
194
+ standalone-node
195
+ ```
196
+
197
+ ## API manifest
183
198
 
184
- ## Public entrypoint baseline
199
+ `docs/api-manifest.json` describes the public package entrypoints documentation tooling may present as supported API surfaces.
185
200
 
186
- The `0.2.0` platform recognizes:
201
+ Current entrypoints:
187
202
 
188
203
  ```text
189
204
  bcp
@@ -199,151 +214,40 @@ bcp/server-only
199
214
  bcp/middleware
200
215
  ```
201
216
 
202
- `bcp-docs-web` can use this list to build an API-reference index without hard-coding a second entrypoint list.
203
-
204
- ## API guide ownership
205
-
206
- | Entrypoint | Primary guides |
207
- | --- | --- |
208
- | `bcp` | `routing.md`, `server-data-loaders.md`, `form-actions.md` |
209
- | `bcp/server` | `server-request-apis.md`, `file-upload.md`, `storage.md`, `storage-ecosystem.md`, `production-hardening.md` |
210
- | `bcp/auth` | `authentication.md`, `auth-route-guards.md`, `session-auth.md` |
211
- | `bcp/database` | `database.md`, `database-migrations.md` |
212
- | `bcp/validation` | `validation.md` |
213
- | `bcp/error` | `error-handling.md` |
214
- | `bcp/cache` | `caching.md` |
215
- | `bcp/config` | `configuration.md` |
216
- | `bcp/middleware` | `middleware.md` |
217
-
218
- ## Current capability groups
219
-
220
- ### Application
221
-
222
- - React SSR/hydration
223
- - file-based page/API routing
224
- - dynamic/catch-all/optional catch-all routes
225
- - layouts/metadata/route groups
226
- - SPA navigation
227
- - loaders/guards/form actions
228
- - client islands / partial hydration
229
-
230
- ### Server/runtime
231
-
232
- - request-scoped server APIs
233
- - JWT cookie sessions
234
- - Middleware System v2
235
- - validation and structured HTTP errors
236
- - structured logging/request IDs
237
- - response caching/revalidation
238
- - production hardening/timeouts
239
- - graceful shutdown and shutdown hooks
240
- - trusted-proxy controls
241
-
242
- ### Database
243
-
244
- - MySQL framework primitives
245
- - prepared query/execute helpers
246
- - transactions
247
- - migrations/status/rollback
248
-
249
- ### Storage & uploads
250
-
251
- - buffered multipart APIs
252
- - streaming multipart upload
253
- - local filesystem storage
254
- - Amazon S3 / Cloudflare R2 / S3-compatible storage
255
- - streaming reads/writes and byte ranges
256
- - list/copy/move
257
- - portable metadata
258
- - bulk delete
259
- - S3 signed read/write URLs
260
-
261
- ### Developer Experience
262
-
263
- - `create-bcp-app`
264
- - Local / Amazon S3 / Cloudflare R2 storage presets
265
- - non-secret `bcp.project.json`
266
- - page/API/middleware/migration generators
267
- - Doctor/Inspect v2
268
- - framework updater
269
- - Windows-safe `bcp-framework` alias
270
-
271
- ## Build/runtime baseline
272
-
273
- Supported `0.2.0` production target:
274
-
275
- ```text
276
- standalone-node
277
- ```
278
-
279
- Build output:
217
+ `bcp/config` owns both:
280
218
 
281
219
  ```text
282
- .bcp-framework/build/
283
- ├─ client/
284
- ├─ public/
285
- └─ server/
286
- └─ server.mjs
220
+ /docs/configuration
221
+ /docs/environment-validation
287
222
  ```
288
223
 
289
- Native executable, desktop and mobile compilation are not part of the `0.2.0` platform contract.
290
-
291
- ## Releases
224
+ The API-manifest entrypoint set must match the platform public-entrypoint set exactly.
292
225
 
293
- Release notes live in:
226
+ ## bcp-docs-web synchronization
294
227
 
295
- ```text
296
- docs/releases/
297
- ```
298
-
299
- Current manifest routes begin with:
228
+ The docs website sync loads the manifests before Markdown content:
300
229
 
301
230
  ```text
302
- /releases/0.2.0
303
- /releases/0.1.29
304
- /releases/0.1.28
305
- /releases/0.1.27
306
- /releases/0.1.26
307
- ```
308
-
309
- Use release states consistently:
310
-
311
- ```text
312
- published
313
- release candidate
314
- unreleased development target
315
- ```
316
-
317
- The presence of a release note does not mean the npm version is published.
318
-
319
- ## Suggested bcp-docs-web implementation
320
-
321
- At build/startup:
322
-
323
- ```text
324
- load docs-web-manifest.json
325
- load platform-manifest.json
231
+ selected framework ref
326
232
 
327
- validate schema/version relationship
233
+ docs-web-manifest.json
234
+ platform-manifest.json
235
+ api-manifest.json
328
236
 
329
- build sidebar + route map + release map
237
+ validate version/release/API parity
330
238
 
331
239
  load referenced Markdown
332
240
 
333
- render content + prev/next + search index
334
-
335
- show version/release/platform metadata
241
+ synchronize CMS/search/navigation
336
242
  ```
337
243
 
338
- Recommended website behavior:
244
+ Examples from the docs-web project:
339
245
 
340
- 1. Build navigation in manifest order.
341
- 2. Resolve every website route to its Markdown source.
342
- 3. Generate previous/next links from manifest ordering.
343
- 4. Use `versionTarget` and `releaseState` for banners.
344
- 5. Use `platform-manifest.json` for runtime/public-entrypoint metadata.
345
- 6. Index Markdown headings/content for search.
346
- 7. Never ingest runtime `.env` files into public documentation output.
246
+ ```powershell
247
+ npm run docs:sync -- --dry-run
248
+ npm run docs:sync -- --publish-new
249
+ npm run docs:sync -- --ref=v0.2.1
250
+ ```
347
251
 
348
252
  ## Source conventions
349
253
 
@@ -354,11 +258,12 @@ Recommended website behavior:
354
258
  - exact public API names,
355
259
  - clear stable/RC/roadmap labels,
356
260
  - security limitations next to affected APIs,
357
- - no framework-internal module presented as public API.
261
+ - no framework-internal module presented as public API,
262
+ - no secrets/runtime `.env` values in public documentation metadata.
358
263
 
359
264
  ## Release validation
360
265
 
361
- Before publishing `0.2.0`:
266
+ Before publishing `0.2.2`:
362
267
 
363
268
  ```bash
364
269
  npm run typecheck
@@ -369,28 +274,19 @@ npm run test:e2e
369
274
  npm run rc:check
370
275
  ```
371
276
 
372
- `0.2.0` adds a platform-contract package smoke check that verifies:
277
+ Configuration & Environment v2 validation covers:
373
278
 
374
- - prepared framework/create-app version parity,
375
- - required public exports,
376
- - both CLI executable aliases,
377
- - Node.js engine baseline,
378
- - inclusion of platform/docs contract files,
379
- - docs-web target/version consistency.
279
+ - typed environment rules/defaults,
280
+ - project `bcp.environment.*` loading,
281
+ - public/secret safety boundary,
282
+ - production diagnostics,
283
+ - `bcp config check` CLI parsing,
284
+ - dev schema watching,
285
+ - public `bcp/config` exports,
286
+ - prepared npm package files,
287
+ - docs/platform/API version parity.
380
288
 
381
- The final release tag must point to the commit that passed the complete RC sequence.
382
-
383
- ## Documentation QA checklist
384
-
385
- - every manifest Markdown source exists,
386
- - every website route is unique,
387
- - docs-web target matches platform version,
388
- - platform public entrypoints match package exports,
389
- - examples use public APIs/commands,
390
- - release states are accurate,
391
- - secrets are never placed in project/docs metadata,
392
- - proxy trust remains opt-in,
393
- - roadmap features are not presented as release guarantees.
289
+ The final release tag must point to the exact commit that passed the complete RC sequence.
394
290
 
395
291
  ## Repository authority
396
292
 
@@ -403,7 +299,24 @@ tests
403
299
  Markdown docs
404
300
  docs-web manifest
405
301
  platform manifest
302
+ API manifest
406
303
  release notes
407
304
  ```
408
305
 
409
- `bcp-docs-web` is the presentation/search/navigation layer for this content.
306
+ `bcp-docs-web` remains the presentation/search/navigation layer for this content.
307
+
308
+ ## Next direction
309
+
310
+ Planned next milestone:
311
+
312
+ ```text
313
+ 0.2.3 — Database Platform v2
314
+ ```
315
+
316
+ Focus:
317
+
318
+ - database adapter contract,
319
+ - PostgreSQL support,
320
+ - SQLite support,
321
+ - connection lifecycle improvements,
322
+ - provider-consistent migration workflows.
@@ -0,0 +1,130 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "framework": "bcp",
4
+ "version": "0.2.2",
5
+ "releaseState": "unreleased",
6
+ "coverage": "public-entrypoints",
7
+ "entrypoints": [
8
+ {
9
+ "package": "bcp",
10
+ "source": "packages/client/src/index.tsx",
11
+ "environment": "universal",
12
+ "route": "/docs/api-reference#bcp",
13
+ "summary": "React application APIs for routing, links, forms, loader/guard data, islands, metadata and route error handling.",
14
+ "guides": [
15
+ "/docs/routing",
16
+ "/docs/server-data-loaders",
17
+ "/docs/route-guards",
18
+ "/docs/form-actions"
19
+ ]
20
+ },
21
+ {
22
+ "package": "bcp/island",
23
+ "source": "packages/client/src/islands.tsx",
24
+ "environment": "universal",
25
+ "route": "/docs/api-reference#bcp-island",
26
+ "summary": "Partial-hydration island creation and island loading strategy types.",
27
+ "guides": [
28
+ "/docs/hydration"
29
+ ]
30
+ },
31
+ {
32
+ "package": "bcp/cache",
33
+ "source": "packages/client/src/cache.ts",
34
+ "environment": "server-preferred",
35
+ "route": "/docs/api-reference#bcp-cache",
36
+ "summary": "Cache, deduplication, statistics and path/tag revalidation primitives.",
37
+ "guides": [
38
+ "/docs/caching"
39
+ ]
40
+ },
41
+ {
42
+ "package": "bcp/config",
43
+ "source": "packages/client/src/config.ts",
44
+ "environment": "server",
45
+ "route": "/docs/api-reference#bcp-config",
46
+ "summary": "Typed BCP configuration, environment-schema validation and configuration diagnostics APIs.",
47
+ "guides": [
48
+ "/docs/configuration",
49
+ "/docs/environment-validation"
50
+ ]
51
+ },
52
+ {
53
+ "package": "bcp/validation",
54
+ "source": "packages/client/src/validation.ts",
55
+ "environment": "universal",
56
+ "route": "/docs/api-reference#bcp-validation",
57
+ "summary": "Typed validators, parse helpers and structured validation errors.",
58
+ "guides": [
59
+ "/docs/validation"
60
+ ]
61
+ },
62
+ {
63
+ "package": "bcp/error",
64
+ "source": "packages/client/src/http-error.ts",
65
+ "environment": "universal",
66
+ "route": "/docs/api-reference#bcp-error",
67
+ "summary": "Structured HTTP error creation, classification and response helpers.",
68
+ "guides": [
69
+ "/docs/error-handling"
70
+ ]
71
+ },
72
+ {
73
+ "package": "bcp/database",
74
+ "source": "packages/client/src/database.ts",
75
+ "environment": "server",
76
+ "route": "/docs/api-reference#bcp-database",
77
+ "summary": "Database pool, prepared query/execute helpers and transaction primitives.",
78
+ "guides": [
79
+ "/docs/database",
80
+ "/docs/database-migrations"
81
+ ]
82
+ },
83
+ {
84
+ "package": "bcp/auth",
85
+ "source": "packages/client/src/auth.ts",
86
+ "environment": "server",
87
+ "route": "/docs/api-reference#bcp-auth",
88
+ "summary": "Authentication, login/logout/session rotation and route authorization guards.",
89
+ "guides": [
90
+ "/docs/authentication",
91
+ "/docs/auth-route-guards",
92
+ "/docs/session-auth"
93
+ ]
94
+ },
95
+ {
96
+ "package": "bcp/server",
97
+ "source": "packages/client/src/server.ts",
98
+ "environment": "server",
99
+ "route": "/docs/api-reference#bcp-server",
100
+ "summary": "Request context, cookies, logging, production hardening, upload, storage, response and session APIs.",
101
+ "guides": [
102
+ "/docs/server-request-apis",
103
+ "/docs/file-upload",
104
+ "/docs/storage",
105
+ "/docs/storage-ecosystem",
106
+ "/docs/production-hardening"
107
+ ]
108
+ },
109
+ {
110
+ "package": "bcp/server-only",
111
+ "source": "packages/client/src/server-only.mjs",
112
+ "environment": "server-marker",
113
+ "route": "/docs/api-reference#bcp-server-only",
114
+ "summary": "Server-only module boundary marker that prevents accidental browser inclusion.",
115
+ "guides": [
116
+ "/docs/application-modules"
117
+ ]
118
+ },
119
+ {
120
+ "package": "bcp/middleware",
121
+ "source": "packages/server/src/middleware.ts",
122
+ "environment": "server",
123
+ "route": "/docs/api-reference#bcp-middleware",
124
+ "summary": "Middleware System v2 request/response pipeline types and helpers.",
125
+ "guides": [
126
+ "/docs/middleware"
127
+ ]
128
+ }
129
+ ]
130
+ }