@chidchanun/bcp 0.1.29 → 0.2.1

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
@@ -1,72 +1,79 @@
1
1
  # BCP Framework Documentation Source
2
2
 
3
- The `docs/` directory is the documentation source of truth for BCP Framework and is intentionally organized for **`bcp-docs-web`**.
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.1.29`
5
+ > **Documentation target:** BCP Framework `0.2.1`
6
6
  >
7
- > **Release state:** unreleased development target. Do not label `0.1.29` as published until RC validation, tagging and npm publication complete.
7
+ > **Release state:** unreleased development target. Do not label `0.2.1` as published until RC validation, tagging and npm publication complete.
8
8
 
9
- ## Documentation flow
9
+ ## Documentation architecture — 0.2.1
10
+
11
+ BCP uses three machine-readable documentation contracts:
10
12
 
11
13
  ```text
12
- BCP Framework source/tests
13
-
14
- docs/
15
-
16
- Markdown content + docs-web manifest
17
-
18
- bcp-docs-web
19
- ```
14
+ docs/docs-web-manifest.json
15
+ -> website navigation, routes, Markdown sources and release routes
20
16
 
21
- Framework source and tests are authoritative for behavior. Markdown under `docs/` is the authored documentation layer. `bcp-docs-web` should render, organize and search these sources rather than becoming a competing source of truth.
17
+ docs/platform-manifest.json
18
+ -> framework version, runtime target, public entrypoints and capabilities
22
19
 
23
- ## Docs-web navigation contract — 0.1.29
20
+ docs/api-manifest.json
21
+ -> public package entrypoints, source ownership and guide mapping
22
+ ```
24
23
 
25
- `docs/docs-web-manifest.json` is the explicit navigation and route contract for the docs website.
24
+ Markdown files under `docs/` remain the authored documentation content.
26
25
 
27
- It defines:
26
+ Recommended flow:
28
27
 
29
28
  ```text
30
- schema version
31
- framework/version target
32
- release state
33
- section IDs/titles
34
- website routes
35
- Markdown source files
36
- page titles
37
- release routes
29
+ framework source/tests
30
+
31
+ docs/
32
+ ├─ Markdown content
33
+ ├─ docs-web-manifest.json
34
+ ├─ platform-manifest.json
35
+ └─ api-manifest.json
36
+
37
+ manifest-driven sync
38
+
39
+ bcp-docs-web
38
40
  ```
39
41
 
40
- Recommended docs-web workflow:
42
+ Framework source and tests remain authoritative for runtime behavior.
41
43
 
42
- ```text
43
- read docs/docs-web-manifest.json
44
-
45
- generate sidebar + route map
46
-
47
- load referenced Markdown file
48
-
49
- render content/search/prev-next
50
- ```
44
+ ## Documentation Platform
51
45
 
52
- Do not duplicate this mapping in a second hard-coded sidebar unless the website needs a temporary bootstrap fallback.
46
+ `0.2.1` adds a versioned contract between the framework repository and the documentation website.
53
47
 
54
- Markdown remains the content source; the manifest contains navigation metadata only.
48
+ New sources:
49
+
50
+ | Source | Purpose |
51
+ | --- | --- |
52
+ | `api-manifest.json` | Public API entrypoint metadata |
53
+ | `api-reference.md` | Human-readable public package entrypoint reference |
54
+ | `documentation-platform.md` | Docs-web synchronization/versioning contract |
55
+ | `releases/0.2.1.md` | Documentation Platform release notes |
56
+
57
+ The website should not maintain a second hard-coded list of framework pages when those pages exist in `docs-web-manifest.json`.
55
58
 
56
59
  ## Update rule
57
60
 
58
- When framework behavior changes:
61
+ When framework behavior or public surface changes:
59
62
 
60
63
  1. Update framework source.
61
64
  2. Add/update regression tests.
