@chidchanun/bcp 0.1.27 → 0.1.29

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/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  BCP Framework is a React full-stack framework focused on file-based routing, SSR, server data loading, guarded application flows, API routes, authentication, database access, validation, logging, uploads, storage and standalone production deployment.
4
4
 
5
- > **Development target:** `0.1.27`
5
+ > **Development target:** `0.1.29`
6
6
  >
7
- > BCP is pre-1.0. The `0.1.27` source adds the Storage Ecosystem and remains an unreleased development target until local validation, RC checks, tagging and npm publication complete.
7
+ > BCP is pre-1.0. The `0.1.29` source adds the Developer Experience milestone and remains an unreleased development target until local validation, RC checks, tagging and npm publication complete.
8
8
 
9
9
  ## Current capabilities
10
10
 
@@ -24,8 +24,9 @@ BCP Framework is a React full-stack framework focused on file-based routing, SSR
24
24
  | Uploads | Buffered multipart helpers and production multipart streaming |
25
25
  | Storage | Local + S3-compatible adapters, streaming, listing, copy/move, metadata, bulk delete and signed S3 URLs |
26
26
  | Caching | Response cache and revalidation primitives |
27
- | Developer tools | `doctor`, `inspect`, updater and route inspection |
28
- | Production | Standalone server build with production middleware pipeline |
27
+ | Developer tools | Project generators, `doctor` / `inspect` v2, updater, route inspection and project metadata |
28
+ | Production | Standalone build, hardening gateway, graceful shutdown, trusted-proxy controls and HTTP timeouts |
29
+ | Documentation | Markdown source map plus `docs/docs-web-manifest.json` for `bcp-docs-web` |
29
30
 
30
31
  ## Requirements
31
32
 
@@ -115,6 +116,37 @@ app/api/users/[id]/route.ts /api/users/:id
115
116
 
116
117
  Read more: [Routing](docs/routing.md)
117
118
 
119
+ ## Project generators — 0.1.29
120
+
121
+ BCP `0.1.29` adds generators for common framework files:
122
+
123
+ ```bash
124
+ bcp generate page dashboard/users
125
+ bcp generate page users/[id]
126
+ bcp generate api users
127
+ bcp generate middleware
128
+ bcp generate migration create_users
129
+ ```
130
+
131
+ Generated targets:
132
+
133
+ ```text
134
+ page -> app/<route>/page.tsx
135
+ api -> app/api/<route>/route.ts
136
+ middleware -> middleware.ts
137
+ migration -> migrations/<timestamp>_<name>.ts
138
+ ```
139
+
140
+ Page/API/middleware generators do not overwrite existing files unless `--force` is explicitly supplied:
141
+
142
+ ```bash
143
+ bcp generate page dashboard/users --force
144
+ ```
145
+
146
+ Migration generation reuses the existing database migration implementation so migration naming and format remain centralized.
147
+
148
+ Read more: [Project Generators](docs/generators.md)
149
+
118
150
  ## Server data, guards and actions
119
151
 
120
152
  Server loaders live next to their route in `loader.ts`. Route authorization can be defined in `guard.ts`, while route-owned mutations live in `actions.ts`.
@@ -229,6 +261,8 @@ const storage =
229
261
  });
230
262
  ```
231
263
 
264
+ `create-bcp-app --storage local` creates `lib/storage.ts` plus a visible `storage/README.md` / `.gitkeep` scaffold. Runtime objects remain ignored by Git.
265
+
232
266
  ### S3 / R2 / MinIO
233
267
 
234
268
  ```ts
@@ -268,7 +302,7 @@ Read more: [Storage and File Delivery](docs/storage.md)
268
302
 
269
303
  ### Storage Ecosystem — 0.1.27
270
304
 
271
- BCP `0.1.27` adds a richer, additive object-storage API without invalidating older `StorageAdapter` implementations:
305
+ BCP `0.1.27` added a richer, additive object-storage API without invalidating older `StorageAdapter` implementations:
272
306
 
273
307
  ```ts
274
308
  import {
@@ -284,72 +318,9 @@ import {
284
318
  } from "bcp/server";
285
319
  ```
286
320
 
287
- Listing supports prefix filtering, limits and opaque cursors:
288
-
289
- ```ts
290
- const page =
291
- await listStorageObjects(
292
- storage,
293
- {
294
- prefix: "documents/",
295
- limit: 50,
296
- }
297
- );
298
- ```
299
-
300
- Copy and move use native adapter operations when available, with portable fallback behavior where practical:
321
+ Listing supports prefix filtering, limits and opaque cursors. Copy and move use native adapter operations when available, with portable fallback behavior where practical. Portable user metadata is string-to-string metadata and is distinct from authorization/business state.
301
322
 
