@chidchanun/bcp 0.2.0 → 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.
@@ -0,0 +1,214 @@
1
+ # API Reference
2
+
3
+ BCP Framework exposes a small set of supported package entrypoints. Import application APIs through these entrypoints instead of private files under `packages/`.
4
+
5
+ The machine-readable source for this page is `docs/api-manifest.json`.
6
+
7
+ ## `bcp`
8
+
9
+ Universal React application APIs.
10
+
11
+ Common exports include:
12
+
13
+ ```ts
14
+ import {
15
+ Form,
16
+ Link,
17
+ createIsland,
18
+ navigate,
19
+ notFound,
20
+ useActionData,
21
+ useActionError,
22
+ useFormStatus,
23
+ useGuardData,
24
+ useLoaderData,
25
+ useNavigation,
26
+ useRouter,
27
+ } from "bcp";
28
+ ```
29
+
30
+ Use this entrypoint for page/client-facing framework APIs, routing, forms, loader/guard data, islands and metadata types.
31
+
32
+ Related guides: [Routing](routing.md), [Server Data Loaders](server-data-loaders.md), [Route Guards](route-guards.md), [Form Actions](form-actions.md).
33
+
34
+ ## `bcp/island`
35
+
36
+ Partial-hydration island APIs.
37
+
38
+ ```ts
39
+ import {
40
+ createIsland,
41
+ } from "bcp/island";
42
+ ```
43
+
44
+ Related guide: [Hydration](hydration.md).
45
+
46
+ ## `bcp/cache`
47
+
48
+ Caching and revalidation APIs.
49
+
50
+ ```ts
51
+ import {
52
+ cache,
53
+ clearCache,
54
+ dedupe,
55
+ getCacheStats,
56
+ revalidatePath,
57
+ revalidateTag,
58
+ } from "bcp/cache";
59
+ ```
60
+
61
+ Related guide: [Caching](caching.md).
62
+
63
+ ## `bcp/config`
64
+
65
+ Typed configuration APIs.
66
+
67
+ ```ts
68
+ import {
69
+ defineConfig,
70
+ readResolvedBcpConfig,
71
+ resolveBcpConfig,
72
+ } from "bcp/config";
73
+ ```
74
+
75
+ Related guide: [Configuration](configuration.md).
76
+
77
+ ## `bcp/validation`
78
+
79
+ Typed validation primitives and `ValidationError`.
80
+
81
+ ```ts
82
+ import {
83
+ array,
84
+ boolean,
85
+ literal,
86
+ nullable,
87
+ number,
88
+ object,
89
+ optional,
90
+ parse,
91
+ safeParse,
92
+ string,
93
+ union,
94
+ } from "bcp/validation";
95
+ ```
96
+
97
+ Related guide: [Validation](validation.md).
98
+
99
+ ## `bcp/error`
100
+
101
+ Structured HTTP error helpers.
102
+
103
+ ```ts
104
+ import {
105
+ HttpError,
106
+ badRequest,
107
+ conflict,
108
+ forbidden,
109
+ internalServerError,
110
+ isHttpError,
111
+ serviceUnavailable,
112
+ throwHttpError,
113
+ tooManyRequests,
114
+ unauthorized,
115
+ unprocessableEntity,
116
+ } from "bcp/error";
117
+ ```
118
+
119
+ Related guide: [Error Handling](error-handling.md).
120
+
121
+ ## `bcp/database`
122
+
123
+ Server-only database primitives.
124
+
125
+ ```ts
126
+ import {
127
+ createDatabase,
128
+ db,
129
+ } from "bcp/database";
130
+ ```
131
+
132
+ Use the public database helpers instead of importing framework-internal pool/runtime modules.
133
+
134
+ Related guides: [Database](database.md), [Database Migrations](database-migrations.md).
135
+
136
+ ## `bcp/auth`
137
+
138
+ Authentication and authorization APIs.
139
+
140
+ ```ts
141
+ import {
142
+ auth,
143
+ createAuth,
144
+ createAuthGuard,
145
+ createRoleGuard,
146
+ getGuardAuth,
147
+ getSession,
148
+ login,
149
+ logout,
150
+ requireAuth,
151
+ requireRole,
152
+ rotateSession,
153
+ } from "bcp/auth";
154
+ ```
155
+
156
+ Related guides: [Authentication](authentication.md), [Auth Route Guards](auth-route-guards.md), [JWT Sessions](session-auth.md).
157
+
158
+ ## `bcp/server`
159
+
160
+ Server request/runtime APIs.
161
+
162
+ This entrypoint includes request context, cookies, logging, graceful shutdown hooks, multipart upload helpers, storage adapters, file delivery, response helpers and low-level session primitives.
163
+
164
+ ```ts
165
+ import {
166
+ clientIp,
167
+ cookies,
168
+ createLocalStorage,
169
+ createLogger,
170
+ createS3Storage,
171
+ createStorageResponse,
172
+ getProductionHardeningConfig,
173
+ headers,
174
+ json,
175
+ redirect,
176
+ registerShutdownHook,
177
+ requestId,
178
+ requestMethod,
179
+ requestUrl,
180
+ storeMultipartFile,
181
+ } from "bcp/server";
182
+ ```
183
+
184
+ Related guides: [Server Request APIs](server-request-apis.md), [File Upload](file-upload.md), [Storage](storage.md), [Storage Ecosystem](storage-ecosystem.md), [Production Hardening](production-hardening.md).
185
+
186
+ ## `bcp/server-only`
187
+
188
+ Server-only module boundary marker.
189
+
190
+ ```ts
191
+ import "bcp/server-only";
192
+ ```
193
+
194
+ Place this import in application modules that must never enter a browser bundle.
195
+
196
+ Related guide: [Application Modules](application-modules.md).
197
+
198
+ ## `bcp/middleware`
199
+
200
+ Middleware System v2 APIs and types.
201
+
202
+ ```ts
203
+ import type {
204
+ MiddlewarePipelineHandler,
205
+ } from "bcp/middleware";
206
+ ```
207
+
208
+ Related guide: [Middleware](middleware.md).
209
+
210
+ ## Stability
211
+
212
+ Only package entrypoints listed in both `docs/platform-manifest.json` and `docs/api-manifest.json` are part of the documented platform surface.
213
+
214
+ Files under internal `packages/*` paths are framework implementation details unless re-exported through a documented public package entrypoint.
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "framework": "bcp",
4
- "versionTarget": "0.2.0",
4
+ "versionTarget": "0.2.1",
5
5
  "releaseState": "unreleased",