62
- 3. Update the matching Markdown file under `docs/`.
63
- 4. Update `docs/docs-web-manifest.json` when routes/navigation change.
64
- 5. Update `docs/releases/<version>.md`.
65
- 6. Change release state to published only after npm publication succeeds.
65
+ 3. Update the matching Markdown guide.
66
+ 4. Update `platform-manifest.json` when runtime/public-entrypoint/capability metadata changes.
67
+ 5. Update `api-manifest.json` when public API entrypoint ownership changes.
68
+ 6. Update `docs-web-manifest.json` when website routes/navigation change.
69
+ 7. Update `docs/releases/<version>.md`.
70
+ 8. Change release state only after the release workflow reaches that state.
71
+
72
+ ## Docs-web navigation
66
73
 
67
- ## Recommended `bcp-docs-web` navigation
74
+ `docs/docs-web-manifest.json` is the ordered navigation contract.
68
75
 
69
- The current manifest groups documentation into:
76
+ Current sections:
70
77
 
71
78
  ```text
72
79
  Getting Started
@@ -76,389 +83,172 @@ Database
76
83
  Runtime & Infrastructure
77
84
  Storage & Uploads
78
85
  Developer Experience
86
+ Platform & Compatibility
87
+ API Reference
79
88
  Releases
80
89
  ```
81
90
 
82
- ### Getting Started
83
-
84
- | Website route | Markdown source | Purpose |
85
- | --- | --- | --- |
86
- | `/docs/getting-started` | `getting-started.md` | Create and run a BCP application |
87
- | `/docs/configuration` | `configuration.md` | Framework configuration/environment |
88
- | `/docs/application-modules` | `application-modules.md` | Client/server boundaries |
89
- | `/docs/project-metadata` | `project-metadata.md` | `bcp.project.json` schema and security boundary |
90
- | `/docs/deployment` | `deployment.md` | Standalone production deployment |
91
- | `/docs/updating` | `updating.md` | Framework upgrades |
92
-
93
- ### Routing & Data
94
-
95
- | Website route | Markdown source | Purpose |
96
- | --- | --- | --- |
97
- | `/docs/routing` | `routing.md` | File-based page/API routing |
98
- | `/docs/server-data-loaders` | `server-data-loaders.md` | Server-side page data |
99
- | `/docs/route-guards` | `route-guards.md` | Scoped route authorization |
100
- | `/docs/form-actions` | `form-actions.md` | Server mutations/forms |
101
- | `/docs/server-request-apis` | `server-request-apis.md` | Request/cookie/response APIs |
102
- | `/docs/validation` | `validation.md` | Typed validation |
103
- | `/docs/error-handling` | `error-handling.md` | Structured HTTP errors |
91
+ Important `0.2.1` routes:
104
92
 
105
- ### Authentication
106
-
107
- | Website route | Markdown source | Purpose |
108
- | --- | --- | --- |
109
- | `/docs/authentication` | `authentication.md` | Authentication Core |
110
- | `/docs/auth-route-guards` | `auth-route-guards.md` | Auth-aware route guards |
111
- | `/docs/session-auth` | `session-auth.md` | JWT cookie sessions |
93
+ | Website route | Markdown source |
94
+ | --- | --- |
95
+ | `/docs/platform-contract` | `platform-contract.md` |
96
+ | `/docs/documentation-platform` | `documentation-platform.md` |
97
+ | `/docs/migration-0.2` | `migration-0.2.md` |
98
+ | `/docs/api-reference` | `api-reference.md` |
99
+ | `/releases/0.2.1` | `releases/0.2.1.md` |
112
100
 
113
- ### Database
101
+ Every route/source pair is validated by unit tests.
114
102
 
115
- | Website route | Markdown source | Purpose |
116
- | --- | --- | --- |
117
- | `/docs/database` | `database.md` | MySQL database primitives |
118
- | `/docs/database-migrations` | `database-migrations.md` | Migration CLI/files |
103
+ ## Platform manifest
119
104
 
120
- ### Runtime & Infrastructure
105
+ `docs/platform-manifest.json` describes the supported framework baseline:
121
106
 