302
- ```ts
303
- await copyStorageObject(
304
- storage,
305
- "incoming/report.pdf",
306
- "archive/report.pdf"
307
- );
308
-
309
- await moveStorageObject(
310
- storage,
311
- "tmp/avatar.webp",
312
- "users/42/avatar.webp"
313
- );
314
- ```
315
-
316
- Portable user metadata is string-to-string metadata and is distinct from application authorization/business state:
317
-
318
- ```ts
319
- await setStorageMetadata(
320
- storage,
321
- "archive/report.pdf",
322
- {
323
- owner: "user-42",
324
- status: "approved",
325
- }
326
- );
327
- ```
328
-
329
- S3-compatible storage also supports short-lived presigned direct-transfer URLs:
330
-
331
- ```ts
332
- const downloadUrl =
333
- await createStorageSignedReadUrl(
334
- storage,
335
- "videos/demo.mp4",
336
- {
337
- expiresIn: 300,
338
- }
339
- );
340
-
341
- const uploadUrl =
342
- await createStorageSignedWriteUrl(
343
- storage,
344
- "uploads/demo.mp4",
345
- {
346
- expiresIn: 300,
347
- contentType: "video/mp4",
348
- }
349
- );
350
- ```
351
-
352
- Local storage intentionally does not emulate signed URLs. Signed URLs are temporary credentials and should only be generated after application authorization.
323
+ S3-compatible storage also supports short-lived presigned direct-transfer URLs. Local storage intentionally does not emulate signed URLs.
353
324
 
354
325
  Read more: [Storage Ecosystem](docs/storage-ecosystem.md)
355
326
 
@@ -401,7 +372,85 @@ Standalone output is written under:
401
372
  └─ server.mjs
402
373
  ```
403
374
 
404
- Read more: [Deployment](docs/deployment.md)
375
+ ### Production Hardening — 0.1.28
376
+
377
+ The standalone runtime is wrapped by a public hardening gateway with configurable HTTP and shutdown behavior:
378
+
379
+ ```dotenv
380
+ BCP_REQUEST_TIMEOUT_MS=120000
381
+ BCP_HEADERS_TIMEOUT_MS=66000
382
+ BCP_KEEP_ALIVE_TIMEOUT_MS=65000
383
+ BCP_SHUTDOWN_TIMEOUT_MS=10000
384
+ BCP_TRUST_PROXY=false
385
+ ```
386
+
387
+ Standalone production handles `SIGTERM` and `SIGINT`, drains the public listener, runs application cleanup hooks and then stops internal runtime layers.
388
+
389
+ ```ts
390
+ import {
391
+ registerShutdownHook,
392
+ } from "bcp/server";
393
+
394
+ registerShutdownHook(
395
+ () => {
396
+ storage.destroy();
397
+ },
398
+ {
399
+ name: "storage",
400
+ }
401
+ );
402
+ ```
403
+
404
+ Trusted proxy mode is disabled by default. Enable `BCP_TRUST_PROXY=true` only when direct untrusted traffic cannot bypass the trusted reverse proxy/load balancer.
405
+
406
+ Read more: [Production Hardening](docs/production-hardening.md)
407
+
408
+ ## Doctor and Inspect v2 — 0.1.29
409
+
410
+ `bcp doctor` now includes additional project/runtime diagnostics for:
411
+
412
+ ```text
413
+ lockfile / package manager
414
+ multiple framework dependency declarations
415
+ standalone production artifact
416
+ Docker + reproducible install guidance
417
+ storage provider
418
+ production-hardening environment validity
419
+ ```
420
+
421
+ `bcp inspect` keeps its existing fields and adds a machine-readable `project` object with project metadata, selected presets and runtime/deployment information.
422
+
423
+ ```powershell
424
+ npm exec -- bcp-framework doctor --json
425
+ npm exec -- bcp-framework inspect --json
426
+ ```
427
+
428
+ Read more: [Developer Tools](docs/developer-tools.md)
429
+
430
+ ## Project metadata — 0.1.29
431
+
432
+ New `create-bcp-app` projects include `bcp.project.json`:
433
+
434
+ ```json
435
+ {
436
+ "schemaVersion": 1,
437
+ "framework": "bcp",
438
+ "projectName": "my-app",
439
+ "packageManager": "npm",
440
+ "presets": {
441
+ "tailwind": true,
442
+ "database": "mysql",
443
+ "auth": "jwt-cookie",
444
+ "storage": "local"
445
+ }
446
+ }
447
+ ```
448
+
449
+ This file stores only non-secret scaffold metadata. Credentials, database passwords, access keys, JWT/session secrets and tokens stay in environment/server-only configuration.
450
+
451
+ Existing projects without the file continue to work; diagnostic tooling falls back to project files where practical.
452
+
453
+ Read more: [Project Metadata](docs/project-metadata.md)
405
454
 
406
455
  ## Windows CLI
407
456
 
@@ -416,6 +465,7 @@ npm exec -- bcp-framework --version
416
465
  npm exec -- bcp-framework doctor
417
466
  npm exec -- bcp-framework inspect
418
467
  npm exec -- bcp-framework routes
468
+ npm exec -- bcp-framework generate page dashboard/users
419
469
  npm exec -- bcp-framework dev
420
470
  npm exec -- bcp-framework build
421
471
  ```
