@stopnetic/js 0.0.2-pilot → 0.0.4-pilot

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
@@ -6,17 +6,54 @@ frontend build. No React/Vue/Angular dependency or version upgrade is required.
6
6
  The hosting server must run Node.js 22 or newer. This is an MIT-licensed pilot SDK;
7
7
  hosted production/provider validation is still required before paid rollout.
8
8
 
9
- Version **0.0.1-pilot is published** on npm. This repository prepares
10
- **0.0.2-pilot**, which adds a reusable browser/server setup for Netlify, Vercel
9
+ Version **0.0.4-pilot is prepared locally; it is not published yet**. It adds
10
+ complete copyable React Router, Angular Router/HttpClient, Vue Router, Svelte,
11
+ Solid Router and plain JavaScript examples to the generated guide and package.
12
+ Unchanged 0.0.2/0.0.3 guides migrate safely; custom edits require merging.
13
+ Angular, React, Vue, Svelte, Solid and plain JavaScript share the browser/server
14
+ contracts; no React dependency is required. See the
15
+ [complete generated guide](dist/client-guide.md) for SSR, static builds, frameworks,
16
+ client navigation, API protection and runtime restrictions.
17
+
18
+ The currently published **0.0.3-pilot** includes the framework-independent
19
+ server/browser setup, complete Node application wrapper and older-guide
20
+ migration. Version 0.0.2 added the reusable browser/server setup for Netlify, Vercel
11
21
  and Node/Express, a browser access check and optional React boundary. It also
12
22
  normalizes public PEM formatting and rejects placeholder or reused installation
13
- keys as cookie secrets. The new version is not published yet. Install the
14
- currently published manual server pilot with:
23
+ keys as cookie secrets. Install the published pilot with:
15
24
 
16
25
  ```sh
17
26
  npm install @stopnetic/js@pilot
18
27
  ```
19
28
 
29
+ ## Framework implementation examples
30
+
31
+ The guide and `examples/frontend` contain complete, locally tested examples:
32
+
33
+ | Frontend | Example |
34
+ | --- | --- |
35
+ | React | BrowserRouter, full-layout StopneticBoundary, Routes and effect-based API loading |
36
+ | Angular | Route guard/service, layout signals, RouterOutlet and HttpClient |
37
+ | Vue | Vue Router beforeEach/afterEach, gated App.vue and API loading |
38
+ | Svelte | onMount, History API/popstate navigation and abort cleanup |
39
+ | Solid | Router root, useLocation, reactive Show boundary and API loading |
40
+ | Plain JavaScript | DOM rendering, checked navigation and API loading |
41
+
42
+ Each example includes initial access, later navigation, verification redirect,
43
+ pending/denied UI and cancellation. Backend page/API guards remain necessary.
44
+ No framework library is added as a required SDK dependency. The generated guide
45
+ embeds the source; use its file paths and helper instructions when copying it.
46
+ The dashboard's frontend selector shows the same files. For maintenance, run
47
+ `npm run build` in this SDK, then `npm run sync:guides` in dashboard.
48
+
49
+ To rerun the frontend compilation/browser fixtures, build the SDK and run
50
+ `node tests/prepare-framework-tests.mjs` in this directory. This packs the SDK
51
+ and installs pinned test-only libraries inside ignored test-results. Then run
52
+ `.venv/Scripts/python.exe integrations/javascript/tests/framework-browser-check.py`
53
+ from the repository root. The Angular fixture uses an existing Angular install:
54
+ `angular-guide-check.py <project-path>`; it copies source into the workspace,
55
+ compiles the examples and tests browser/Node SSR without changing that project.
56
+
20
57
  For local testing, build and pack from this repository:
21
58
 
22
59
  ```sh
@@ -25,15 +62,20 @@ npm run build
25
62
  npm pack
26
63
  ```
27
64
 
28
- Install the resulting `stopnetic-js-0.0.2-pilot.tgz` into the website project using
65
+ Install the resulting `stopnetic-js-0.0.4-pilot.tgz` into the website project using
29
66
  `npm install <absolute-path-to-tarball>`. The installed package has no Next.js or
30
67
  other runtime dependency. The build packages the same signed decision implementation
31
68
  as the Next.js adapter. Keep `@stopnetic/next` for its Next.js 16 guided installer.