122
- | Website route | Markdown source | Purpose |
123
- | --- | --- | --- |
124
- | `/docs/middleware` | `middleware.md` | Middleware System v2 |
125
- | `/docs/hydration` | `hydration.md` | SSR/client hydration parity |
126
- | `/docs/development-logging` | `development-logging.md` | Logging/observability |
127
- | `/docs/caching` | `caching.md` | Cache/revalidation |
128
- | `/docs/security` | `security.md` | Security/body limits |
129
- | `/docs/production-hardening` | `production-hardening.md` | Graceful shutdown, trusted proxy and timeouts |
107
+ ```text
108
+ schema version
109
+ framework version/release state
110
+ Node/React/runtime baseline
111
+ production build target
112
+ public package entrypoints
113
+ CLI command families
114
+ capabilities
115
+ storage-provider families
116
+ previous baseline compatibility intent
117
+ documentation contract files
118
+ ```
130
119
 
131
- ### Storage & Uploads
120
+ Supported production target remains:
132
121
 
133
- | Website route | Markdown source | Purpose |
134
- | --- | --- | --- |
135
- | `/docs/file-upload` | `file-upload.md` | Buffered + streaming multipart uploads |
136
- | `/docs/storage` | `storage.md` | StorageAdapter, streaming and file delivery |
137
- | `/docs/storage-ecosystem` | `storage-ecosystem.md` | Listing, copy/move, metadata, bulk delete, signed URLs |
138
- | `/docs/s3-storage` | `s3-storage.md` | S3/R2/MinIO adapter and direct object access |
122
+ ```text
123
+ standalone-node
124
+ ```
139
125
 
140
- ### Developer Experience
126
+ Native executable, desktop and mobile compilation remain future roadmap work.
141
127
 
142
- | Website route | Markdown source | Purpose |
143
- | --- | --- | --- |
144
- | `/docs/generators` | `generators.md` | Page/API/middleware/migration generators |
145
- | `/docs/developer-tools` | `developer-tools.md` | Doctor/Inspect v2 and diagnostics |
128
+ ## API manifest
146
129
 
147
- ## API Reference ownership
130
+ `docs/api-manifest.json` describes the public package entrypoints that documentation tooling may present as supported API surfaces.
148
131
 
149
- Recommended entrypoint groups:
132
+ Current entrypoints:
150
133
 
151
134
  ```text
152
135
  bcp
153
- bcp/server
154
- bcp/auth
155
- bcp/database
156
- bcp/validation
157
- bcp/error
136
+ bcp/island
158
137
  bcp/cache
159
138
  bcp/config
139
+ bcp/validation
140
+ bcp/error
141
+ bcp/database
142
+ bcp/auth
143
+ bcp/server
144
+ bcp/server-only
160
145
  bcp/middleware
161
146
  ```
162
147
 