@@ -428,7 +478,7 @@ Read more: [Developer Tools](docs/developer-tools.md)
428
478
  bcp update
429
479
  bcp update --check
430
480
  bcp update --dry-run
431
- bcp update 0.1.27
481
+ bcp update 0.1.29
432
482
  bcp update next
433
483
  ```
434
484
 
@@ -450,16 +500,39 @@ A version must not be tagged or published until its RC and packed-package verifi
450
500
 
451
501
  Read more: [Releasing](docs/releasing.md)
452
502
 
453
- ## Documentation source
503
+ ## Documentation source and `bcp-docs-web`
454
504
 
455
505
  The `docs/` directory is the authored source for **`bcp-docs-web`**.
456
506
 
507
+ Starting with `0.1.29`, docs-web should consume:
508
+
509
+ ```text
510
+ docs/docs-web-manifest.json
511
+ ```
512
+
513
+ for sidebar/navigation and route mapping. Markdown files remain the documentation content source of truth.
514
+
515
+ The manifest contains:
516
+
517
+ ```text
518
+ section id/title
519
+ website route
520
+ Markdown source file
521
+ page title
522
+ version target
523
+ release state
524
+ release routes
525
+ ```
526
+
457
527
  Recommended starting points:
458
528
 
529
+ - [Docs-Web Manifest](docs/docs-web-manifest.json)
459
530
  - [Documentation Source Map](docs/README.md)
460
531
  - [Getting Started](docs/getting-started.md)
461
532
  - [Configuration](docs/configuration.md)
533
+ - [Project Metadata](docs/project-metadata.md)
462
534
  - [Routing](docs/routing.md)
535
+ - [Project Generators](docs/generators.md)
463
536
  - [Server Data Loaders](docs/server-data-loaders.md)
464
537
  - [Route Guards](docs/route-guards.md)
465
538
  - [Form Actions](docs/form-actions.md)
@@ -468,6 +541,7 @@ Recommended starting points:
468
541
  - [Storage and File Delivery](docs/storage.md)
469
542
  - [Storage Ecosystem](docs/storage-ecosystem.md)
470
543
  - [S3-Compatible Storage](docs/s3-storage.md)
544
+ - [Production Hardening](docs/production-hardening.md)
471
545
  - [Authentication](docs/authentication.md)
472
546
  - [Database](docs/database.md)
473
547
  - [Middleware](docs/middleware.md)
@@ -487,20 +561,22 @@ Recommended starting points:
487
561
  | `0.1.25` | Storage Adapters and File Delivery |
488
562
  | `0.1.26` | S3-Compatible Storage and Production Streaming |
489
563
  | `0.1.27` | Storage Ecosystem |
564
+ | `0.1.28` | Production Hardening |
565
+ | `0.1.29` | Developer Experience |
490
566
 
491
567
  ## Next direction
492
568
 
493
- After `0.1.27`, the planned milestone is **`0.1.28Production Hardening`**:
569
+ After `0.1.29`, the planned major milestone is **`0.2.0Framework Platform`**.
570
+
571
+ The focus should be consolidation rather than unrelated feature growth:
494
572
 
495
- 1. graceful HTTP shutdown and active-request draining,
496
- 2. database/S3 resource cleanup,
497
- 3. trusted proxy and forwarded-header handling,
498
- 4. request/server timeout controls,
499
- 5. security hardening,
500
- 6. Docker and standalone-runtime regression coverage,
501
- 7. stronger startup/runtime diagnostics.
573
+ 1. public API consistency and compatibility expectations,
574
+ 2. production-runtime stabilization across supported deployment paths,
575
+ 3. documentation completeness and docs-web integration,
576
+ 4. migration guidance for pre-`0.2.0` applications,
577
+ 5. a documented platform baseline for routing, data, auth, database, storage and runtime APIs.
502
578
 
503
- These are roadmap items, not `0.1.27` guarantees.
579
+ These are roadmap goals, not `0.1.29` guarantees.
504
580
 
505
581
  ## License
506
582