6
6
  "sections": [
7
7
  {
8
8
  "id": "getting-started",
9
9
  "title": "Getting Started",
10
+ "description": "Create, configure, deploy and update BCP applications.",
10
11
  "pages": [
11
12
  { "route": "/docs/getting-started", "source": "getting-started.md", "title": "Getting Started" },
12
13
  { "route": "/docs/configuration", "source": "configuration.md", "title": "Configuration" },
@@ -19,6 +20,7 @@
19
20
  {
20
21
  "id": "routing-data",
21
22
  "title": "Routing & Data",
23
+ "description": "Routing, server data, mutations, validation and structured errors.",
22
24
  "pages": [
23
25
  { "route": "/docs/routing", "source": "routing.md", "title": "Routing" },
24
26
  { "route": "/docs/server-data-loaders", "source": "server-data-loaders.md", "title": "Server Data Loaders" },
@@ -32,6 +34,7 @@
32
34
  {
33
35
  "id": "authentication",
34
36
  "title": "Authentication",
37
+ "description": "Authentication core, auth-aware route guards and JWT cookie sessions.",
35
38
  "pages": [
36
39
  { "route": "/docs/authentication", "source": "authentication.md", "title": "Authentication" },
37
40
  { "route": "/docs/auth-route-guards", "source": "auth-route-guards.md", "title": "Auth Route Guards" },
@@ -41,6 +44,7 @@
41
44
  {
42
45
  "id": "database",
43
46
  "title": "Database",
47
+ "description": "Database primitives, transactions and migration workflows.",
44
48
  "pages": [
45
49
  { "route": "/docs/database", "source": "database.md", "title": "Database" },
46
50
  { "route": "/docs/database-migrations", "source": "database-migrations.md", "title": "Database Migrations" }
@@ -49,6 +53,7 @@
49
53
  {
50
54
  "id": "runtime",
51
55
  "title": "Runtime & Infrastructure",
56
+ "description": "Middleware, hydration, logging, caching, security and production hardening.",
52
57
  "pages": [
53
58
  { "route": "/docs/middleware", "source": "middleware.md", "title": "Middleware" },
54
59
  { "route": "/docs/hydration", "source": "hydration.md", "title": "Hydration" },
@@ -61,6 +66,7 @@
61
66
  {
62
67
  "id": "storage",
63
68
  "title": "Storage & Uploads",
69
+ "description": "Multipart uploads, storage adapters, file delivery and object-storage features.",
64
70
  "pages": [
65
71
  { "route": "/docs/file-upload", "source": "file-upload.md", "title": "File Upload" },
66
72
  { "route": "/docs/storage", "source": "storage.md", "title": "Storage & File Delivery" },
@@ -71,6 +77,7 @@
71
77
  {
72
78
  "id": "developer-experience",
73
79
  "title": "Developer Experience",
80
+ "description": "Project generators, diagnostics, project metadata and framework maintenance tooling.",
74
81
  "pages": [
75
82
  { "route": "/docs/generators", "source": "generators.md", "title": "Project Generators" },
76
83
  { "route": "/docs/developer-tools", "source": "developer-tools.md", "title": "Doctor & Inspect" }
@@ -79,14 +86,25 @@
79
86
  {
80
87
  "id": "platform-compatibility",
81
88
  "title": "Platform & Compatibility",
89
+ "description": "Supported platform contracts, documentation integration and migration guidance.",
82
90
  "pages": [
83
91
  { "route": "/docs/platform-contract", "source": "platform-contract.md", "title": "Framework Platform Contract" },
84
- { "route": "/docs/migration-0.2", "source": "migration-0.2.md", "title": "Migrating to 0.2.0" }
92
+ { "route": "/docs/documentation-platform", "source": "documentation-platform.md", "title": "Documentation Platform" },
93
+ { "route": "/docs/migration-0.2", "source": "migration-0.2.md", "title": "Migrating to 0.2.x" }
94
+ ]
95
+ },
96
+ {
97
+ "id": "api-reference",
98
+ "title": "API Reference",
99
+ "description": "Supported BCP package entrypoints and their guide ownership.",
100
+ "pages": [
101
+ { "route": "/docs/api-reference", "source": "api-reference.md", "title": "API Reference" }
85
102
  ]
86
103
  }
87
104
  ],
88
105
  "releases": [
89
- { "route": "/releases/0.2.0", "source": "releases/0.2.0.md", "version": "0.2.0", "state": "unreleased" },
106
+ { "route": "/releases/0.2.1", "source": "releases/0.2.1.md", "version": "0.2.1", "state": "unreleased" },
107
+ { "route": "/releases/0.2.0", "source": "releases/0.2.0.md", "version": "0.2.0" },
90
108
  { "route": "/releases/0.1.29", "source": "releases/0.1.29.md", "version": "0.1.29" },
91
109
  { "route": "/releases/0.1.28", "source": "releases/0.1.28.md", "version": "0.1.28" },
92
110
  { "route": "/releases/0.1.27", "source": "releases/0.1.27.md", "version": "0.1.27" },
@@ -0,0 +1,136 @@
1
+ # Documentation Platform
2
+
3
+ BCP Framework `0.2.1` defines a machine-readable documentation platform so the framework repository remains the source of truth while `bcp-docs-web` acts as the presentation, search and navigation layer.
4
+
5
+ ## Source contracts
6
+
7
+ The documentation platform uses three manifests:
8
+
9
+ ```text
10
+ docs/docs-web-manifest.json
11
+ Navigation, routes, page titles and release routes.
12
+
13
+ docs/platform-manifest.json
14
+ Framework runtime, public entrypoints, capabilities and compatibility baseline.
15
+
16
+ docs/api-manifest.json
17
+ Public package entrypoints, source ownership, environment boundary and guide mapping.
18
+ ```
19
+
20
+ Markdown files under `docs/` remain the authored documentation content.
21
+
22
+ ## Docs-web synchronization
23
+
24
+ `bcp-docs-web` should read the manifests first and then load the Markdown sources they reference.
25
+
26
+ Recommended flow:
27
+
28
+ ```text
29
+ Framework repository / selected ref
30
+
31
+ docs-web-manifest.json
32
+ platform-manifest.json
33
+ api-manifest.json
34
+
35
+ validate matching framework/version
36
+
37
+ load Markdown sources
38
+
39
+ synchronize CMS/search/navigation
40
+
41
+ render docs website
42
+ ```
43
+
44
+ The website must not maintain a competing hard-coded list of framework pages when a page exists in `docs-web-manifest.json`.
45
+
46
+ ## Version and release state
47
+
48
+ The current documentation target and release state come from the framework manifests.
49
+
50
+ For an unreleased development target:
51
+
52
+ ```json
53
+ {
54
+ "version": "0.2.1",
55
+ "releaseState": "unreleased"
56
+ }
57
+ ```
58
+
59
+ A release note existing in the repository does not mean that version has been published to npm. Release state should only move to a published value after the release workflow succeeds.
60
+
61
+ ## API reference contract
62
+
63
+ `docs/api-manifest.json` describes supported public package entrypoints.
64
+
65
+ Each entry records:
66
+
67
+ ```text
68
+ package name
69
+ source file
70
+ environment boundary
71
+ API-reference route
72
+ summary
73
+ related guide routes
74
+ ```
75
+
76
+ The manifest intentionally documents public package boundaries instead of private framework implementation modules.
77
+
78
+ Public entrypoints are also checked against `docs/platform-manifest.json` and the prepared npm package during release validation.
79
+
80
+ ## Historical versions
81
+
82
+ The synchronization workflow accepts a Git ref. This allows documentation to be synchronized from a release tag instead of only from `main`.
83
+
84
+ Example:
85
+
86
+ ```powershell
87
+ npm run docs:sync -- --ref=v0.2.0
88
+ ```
89
+
90
+ A docs website may use this foundation for version snapshots without copying current documentation into a second manually maintained source tree.
91
+
92
+ ## Search
93
+
94
+ Search should index the synchronized Markdown documents, not the manifest JSON itself. Manifest titles, categories and API entrypoint summaries may be added to the search index as metadata.
95
+
96
+ ## Previous / next navigation
97
+
98
+ Previous and next document ordering should follow the order in `docs-web-manifest.json`.
99
+
100
+ This keeps sidebar order and previous/next navigation consistent.
101
+
102
+ ## Security boundary
103
+
104
+ Documentation synchronization must only read files explicitly referenced by validated manifests.
105
+
106
+ Source paths must:
107
+
108
+ - be relative to `docs/`,
109
+ - reject `..` traversal,
110
+ - reject absolute paths,
111
+ - use expected Markdown or JSON source types,
112
+ - never ingest `.env`, credentials or application project secrets.
113
+
114
+ `bcp.project.json` is intentionally non-secret, but a documentation site should still avoid reading arbitrary application project files.
115
+
116
+ ## Release validation
117
+
118
+ Before a Documentation Platform release:
119
+
120
+ ```bash
121
+ npm run typecheck
122
+ npm run test:unit
123
+ npm run test:integration
124
+ npm run test:e2e
125
+ npm run test:package
126
+ npm run rc:check
127
+ ```
128
+
129
+ Validation should ensure:
130
+
131
+ - all docs-web page sources exist,
132
+ - all docs routes are unique,
133
+ - API entrypoints are unique,
134
+ - API entrypoints match the platform public-entrypoint baseline,
135
+ - manifest versions match the framework version,
136
+ - prepared npm artifacts contain the documentation contracts.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "framework": "bcp",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "releaseState": "unreleased",
6
6
  "baseline": "framework-platform",
7
7
  "runtime": {
@@ -53,7 +53,9 @@
53
53
  "storageEcosystem": true,
54
54
  "productionHardening": true,
55
55
  "projectGenerators": true,
56
- "projectDiagnostics": true
56
+ "projectDiagnostics": true,
57
+ "documentationPlatform": true,
58
+ "apiManifest": true
57
59
  },
58
60
  "storageProviders": [
59
61
  "local",
@@ -62,14 +64,18 @@
62
64
  "s3-compatible"
63
65
  ],
64
66
  "compatibility": {
65
- "previousBaseline": "0.1.29",
67
+ "previousBaseline": "0.2.0",
66
68
  "intentionalBreakingChangesFromPreviousBaseline": false,
67
69
  "migrationGuide": "migration-0.2.md"
68
70
  },
69
71
  "documentation": {
70
72
  "navigationManifest": "docs-web-manifest.json",
73
+ "platformManifest": "platform-manifest.json",
74
+ "apiManifest": "api-manifest.json",
71
75
  "platformContract": "platform-contract.md",
76
+ "documentationPlatform": "documentation-platform.md",
77
+ "apiReference": "api-reference.md",
72
78
  "migrationGuide": "migration-0.2.md",
73
- "releaseNotes": "releases/0.2.0.md"
79
+ "releaseNotes": "releases/0.2.1.md"
74
80
  }
75
81
  }
@@ -0,0 +1,132 @@
1
+ # BCP Framework 0.2.1
2
+
3
+ > **Milestone:** Documentation Platform
4
+ >
5
+ > **Release state:** unreleased development target. Do not mark this version as published until local validation, RC checks, tagging and npm publication complete.
6
+
7
+ BCP Framework `0.2.1` turns the framework documentation repository into a versioned, machine-readable source for `bcp-docs-web`.
8
+
9
+ ## Highlights
10
+
11
+ ### API manifest
12
+
13
+ New:
14
+
15
+ ```text
16
+ docs/api-manifest.json
17
+ ```
18
+
19
+ The manifest describes every documented public package entrypoint with:
20
+
21
+ - package name,
22
+ - source ownership,
23
+ - environment boundary,
24
+ - API-reference route,
25
+ - summary,
26
+ - related guide routes.
27
+
28
+ It complements `docs/platform-manifest.json`, which remains the compatibility/public-entrypoint baseline.
29
+
30
+ ### API reference
31
+
32
+ New authored guide:
33
+
34
+ ```text
35
+ docs/api-reference.md
36
+ ```
37
+
38
+ It provides one supported reference surface for:
39
+
40
+ ```text
41
+ bcp
42
+ bcp/island
43
+ bcp/cache
44
+ bcp/config
45
+ bcp/validation
46
+ bcp/error
47
+ bcp/database
48
+ bcp/auth
49
+ bcp/server
50
+ bcp/server-only
51
+ bcp/middleware
52
+ ```
53
+
54
+ ### Documentation platform contract
55
+
56
+ New:
57
+
58
+ ```text
59
+ docs/documentation-platform.md
60
+ ```
61
+
62
+ This defines how `bcp-docs-web` should consume:
63
+
64
+ ```text
65
+ docs-web-manifest.json
66
+ platform-manifest.json
67
+ api-manifest.json
68
+ Markdown sources
69
+ ```
70
+
71
+ The website should use manifests for navigation/version/API metadata rather than maintaining a competing hard-coded document list.
72
+
73
+ ### Manifest-driven docs-web synchronization
74
+
75
+ The matching `bcp-docs-web` update replaces the old manually maintained framework page/category map with a manifest-driven synchronization path.
76
+
77
+ The sync validates that documentation, platform and API manifests agree on the selected framework version before updating the docs CMS.
78
+
79
+ ### Versioned source foundation
80
+
81
+ The docs sync continues to accept framework refs such as:
82
+
83
+ ```powershell
84
+ npm run docs:sync -- --ref=v0.2.0
85
+ ```
86
+
87
+ This provides the foundation for historical/versioned documentation without duplicating authored Markdown by hand.
88
+
89
+ ## Compatibility
90
+
91
+ `0.2.1` is an additive documentation-platform release over the `0.2.0` Framework Platform baseline.
92
+
93
+ There is no intentional application runtime public-entrypoint removal in this milestone.
94
+
95
+ Production remains the standalone Node.js target defined by the `0.2.x` platform contract.
96
+
97
+ ## Validation
98
+
99
+ Before release:
100
+
101
+ ```bash
102
+ npm run typecheck
103
+ npm run test:unit
104
+ npm run test:integration
105
+ npm run test:e2e
106
+ npm run test:package
107
+ npm run rc:check
108
+ ```
109
+
110
+ Documentation validation must additionally confirm:
111
+
112
+ - docs-web routes are unique,
113
+ - every manifest Markdown source exists,
114
+ - API entrypoints are unique,
115
+ - API entrypoints match the platform public-entrypoint set,
116
+ - all manifest versions match the framework package version,
117
+ - prepared npm packages contain all three documentation manifests and new authored guides.
118
+
119
+ ## Next milestone
120
+
121
+ Planned next:
122
+
123
+ ```text
124
+ 0.2.2 — Configuration & Environment v2
125
+ ```
126
+
127
+ Focus:
128
+
129
+ - typed production configuration improvements,
130
+ - environment validation,
131
+ - startup configuration diagnostics,
132
+ - configuration schema/inspection tooling.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chidchanun/bcp",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "BCP Framework - a React full-stack framework with file-based routing, SSR, APIs, middleware, islands, caching and standalone production builds.",
5
5
  "type": "module",
6
6
  "license": "MIT",