163
- | Entrypoint | Primary guide |
164
- | --- | --- |
165
- | `bcp` | `routing.md`, `server-data-loaders.md`, `form-actions.md` |
166
- | `bcp/server` | `server-request-apis.md`, `file-upload.md`, `storage.md`, `storage-ecosystem.md`, `s3-storage.md`, `development-logging.md`, `production-hardening.md` |
167
- | `bcp/auth` | `authentication.md`, `auth-route-guards.md` |
168
- | `bcp/database` | `database.md`, `database-migrations.md` |
169
- | `bcp/validation` | `validation.md` |
170
- | `bcp/error` | `error-handling.md` |
171
- | `bcp/cache` | `caching.md` |
172
- | `bcp/config` | `configuration.md` |
173
- | `bcp/middleware` | `middleware.md` |
174
-
175
- ## Current capability groups
176
-
177
- ### Application
178
-
179
- - React SSR/hydration
180
- - file-based page/API routing
181
- - static/dynamic/catch-all/optional-catch-all routes
182
- - route groups/layouts/metadata
183
- - SPA navigation
184
- - loaders/guards/form actions
185
- - client islands / partial hydration
186
- - Fast Refresh
187
-
188
- ### Server and production runtime
189
-
190
- - request-scoped APIs/cookies/redirects/request IDs
191
- - JWT sessions/authentication
192
- - Middleware System v2
193
- - validation/structured errors
194
- - structured logging
195
- - response caching/security gateway
196
- - production hardening gateway
197
- - configurable request/header/keep-alive/shutdown timeouts
198
- - `SIGTERM` / `SIGINT` graceful shutdown
199
- - application shutdown hooks
200
- - trusted-proxy forwarding-header controls
201
-
202
- ### Storage & Uploads
203
-
204
- - buffered multipart upload APIs
205
- - production streaming multipart upload (`storeMultipartFile()`)
206
- - backward-compatible `StorageAdapter` contract
207
- - local filesystem storage
208
- - Amazon S3 / Cloudflare R2 / MinIO-compatible storage
209
- - streaming reads/writes and byte ranges
210
- - ETag/Last-Modified file delivery
211
- - upload/storage limits and abort cleanup
212
- - object listing with cursors
213
- - copy and move
214
- - portable user metadata
215
- - bulk deletion
216
- - S3 presigned read/write URLs
217
- - create-app Local Server / Amazon S3 / Cloudflare R2 presets
218
-
219
- ### Database
220
-
221
- - `bcp/database`
222
- - lazy MySQL pool
223
- - prepared execution/query helpers
224
- - transactions
225
- - migrations/status/rollback
226
-
227
- ### Developer Experience — 0.1.29
228
-
229
- - `create-bcp-app`
230
- - non-secret `bcp.project.json`
231
- - `bcp generate page`
232
- - `bcp generate api`
233
- - `bcp generate middleware`
234
- - `bcp generate migration`
235
- - `bcp update`
236
- - Doctor/Inspect v2
237
- - lockfile/package-manager diagnostics
238
- - duplicate framework declaration checks
239
- - storage/provider diagnostics
240
- - production-build/Docker/hardening diagnostics
241
- - Windows-safe `bcp-framework` alias
242
- - `docs/docs-web-manifest.json`
243
-
244
- ## BCP 0.1.29 documentation focus
245
-
246
- ### Project generators
247
-
248
- ```bash
249
- bcp generate page dashboard/users
250
- bcp generate api users
251
- bcp generate middleware
252
- bcp generate migration create_users
253
- ```
254
-
255
- Page/API/middleware generation requires `--force` before replacing existing target files.
256
-
257
- See `generators.md`.
258
-
259
- ### Doctor / Inspect v2
260
-
261
- Doctor adds deployment/project-health checks without removing previous checks. Inspect keeps its previous JSON fields and adds a `project` object containing lockfile, package manager, project metadata/presets, build presence, Dockerfile, framework declarations, storage provider and hardening status.
262
-
263
- See `developer-tools.md`.
264
-
265
- ### Project metadata
266
-
267
- New `create-bcp-app` projects receive:
148
+ Each API entry records:
268
149
 
269
150
  ```text
270
- bcp.project.json
271
- ```
272
-
273
- The file records scaffold choices only and must never contain credentials/secrets.
274
-
275
- See `project-metadata.md`.
276
-
277
- ### Docs-web contract
278
-
279
- `docs/docs-web-manifest.json` is intended to be consumed directly by `bcp-docs-web` for navigation and route generation.
280
-
281
- The website should still read the Markdown source referenced by each manifest page entry.
282
-
283
- ## CLI commands
284
-
285
- ```bash
286
- bcp dev
287
- bcp routes
288
- bcp build
289
- bcp start
290
- bcp generate page dashboard/users
291
- bcp generate api users
292
- bcp generate middleware
293
- bcp generate migration create_users
294
- bcp doctor
295
- bcp doctor --json
296
- bcp inspect
297
- bcp inspect --json
298
- bcp update
299
- bcp version
300
-
301
- bcp db create create_users
302
- bcp db migrate
303
- bcp db status
304
- bcp db rollback
151
+ package
152
+ source file
153
+ environment boundary
154
+ reference route
155
+ summary
156
+ related guide routes
305
157
  ```
306
158
 
307
- On Windows, direct project-local commands should prefer:
308
-
309
- ```powershell
310
- npm exec -- bcp-framework doctor
311
- npm exec -- bcp-framework inspect
312
- npm exec -- bcp-framework generate page dashboard/users
313
- npm exec -- bcp-framework dev
314
- npm exec -- bcp-framework build
315
- ```
159
+ The API-manifest entrypoint set must match the public-entrypoint set in `platform-manifest.json` exactly.
316
160
 
317
- Inside npm scripts, `bcp` is safe because npm prepends `node_modules/.bin` to `PATH`.
161
+ See [API Reference](api-reference.md).
318
162
 
