@chidchanun/bcp 0.2.3 → 0.2.5
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 +136 -152
- package/docs/README.md +77 -126
- package/docs/api-manifest.json +3 -2
- package/docs/api-reference.md +22 -2
- package/docs/application-packaging.md +243 -0
- package/docs/auth-route-guards.md +72 -37
- package/docs/auth-session-store.md +204 -0
- package/docs/authentication.md +128 -44
- package/docs/deployment.md +94 -7
- package/docs/docs-web-manifest.json +8 -4
- package/docs/platform-manifest.json +22 -5
- package/docs/releases/0.2.4.md +152 -0
- package/docs/releases/0.2.5.md +152 -0
- package/package.json +1 -1
- package/packages/cli/src/application-packaging.ts +1162 -0
- package/packages/cli/src/args.ts +2 -0
- package/packages/cli/src/bootstrap.ts +1 -0
- package/packages/cli/src/index.ts +60 -2
- package/packages/client/src/auth.ts +16 -0
- package/packages/server/src/auth-guard.ts +95 -82
- package/packages/server/src/auth-session-store.ts +318 -0
- package/packages/server/src/auth.ts +443 -50
package/docs/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
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.
|
|
5
|
+
> **Documentation target:** BCP Framework `0.2.5 — Authentication Platform v2`
|
|
6
6
|
>
|
|
7
|
-
> **Release state:** unreleased development target
|
|
7
|
+
> **Release state:** unreleased development target until RC validation, tagging and npm publication complete.
|
|
8
8
|
|
|
9
9
|
## Documentation architecture
|
|
10
10
|
|
|
@@ -41,32 +41,73 @@ manifest-driven sync
|
|
|
41
41
|
|
|
42
42
|
Framework source and tests remain authoritative for runtime behavior.
|
|
43
43
|
|
|
44
|
-
## 0.2.
|
|
44
|
+
## Current 0.2.x milestones
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
| Version | Milestone |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `0.2.0` | Framework Platform |
|
|
49
|
+
| `0.2.1` | Documentation Platform |
|
|
50
|
+
| `0.2.2` | Configuration & Environment v2 |
|
|
51
|
+
| `0.2.3` | Database Platform v2 |
|
|
52
|
+
| `0.2.4` | Application Packaging |
|
|
53
|
+
| `0.2.5` | Authentication Platform v2 |
|
|
54
|
+
|
|
55
|
+
## 0.2.5 — Authentication Platform v2
|
|
56
|
+
|
|
57
|
+
`0.2.5` keeps stateless signed JWT-cookie authentication as the default and adds optional server-side session state for revocation and inactivity policy.
|
|
47
58
|
|
|
48
59
|
New/updated documentation sources:
|
|
49
60
|
|
|
50
61
|
| Source | Purpose |
|
|
51
62
|
| --- | --- |
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `api-
|
|
56
|
-
| `
|
|
63
|
+
| `authentication.md` | Auth core, revocation, logout-all, rotation and idle timeout |
|
|
64
|
+
| `auth-session-store.md` | `AuthSessionStore`, memory adapter and production-store guidance |
|
|
65
|
+
| `auth-route-guards.md` | Auth, guest and role route guards |
|
|
66
|
+
| `api-reference.md` | Public Authentication Platform v2 exports |
|
|
67
|
+
| `platform-manifest.json` | Authentication v2 capability flags |
|
|
68
|
+
| `api-manifest.json` | `bcp/auth` guide ownership |
|
|
69
|
+
| `releases/0.2.5.md` | Authentication Platform v2 release notes |
|
|
57
70
|
|
|
58
|
-
Primary
|
|
71
|
+
Primary public entrypoint:
|
|
59
72
|
|
|
60
|
-
```
|
|
61
|
-
|
|
73
|
+
```ts
|
|
74
|
+
import {
|
|
75
|
+
auth,
|
|
76
|
+
createAuth,
|
|
77
|
+
createMemoryAuthSessionStore,
|
|
78
|
+
login,
|
|
79
|
+
logout,
|
|
80
|
+
logoutAll,
|
|
81
|
+
requireAuth,
|
|
82
|
+
requireGuest,
|
|
83
|
+
requireRole,
|
|
84
|
+
} from "bcp/auth";
|
|
62
85
|
```
|
|
63
86
|
|
|
64
|
-
|
|
87
|
+
## Authentication security model
|
|
65
88
|
|
|
66
|
-
|
|
67
|
-
|
|
89
|
+
Default mode:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
signed HttpOnly JWT cookie
|
|
93
|
+
↓
|
|
94
|
+
signature + expiry validation
|
|
95
|
+
↓
|
|
96
|
+
authenticated session
|
|
68
97
|
```
|
|
69
98
|
|
|
99
|
+
Optional revocable mode:
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
signed HttpOnly JWT cookie
|
|
103
|
+
+
|
|
104
|
+
server-side sid store
|
|
105
|
+
↓
|
|
106
|
+
revocable authenticated session
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The built-in memory store is intended for development/tests. Multi-process production systems should implement `AuthSessionStore` using shared durable storage.
|
|
110
|
+
|
|
70
111
|
## Update rule
|
|
71
112
|
|
|
72
113
|
When framework behavior or public surface changes:
|
|
@@ -103,76 +144,24 @@ Important current routes:
|
|
|
103
144
|
|
|
104
145
|
| Website route | Markdown source |
|
|
105
146
|
| --- | --- |
|
|
106
|
-
| `/docs/
|
|
107
|
-
| `/docs/
|
|
108
|
-
| `/docs/
|
|
109
|
-
| `/docs/
|
|
110
|
-
| `/docs/
|
|
147
|
+
| `/docs/authentication` | `authentication.md` |
|
|
148
|
+
| `/docs/auth-session-store` | `auth-session-store.md` |
|
|
149
|
+
| `/docs/auth-route-guards` | `auth-route-guards.md` |
|
|
150
|
+
| `/docs/application-packaging` | `application-packaging.md` |
|
|
151
|
+
| `/docs/database` | `database.md` |
|
|
111
152
|
| `/docs/api-reference` | `api-reference.md` |
|
|
112
|
-
| `/releases/0.2.
|
|
153
|
+
| `/releases/0.2.5` | `releases/0.2.5.md` |
|
|
113
154
|
|
|
114
155
|
Every route/source pair is validated by unit tests.
|
|
115
156
|
|
|
116
|
-
## Configuration source model
|
|
117
|
-
|
|
118
|
-
Framework settings:
|
|
119
|
-
|
|
120
|
-
```text
|
|
121
|
-
bcp.config.ts
|
|
122
|
-
bcp.config.mts
|
|
123
|
-
bcp.config.js
|
|
124
|
-
bcp.config.mjs
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Application environment schema:
|
|
128
|
-
|
|
129
|
-
```text
|
|
130
|
-
bcp.environment.ts
|
|
131
|
-
bcp.environment.mts
|
|
132
|
-
bcp.environment.js
|
|
133
|
-
bcp.environment.mjs
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Only one file from each convention may exist at a time.
|
|
137
|
-
|
|
138
|
-
The environment schema is optional. Existing applications without `bcp.environment.*` continue to use the previous environment-loading behavior.
|
|
139
|
-
|
|
140
|
-
Configuration precedence remains:
|
|
141
|
-
|
|
142
|
-
```text
|
|
143
|
-
CLI override
|
|
144
|
-
↓
|
|
145
|
-
BCP_* environment
|
|
146
|
-
↓
|
|
147
|
-
bcp.config.*
|
|
148
|
-
↓
|
|
149
|
-
framework defaults
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
See [Environment Validation](environment-validation.md).
|
|
153
|
-
|
|
154
|
-
## Environment security boundary
|
|
155
|
-
|
|
156
|
-
`BCP_PUBLIC_*` values may be embedded into browser bundles. They must never contain credentials/private secrets.
|
|
157
|
-
|
|
158
|
-
A variable declared with:
|
|
159
|
-
|
|
160
|
-
```ts
|
|
161
|
-
secret: true
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
must not use the `BCP_PUBLIC_` prefix. The configuration validator treats that combination as an error.
|
|
165
|
-
|
|
166
|
-
`secret: true` is validation/tooling metadata and does not encrypt a value.
|
|
167
|
-
|
|
168
157
|
## Platform manifest
|
|
169
158
|
|
|
170
|
-
`docs/platform-manifest.json` describes
|
|
159
|
+
`docs/platform-manifest.json` describes:
|
|
171
160
|
|
|
172
161
|
```text
|
|
173
162
|
framework version/release state
|
|
174
163
|
Node/React/runtime baseline
|
|
175
|
-
production build target
|
|
164
|
+
production build/package target
|
|
176
165
|
public package entrypoints
|
|
177
166
|
CLI command families
|
|
178
167
|
capability flags
|
|
@@ -180,14 +169,6 @@ previous-baseline compatibility intent
|
|
|
180
169
|
documentation contract files
|
|
181
170
|
```
|
|
182
171
|
|
|
183
|
-
`0.2.2` declares the additional capabilities:
|
|
184
|
-
|
|
185
|
-
```text
|
|
186
|
-
typedEnvironmentSchema
|
|
187
|
-
configurationDiagnostics
|
|
188
|
-
configCheckCli
|
|
189
|
-
```
|
|
190
|
-
|
|
191
172
|
The supported production target remains:
|
|
192
173
|
|
|
193
174
|
```text
|
|
@@ -196,7 +177,7 @@ standalone-node
|
|
|
196
177
|
|
|
197
178
|
## API manifest
|
|
198
179
|
|
|
199
|
-
`docs/api-manifest.json` describes
|
|
180
|
+
`docs/api-manifest.json` describes public package entrypoints documentation tooling may present as supported APIs.
|
|
200
181
|
|
|
201
182
|
Current entrypoints:
|
|
202
183
|
|
|
@@ -214,13 +195,6 @@ bcp/server-only
|
|
|
214
195
|
bcp/middleware
|
|
215
196
|
```
|
|
216
197
|
|
|
217
|
-
`bcp/config` owns both:
|
|
218
|
-
|
|
219
|
-
```text
|
|
220
|
-
/docs/configuration
|
|
221
|
-
/docs/environment-validation
|
|
222
|
-
```
|
|
223
|
-
|
|
224
198
|
The API-manifest entrypoint set must match the platform public-entrypoint set exactly.
|
|
225
199
|
|
|
226
200
|
## bcp-docs-web synchronization
|
|
@@ -241,14 +215,6 @@ load referenced Markdown
|
|
|
241
215
|
synchronize CMS/search/navigation
|
|
242
216
|
```
|
|
243
217
|
|
|
244
|
-
Examples from the docs-web project:
|
|
245
|
-
|
|
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
|
-
```
|
|
251
|
-
|
|
252
218
|
## Source conventions
|
|
253
219
|
|
|
254
220
|
- one H1 per Markdown page,
|
|
@@ -263,7 +229,7 @@ npm run docs:sync -- --ref=v0.2.1
|
|
|
263
229
|
|
|
264
230
|
## Release validation
|
|
265
231
|
|
|
266
|
-
Before publishing `0.2.
|
|
232
|
+
Before publishing `0.2.5`:
|
|
267
233
|
|
|
268
234
|
```bash
|
|
269
235
|
npm run typecheck
|
|
@@ -274,16 +240,17 @@ npm run test:e2e
|
|
|
274
240
|
npm run rc:check
|
|
275
241
|
```
|
|
276
242
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
-
|
|
280
|
-
-
|
|
281
|
-
-
|
|
282
|
-
-
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
-
-
|
|
286
|
-
-
|
|
243
|
+
Authentication Platform v2 validation covers:
|
|
244
|
+
|
|
245
|
+
- stateless JWT backward compatibility,
|
|
246
|
+
- session-store registration and lookup,
|
|
247
|
+
- session revocation,
|
|
248
|
+
- logout-all,
|
|
249
|
+
- idle timeout,
|
|
250
|
+
- rotation with old-session revocation,
|
|
251
|
+
- guest route guards,
|
|
252
|
+
- public `bcp/auth` exports,
|
|
253
|
+
- prepared npm package contents,
|
|
287
254
|
- docs/platform/API version parity.
|
|
288
255
|
|
|
289
256
|
The final release tag must point to the exact commit that passed the complete RC sequence.
|
|
@@ -304,19 +271,3 @@ release notes
|
|
|
304
271
|
```
|
|
305
272
|
|
|
306
273
|
`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.
|
package/docs/api-manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"framework": "bcp",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.5",
|
|
5
5
|
"releaseState": "unreleased",
|
|
6
6
|
"coverage": "public-entrypoints",
|
|
7
7
|
"entrypoints": [
|
|
@@ -85,9 +85,10 @@
|
|
|
85
85
|
"source": "packages/client/src/auth.ts",
|
|
86
86
|
"environment": "server",
|
|
87
87
|
"route": "/docs/api-reference#bcp-auth",
|
|
88
|
-
"summary": "Authentication,
|
|
88
|
+
"summary": "Authentication Platform v2 with JWT cookies, optional revocable session stores, idle timeout, logout-all and auth/guest/role route guards.",
|
|
89
89
|
"guides": [
|
|
90
90
|
"/docs/authentication",
|
|
91
|
+
"/docs/auth-session-store",
|
|
91
92
|
"/docs/auth-route-guards",
|
|
92
93
|
"/docs/session-auth"
|
|
93
94
|
]
|
package/docs/api-reference.md
CHANGED
|
@@ -164,25 +164,45 @@ Related guides: [Database](database.md), [Database Migrations](database-migratio
|
|
|
164
164
|
|
|
165
165
|
## `bcp/auth`
|
|
166
166
|
|
|
167
|
-
Authentication
|
|
167
|
+
Server-only Authentication Platform v2 APIs.
|
|
168
168
|
|
|
169
169
|
```ts
|
|
170
170
|
import {
|
|
171
171
|
auth,
|
|
172
172
|
createAuth,
|
|
173
173
|
createAuthGuard,
|
|
174
|
+
createGuestGuard,
|
|
175
|
+
createMemoryAuthSessionStore,
|
|
174
176
|
createRoleGuard,
|
|
175
177
|
getGuardAuth,
|
|
176
178
|
getSession,
|
|
177
179
|
login,
|
|
178
180
|
logout,
|
|
181
|
+
logoutAll,
|
|
179
182
|
requireAuth,
|
|
183
|
+
requireGuest,
|
|
180
184
|
requireRole,
|
|
185
|
+
revokeSession,
|
|
186
|
+
revokeUserSessions,
|
|
181
187
|
rotateSession,
|
|
188
|
+
type AuthApi,
|
|
189
|
+
type AuthLoginOptions,
|
|
190
|
+
type AuthOptions,
|
|
191
|
+
type AuthSession,
|
|
192
|
+
type AuthSessionStore,
|
|
193
|
+
type AuthSessionStoreRecord,
|
|
194
|
+
type AuthUser,
|
|
195
|
+
type MemoryAuthSessionStore,
|
|
182
196
|
} from "bcp/auth";
|
|
183
197
|
```
|
|
184
198
|
|
|
185
|
-
|
|
199
|
+
The default mode remains stateless signed JWT-cookie authentication.
|
|
200
|
+
|
|
201
|
+
Configure `AuthOptions.store` to enable server-side session revocation and `idleTimeout`. `createMemoryAuthSessionStore()` is provided for development/testing; production multi-instance applications should implement `AuthSessionStore` with shared durable storage.
|
|
202
|
+
|
|
203
|
+
`logoutAll()`, `revokeSession()`, and `revokeUserSessions()` require server-side session state. `requireGuest()` / `createGuestGuard()` support login/register routes that should redirect already-authenticated users.
|
|
204
|
+
|
|
205
|
+
Related guides: [Authentication](authentication.md), [Auth Session Stores](auth-session-store.md), [Auth Route Guards](auth-route-guards.md), [JWT Sessions](session-auth.md).
|
|
186
206
|
|
|
187
207
|
## `bcp/server`
|
|
188
208
|
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Application Packaging
|
|
2
|
+
|
|
3
|
+
BCP Framework `0.2.4` adds an application packaging layer on top of the standalone Node.js production build.
|
|
4
|
+
|
|
5
|
+
The goal is to turn a BCP project into a deployment-oriented directory that contains the built application, production dependency metadata, deployment metadata and container starter files without copying source-only development dependencies or project secrets.
|
|
6
|
+
|
|
7
|
+
## Create a package
|
|
8
|
+
|
|
9
|
+
From the application root:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bcp package
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`bcp package` always runs a fresh production build first. This prevents an older `.bcp-framework/build` directory from being packaged accidentally.
|
|
16
|
+
|
|
17
|
+
The output is written to:
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
.bcp-framework/
|
|
21
|
+
└── package/
|
|
22
|
+
├── client/
|
|
23
|
+
├── server/
|
|
24
|
+
│ └── server.mjs
|
|
25
|
+
├── public/ # when the application has public assets
|
|
26
|
+
├── manifest.json
|
|
27
|
+
├── package.json
|
|
28
|
+
├── package-lock.json # when a safe npm v3 production lock can be derived
|
|
29
|
+
├── bcp.package.json
|
|
30
|
+
├── bcp.deployment.json
|
|
31
|
+
├── bcp.env.json
|
|
32
|
+
├── Dockerfile
|
|
33
|
+
├── .dockerignore
|
|
34
|
+
└── README.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The current packaging target is:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
standalone-node
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Native executable, desktop and mobile packaging are not part of `0.2.4`.
|
|
44
|
+
|
|
45
|
+
## Production dependencies
|
|
46
|
+
|
|
47
|
+
The generated package-level `package.json` keeps runtime metadata only:
|
|
48
|
+
|
|
49
|
+
- `dependencies`
|
|
50
|
+
- `optionalDependencies`
|
|
51
|
+
- `peerDependencies`
|
|
52
|
+
- supported peer metadata / overrides when present
|
|
53
|
+
- `engines.node`
|
|
54
|
+
- the standalone `start` script
|
|
55
|
+
|
|
56
|
+
`devDependencies` are intentionally excluded.
|
|
57
|
+
|
|
58
|
+
When the project has an npm lockfile v3 that can be safely converted to the production dependency graph, BCP writes a pruned `package-lock.json` and records:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm ci --omit=dev
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
as the deployment install command.
|
|
65
|
+
|
|
66
|
+
If a safe production lock cannot be derived, packaging continues without copying an unsafe lockfile and records:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm install --omit=dev
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
instead. The CLI prints a warning in that case.
|
|
73
|
+
|
|
74
|
+
This fallback is intentional: an application package must not pretend to be reproducibly locked when the framework cannot prove the lock metadata is safe for the standalone artifact.
|
|
75
|
+
|
|
76
|
+
## Package manifest
|
|
77
|
+
|
|
78
|
+
`bcp.package.json` describes the produced artifact. It includes:
|
|
79
|
+
|
|
80
|
+
- schema version
|
|
81
|
+
- target runtime
|
|
82
|
+
- BCP Framework version
|
|
83
|
+
- application name/version
|
|
84
|
+
- Node.js requirement
|
|
85
|
+
- entrypoint and start command
|
|
86
|
+
- dependency installation command
|
|
87
|
+
- whether a production lockfile is included
|
|
88
|
+
- build/deployment/environment manifest paths
|
|
89
|
+
- package file inventory
|
|
90
|
+
- byte size and SHA-256 digest for each packaged file
|
|
91
|
+
|
|
92
|
+
Example shape:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"schemaVersion": 1,
|
|
97
|
+
"target": "standalone-node",
|
|
98
|
+
"frameworkVersion": "0.2.4",
|
|
99
|
+
"application": {
|
|
100
|
+
"name": "my-app",
|
|
101
|
+
"version": "0.1.0"
|
|
102
|
+
},
|
|
103
|
+
"runtime": {
|
|
104
|
+
"node": ">=24.11.0",
|
|
105
|
+
"entrypoint": "server/server.mjs",
|
|
106
|
+
"startCommand": "npm start"
|
|
107
|
+
},
|
|
108
|
+
"install": {
|
|
109
|
+
"command": "npm ci --omit=dev",
|
|
110
|
+
"lockfile": true,
|
|
111
|
+
"devDependenciesIncluded": false
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The file inventory allows deployment tooling to verify an application package before shipping it to a server or container image.
|
|
117
|
+
|
|
118
|
+
## Deployment manifest
|
|
119
|
+
|
|
120
|
+
`bcp.deployment.json` is a small deployment contract for the current package target. It records:
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
runtime: Node.js
|
|
124
|
+
install: npm ci --omit=dev (or npm install --omit=dev fallback)
|
|
125
|
+
start: npm start
|
|
126
|
+
entrypoint: server/server.mjs
|
|
127
|
+
container starter: Dockerfile
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Future deployment adapters can consume this manifest without changing the current standalone Node.js contract.
|
|
131
|
+
|
|
132
|
+
## Environment manifest and secret safety
|
|
133
|
+
|
|
134
|
+
BCP application packages do **not** copy project `.env` files.
|
|
135
|
+
|
|
136
|
+
`bcp.env.json` contains metadata only. When files such as `.env.example` exist, BCP can record declared variable names, but it does not record their values.
|
|
137
|
+
|
|
138
|
+
For example:
|
|
139
|
+
|
|
140
|
+
```dotenv
|
|
141
|
+
DATABASE_URL=postgresql://user:password@example/db
|
|
142
|
+
BCP_SESSION_SECRET=secret
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
is represented only as names such as:
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"declaredKeys": [
|
|
150
|
+
"BCP_SESSION_SECRET",
|
|
151
|
+
"DATABASE_URL"
|
|
152
|
+
],
|
|
153
|
+
"valuesIncluded": false,
|
|
154
|
+
"environmentFilesIncluded": false
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Supply real secrets through your deployment environment, secret manager or container/orchestrator configuration.
|
|
159
|
+
|
|
160
|
+
Runtime server overrides remain available through:
|
|
161
|
+
|
|
162
|
+
```text
|
|
163
|
+
BCP_HOSTNAME
|
|
164
|
+
BCP_PORT
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Run the package
|
|
168
|
+
|
|
169
|
+
After copying `.bcp-framework/package` to the target machine:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
cd package
|
|
173
|
+
npm ci --omit=dev
|
|
174
|
+
npm start
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
If `bcp.package.json` says `lockfile: false`, use the recorded install command instead.
|
|
178
|
+
|
|
179
|
+
You can also start the bundled entrypoint directly after dependencies are installed:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
node server/server.mjs
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Docker
|
|
186
|
+
|
|
187
|
+
The generated package contains a starter `Dockerfile`:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
docker build -t my-bcp-app .
|
|
191
|
+
docker run --rm -p 3000:3000 my-bcp-app
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Pass runtime environment values with the deployment mechanism you normally use. Do not bake secrets into the image.
|
|
195
|
+
|
|
196
|
+
## Build vs package
|
|
197
|
+
|
|
198
|
+
Use `bcp build` when you need the framework's raw standalone build output:
|
|
199
|
+
|
|
200
|
+
```text
|
|
201
|
+
.bcp-framework/build/
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Use `bcp package` when you need a deployment-oriented artifact:
|
|
205
|
+
|
|
206
|
+
```text
|
|
207
|
+
.bcp-framework/package/
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
In short:
|
|
211
|
+
|
|
212
|
+
```text
|
|
213
|
+
source application
|
|
214
|
+
↓
|
|
215
|
+
bcp build
|
|
216
|
+
↓
|
|
217
|
+
standalone build
|
|
218
|
+
↓
|
|
219
|
+
bcp package
|
|
220
|
+
↓
|
|
221
|
+
deployment package + production metadata
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Determinism
|
|
225
|
+
|
|
226
|
+
The packaging layer writes sorted dependency metadata and a sorted file inventory. File hashes are calculated from the final package content.
|
|
227
|
+
|
|
228
|
+
The underlying BCP build currently retains its build identifier/timestamp behavior, so `0.2.4` does not promise byte-for-byte identical packages across independent build invocations. The integrity manifest is intended for verification of a specific produced artifact, not as a claim of fully reproducible builds.
|
|
229
|
+
|
|
230
|
+
## Validation
|
|
231
|
+
|
|
232
|
+
Framework release validation includes Application Packaging unit and packed-package smoke coverage.
|
|
233
|
+
|
|
234
|
+
Recommended project validation is:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
bcp package
|
|
238
|
+
cd .bcp-framework/package
|
|
239
|
+
npm ci --omit=dev
|
|
240
|
+
npm start
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Then exercise representative routes, API endpoints and any optional runtime providers used by the application.
|