32
69
 
33
70
  ## Reusable client/server setup (requires 0.0.2-pilot)
34
71
 
35
- Use the local tarball above until this version is published. Installing the current
36
- registry pilot (0.0.1) does not provide these new commands or subpath exports.
72
+ Follow the [hosting guide](../../docs/javascript-hosting-guide.md) for the full
73
+ Netlify, Vercel or Node procedure, server settings, page HTTP 404 enforcement,
74
+ frontend/API wiring and diagnosis. The dashboard's Integration and Documentation
75
+ pages offer the same provider choices and complete copyable page-guard examples.
76
+
77
+ The published 0.0.2-pilot includes these commands and subpath exports.
78
+ Older 0.0.1-pilot installations must upgrade before using them.
37
79
 
38
80
  Run setup at the app's package.json, choose hosting, and preview before writing:
39
81
 
@@ -67,7 +109,31 @@ and server functions; Vite alone does not provide the generated server endpoints
67
109
  For Node, use `node --env-file=.env.local your-server.mjs` or your existing
68
110
  server environment loader. Production credentials belong in runtime settings.
69
111
 
70
- ### React Router
112
+ ### Shared browser startup and Node SSR
113
+
114
+ The generated [framework-independent guide](src/client-guide.md) gives one
115
+ browser entry that calls `checkAccess` before importing the application's
116
+ existing bootstrap. Keep Angular's bootstrapApplication, React's createRoot,
117
+ Vue's createApp, Svelte's mount, Solid's render or plain DOM startup unchanged
118
+ in that bootstrap module. Use document links for server-checked navigation,
119
+ or recheck target access in the client router. A browser-only check is UI behavior.
120
+
121
+ For Node SSR use the generated Express helper before static files/rendering,
122
+ or `createStopneticAppHandler` around a Fetch-style application entry (0.0.3).
123
+ The wrapper handles access/verification control endpoints and guards pages and
124
+ APIs before calling the renderer. It preserves context, streams and request
125
+ bodies. Framework hooks with another signature still need their continuation
126
+ adapted; accepting Request/Response does not make an Edge runtime supported.
127
+
128
+ The guide includes Angular SSR/rendering and client router examples. Angular
129
+ SSR compiled with the installed Angular 22 dependencies and served real HTML
130
+ after verification in an isolated local fixture. That does not validate a live
131
+ provider deployment. Netlify's automatic Angular SSR uses Edge; choose Node SSR,
132
+ a Node gateway or a deliberate static build. Do not publish protected prerendered
133
+ HTML. For other frameworks use the same Node server entry and verify their
134
+ actual deployed runtime. React's boundary remains an optional convenience.
135
+
136
+ ### Optional React Router boundary
71
137
 
72
138
  The optional React entry uses Hooks. The core/browser modules need no React.
73
139
  Place this component inside BrowserRouter, wrapping your Routes:
@@ -119,6 +185,21 @@ content or an API authorization token. API wrappers independently check every
119
185
  request and preserve ordinary request bodies. Denials/outages return empty
120
186
  404/503 responses; approved data responses use `private, no-store`.
121
187
 
188
+ For a real HTTP 404 on a Netlify SPA page, use the optional page-serving function
189
+ in `examples/netlify-spa-pages.mjs` and follow
190
+ [`docs/netlify-spa-page-requests.md`](../../docs/netlify-spa-page-requests.md).
191
+ It checks signed access before reading the bundled entry HTML. The browser
192
+ boundary alone cannot change the initial document's HTTP status. This example
193
+ uses the published 0.0.2-pilot server helpers; the setup CLI does not install it
194
+ automatically. Keep static bundles public and private data in guarded APIs.
195
+
196
+ For Vercel page responses, the manual Node routing middleware in
197
+ `examples/vercel-spa-middleware.mjs` checks pages before static HTML, using
198
+ `@vercel/functions` and the existing SDK. The CLI's generated Vercel control
199
+ function alone does not guard page documents. Follow the hosting guide for
200
+ middleware, API/asset routing and SPA rewrite configuration. Local signed tests
201
+ cover it; live Vercel deployment validation remains required.
202
+
122
203
  ### Node servers on other hosts
123
204
 
124
205
  Import `installStopnetic` from generated `stopnetic.server.mjs`, then call