319
- ## Releases
163
+ ## bcp-docs-web synchronization
320
164
 
321
- Release notes live under:
165
+ The `bcp-docs-web` sync should load all three manifests first.
322
166
 
323
167
  ```text
324
- docs/releases/
325
- ```
326
-
327
- The docs-web manifest currently maps:
328
-
329
- ```text
330
- /releases/0.1.29
331
- /releases/0.1.28
332
- /releases/0.1.27
333
- /releases/0.1.26
334
- /releases/0.1.25
335
- /releases/0.1.24
168
+ selected framework ref
169
+
170
+ docs-web-manifest.json
171
+ platform-manifest.json
172
+ api-manifest.json
173
+
174
+ validate version/release/API parity
175
+
176
+ load only referenced Markdown
177
+
178
+ rewrite internal Markdown links to website routes
179
+
180
+ synchronize CMS/search/navigation
336
181
  ```
337
182
 
338
- Use one of these release states:
183
+ The matching docs-web implementation supports local framework source or a selected Git ref.
339
184
 
340
- ```text
341
- published
342
- release candidate
343
- unreleased development target
344
- ```
185
+ Examples:
345
186
 
346
- The existence of a release note alone does not mean the npm version is published.
347
-
348
- ## Suggested docs-web implementation
349
-
350
- A simple implementation can model the manifest like:
351
-
352
- ```ts
353
- interface DocsWebManifest {
354
- schemaVersion: number;
355
- framework: string;
356
- versionTarget: string;
357
- releaseState: string;
358
- sections: Array<{
359
- id: string;
360
- title: string;
361
- pages: Array<{
362
- route: string;
363
- source: string;
364
- title: string;
365
- }>;
366
- }>;
367
- releases: Array<{
368
- route: string;
369
- source: string;
370
- version: string;
371
- state?: string;
372
- }>;
373
- }
187
+ ```powershell
188
+ npm run docs:sync -- --dry-run
189
+ npm run docs:sync -- --publish-new
190
+ npm run docs:sync -- --ref=v0.2.0
374
191
  ```
375
192
 
376
- Recommended website behavior:
377
-
378
- 1. Load/validate `docs-web-manifest.json` at build/startup.
379
- 2. Build the sidebar in manifest order.
380
- 3. Resolve each route to its referenced Markdown source.
381
- 4. Generate previous/next links from manifest order.
382
- 5. Index rendered Markdown headings/content for search.
383
- 6. Use `versionTarget` / `releaseState` for the site banner.
384
- 7. Use release entries for the release navigation.
193
+ Using a tag/ref is the foundation for historical/versioned documentation without manually copying current Markdown into another source tree.
385
194
 
386
- Do not expose `bcp.project.json` secrets because the project metadata format is intentionally non-secret; runtime `.env` files should never be ingested into public docs output.
195
+ ## Public API guide ownership
387
196
 
388
- ## Suggested website features
389
-
390
- 1. Sidebar from `docs-web-manifest.json`.
391
- 2. Markdown rendering + syntax highlighting.
392
- 3. Previous/next navigation.
393
- 4. Version/release-state banner.
394
- 5. Release pages.
395
- 6. Full-text search.
396
- 7. Copy buttons for code blocks.
397
- 8. Mobile navigation.
398
- 9. GitHub source/edit links.
399
-
400
- Later:
401
-
402
- - generated symbol reference,
403
- - versioned snapshots,
404
- - interactive examples/playgrounds,
405
- - release comparison pages.
197
+ | Entrypoint | Primary guides |
198
+ | --- | --- |
199
+ | `bcp` | `routing.md`, `server-data-loaders.md`, `route-guards.md`, `form-actions.md` |
200
+ | `bcp/island` | `hydration.md` |
201
+ | `bcp/cache` | `caching.md` |
202
+ | `bcp/config` | `configuration.md` |
203
+ | `bcp/validation` | `validation.md` |
204
+ | `bcp/error` | `error-handling.md` |
205
+ | `bcp/database` | `database.md`, `database-migrations.md` |
206
+ | `bcp/auth` | `authentication.md`, `auth-route-guards.md`, `session-auth.md` |
207
+ | `bcp/server` | `server-request-apis.md`, `file-upload.md`, `storage.md`, `storage-ecosystem.md`, `production-hardening.md` |
208
+ | `bcp/server-only` | `application-modules.md` |
209
+ | `bcp/middleware` | `middleware.md` |
406
210
 
407
211
  ## Source conventions
408
212
 
409
- - one H1 per page,
213
+ - one H1 per Markdown page,
410
214
  - stable heading hierarchy,
411
215
  - fenced code blocks with language tags,
412
216
  - relative links between docs,
413
217
  - exact public API names,
414
218
  - clear stable/RC/roadmap labels,
415
219
  - security limitations next to affected APIs,
416
- - runnable examples where possible,
417
- - no private/internal modules presented as public API.
220
+ - no framework-internal module presented as public API,
221
+ - no secrets/runtime `.env` values in public documentation metadata.
222
+
223
+ ## Search and previous/next
224
+
225
+ Search should index Markdown content and headings. Manifest titles/categories/API summaries may be used as metadata.
226
+
227
+ Sidebar and previous/next ordering should follow `docs-web-manifest.json` order so navigation surfaces cannot drift from each other.
418
228
 
419
229
  ## Release validation
420
230
 
421
- Before publishing:
231
+ Before publishing `0.2.1`:
422
232
 
423
233
  ```bash
424
234
  npm run typecheck
425
235
  npm run test:unit
426
236
  npm run test:integration
427
- npm run test:e2e
428
237
  npm run test:package
238
+ npm run test:e2e
429
239
  npm run rc:check
430
240
  ```
431
241
 
432
- For `0.1.29`, validation should cover project generators, Doctor/Inspect v2, create-app project metadata, the existing production hardening runtime and package preparation.
433
-
434
- The release lockfile must be synchronized to `0.1.29` before the final tag.
435
-
436
- ## Documentation QA checklist
437
-
438
- - every manifest Markdown source exists,
439
- - every manifest route is unique,
440
- - examples use public exports/CLI commands,
441
- - version/release states are current,
442
- - Windows direct CLI examples use `npm exec -- bcp-framework`,
443
- - upload/storage/auth security caveats are present,
444
- - release notes match the framework version,
445
- - S3 credentials are never shown as public browser variables,
446
- - project metadata remains non-secret,
447
- - proxy trust remains documented as opt-in,
448
- - roadmap APIs are not presented as release guarantees.
242
+ Documentation Platform validation covers:
449
243
 
450
- ## Next direction after 0.1.29
244
+ - every Markdown source exists,
245
+ - every docs/release route is unique,
246
+ - package/platform/docs/API versions match,
247
+ - API entrypoints match the platform public-entrypoint set,
248
+ - API guide routes exist,
249
+ - prepared npm packages contain the three manifests, API reference and Documentation Platform guide.
451
250
 
452
- Planned **`0.2.0 Framework Platform`** focus:
453
-
454
- - consolidate public API naming/behavior,
455
- - document compatibility expectations,
456
- - stabilize supported production deployment paths,
457
- - complete docs-web integration and documentation coverage,
458
- - publish migration guidance for pre-`0.2.0` applications,
459
- - establish a platform baseline before broader feature expansion.
460
-
461
- These remain roadmap goals until their source/tests land.
251
+ The final release tag must point to the exact commit that passed the complete RC sequence.
462
252
 
463
253
  ## Repository authority
464
254
 
@@ -470,7 +260,24 @@ public exports
470
260
  tests
471
261
  Markdown docs
472
262
  docs-web manifest
263
+ platform manifest
264
+ API manifest
473
265
  release notes
474
266
  ```
475
267
 
476
- `bcp-docs-web` is the presentation/search/navigation layer for this content.
268
+ `bcp-docs-web` remains the presentation/search/navigation layer for this content.
269
+
270
+ ## Next direction
271
+
272
+ Planned next milestone:
273
+
274
+ ```text
275
+ 0.2.2 — Configuration & Environment v2
276
+ ```
277
+
278
+ Focus:
279
+
280
+ - typed production configuration improvements,
281
+ - environment validation,
282
+ - startup configuration diagnostics,
283
+ - configuration schema/inspection tooling.