@stopnetic/js 0.0.5-pilot → 0.1.0
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 +77 -44
- package/dist/client-guide.md +406 -27
- package/dist/server.d.ts +17 -17
- package/dist/server.js +125 -123
- package/dist/setup.js +126 -124
- package/examples/frontend/angular/app/app.config.ts +8 -8
- package/examples/frontend/angular/app/app.routes.ts +20 -20
- package/examples/frontend/angular/app/app.ts +21 -21
- package/examples/frontend/angular/app/members.page.ts +21 -21
- package/examples/frontend/angular/app/stopnetic-access.service.ts +27 -27
- package/examples/frontend/angular/main.ts +4 -4
- package/examples/frontend/load-private-data.d.ts +1 -1
- package/examples/frontend/load-private-data.js +9 -9
- package/examples/frontend/react/App.tsx +48 -48
- package/examples/frontend/react/main.tsx +3 -3
- package/examples/frontend/solid/App.tsx +54 -54
- package/examples/frontend/solid/main.tsx +3 -3
- package/examples/frontend/svelte/App.svelte +56 -56
- package/examples/frontend/svelte/main.js +4 -4
- package/examples/frontend/vanilla/main.js +46 -46
- package/examples/frontend/vue/App.vue +17 -17
- package/examples/frontend/vue/Members.vue +14 -14
- package/examples/frontend/vue/main.js +4 -4
- package/examples/frontend/vue/router.js +40 -40
- package/examples/ssr/angular/app.routes.server.ts +5 -0
- package/examples/ssr/angular/server.ts +12 -0
- package/examples/ssr/astro/middleware.js +11 -0
- package/examples/ssr/astro/page.astro +4 -0
- package/examples/ssr/node/fetch.mjs +9 -0
- package/examples/ssr/node/install.mjs +9 -0
- package/examples/ssr/nuxt/middleware.mjs +10 -0
- package/examples/ssr/react/install.mjs +10 -0
- package/examples/ssr/react-router/install.mjs +22 -0
- package/examples/ssr/solidstart/middleware-v1.js +19 -0
- package/examples/ssr/solidstart/middleware-v2.js +25 -0
- package/examples/ssr/sveltekit/hooks.server.js +16 -0
- package/examples/ssr/sveltekit/page.server.js +3 -0
- package/examples/ssr/vue/install.mjs +10 -0
- package/package.json +37 -10
package/README.md
CHANGED
|
@@ -1,35 +1,63 @@
|
|
|
1
|
-
# @stopnetic/js
|
|
1
|
+
# @stopnetic/js - JavaScript and TypeScript website guard
|
|
2
2
|
|
|
3
3
|
Stopnetic checks access **on your server before sending pages, files or API data**.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
no global checking screen. Optional SPA demos for all six frontends explain
|
|
13
|
-
their asynchronous checks and use empty pending content. Unchanged
|
|
14
|
-
0.0.2/0.0.3/0.0.4 guides migrate safely; custom edits require merging.
|
|
15
|
-
Angular, React, Vue, Svelte, Solid and plain JavaScript share the browser/server
|
|
16
|
-
contracts; no React dependency is required. See the
|
|
17
|
-
[complete generated guide](dist/client-guide.md) for SSR, static builds, frameworks,
|
|
18
|
-
client navigation, API protection and runtime restrictions.
|
|
19
|
-
|
|
20
|
-
The currently published **0.0.4-pilot** includes full frontend examples and the
|
|
21
|
-
framework-independent server/browser setup, complete Node application wrapper
|
|
22
|
-
and older-guide migration. Version 0.0.2 added the reusable browser/server setup for Netlify, Vercel
|
|
23
|
-
and Node/Express, a browser access check and optional React boundary. It also
|
|
24
|
-
normalizes public PEM formatting and rejects placeholder or reused installation
|
|
25
|
-
keys as cookie secrets. Install the published pilot with:
|
|
4
|
+
Use it with Node.js and Express, with frontend examples for Angular, React, Vue,
|
|
5
|
+
Svelte, Solid and plain JavaScript. No frontend framework is a required dependency.
|
|
6
|
+
Your hosting server must run **Node.js 22 or newer**; browser-only JavaScript does
|
|
7
|
+
not enforce protection on its own. Keep your existing SSR or static rendering.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
Run inside your website project:
|
|
26
12
|
|
|
27
13
|
```sh
|
|
28
|
-
npm install @stopnetic/js
|
|
14
|
+
npm install @stopnetic/js
|
|
29
15
|
```
|
|
30
16
|
|
|
17
|
+
For Next.js 16 App Router, use [@stopnetic/next](https://www.npmjs.com/package/@stopnetic/next).
|
|
18
|
+
|
|
19
|
+
This release includes server/browser helpers, framework-specific SSR instructions,
|
|
20
|
+
complete optional frontend examples, Netlify/Vercel/Node setup commands and bounded
|
|
21
|
+
public-key parsing for raw, escaped or JSON-quoted public PEM values. Existing
|
|
22
|
+
unmodified generated guides can migrate safely; customized files require merging.
|
|
23
|
+
|
|
24
|
+
Read the [complete generated guide](https://unpkg.com/@stopnetic/js@0.1.0/dist/client-guide.md)
|
|
25
|
+
for SSR, static builds, client navigation, API protection and runtime restrictions.
|
|
26
|
+
Validate the actual deployed routing, caching and provider configuration before
|
|
27
|
+
production use. Browser verification does not prove human identity.
|
|
28
|
+
|
|
31
29
|
## Framework implementation examples
|
|
32
30
|
|
|
31
|
+
SSR apps use the **SSR framework** selector, not the optional browser-demo
|
|
32
|
+
selector. [Framework SSR instructions](https://unpkg.com/@stopnetic/js@0.1.0/dist/client-guide.md#ssr-framework-instructions)
|
|
33
|
+
and `examples/ssr` contain matching server code:
|
|
34
|
+
|
|
35
|
+
| SSR app | Server connection |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| Angular | AngularAppEngine Fetch entry or Express before AngularNodeAppEngine |
|
|
38
|
+
| React Router | Existing Express entry; single-fetch `.data` aliases use page policy |
|
|
39
|
+
| Custom React / Vue | Guard before the existing Node renderer; keep hydration |
|
|
40
|
+
| Nuxt 3/4 (Nitro 2/H3 1) | Root Node server middleware before rendering/APIs |
|
|
41
|
+
| SvelteKit | `handle` before `resolve(event)`; canonical page check for data requests |
|
|
42
|
+
| Astro | `onRequest` before `next()` with an existing Node adapter |
|
|
43
|
+
| SolidStart 1 / 2 | Version-specific request middleware before continuation |
|
|
44
|
+
| Custom Node / plain JavaScript | Root Express middleware or complete Fetch wrapper |
|
|
45
|
+
| Next.js | Dedicated `@stopnetic/next` guide |
|
|
46
|
+
|
|
47
|
+
Merge existing files/context, preserve public routes and keep protected output
|
|
48
|
+
out of prerender/static/CDN caches. These manual snippets are not automatic
|
|
49
|
+
framework installers. Node compatibility does not validate a live provider.
|
|
50
|
+
Only dashboard rules decide verification; Angular-specific flags are not instructions
|
|
51
|
+
for other frameworks. React/Vue libraries without a server use the static option.
|
|
52
|
+
|
|
53
|
+
To test server continuation contracts after `npm run build`, run
|
|
54
|
+
`node tests/prepare-ssr-guide-tests.mjs`, then `node tests/ssr-guide-check.mjs`.
|
|
55
|
+
Dependencies remain in ignored test-results. Native H3 1/2 and Express exercise
|
|
56
|
+
signed access, control isolation, data aliases and unread POST bodies. Astro,
|
|
57
|
+
SvelteKit and SolidStart factory imports use contract shims, not full framework
|
|
58
|
+
builds. Angular's separate fixture compiles/renders real SSR. Live routing,
|
|
59
|
+
prerender/cache behavior and complete framework/provider builds still need validation.
|
|
60
|
+
|
|
33
61
|
The guide and `examples/frontend` contain complete, locally tested OPTIONAL
|
|
34
62
|
browser-only SPA examples. The default document-navigation integration needs
|
|
35
63
|
the server guard and normal links, not these full-layout browser gates. Keep SSR
|
|
@@ -71,19 +99,19 @@ npm run build
|
|
|
71
99
|
npm pack
|
|
72
100
|
```
|
|
73
101
|
|
|
74
|
-
Install the resulting `stopnetic-js-0.0.
|
|
102
|
+
Install the resulting `stopnetic-js-0.1.0.tgz` into the website project using
|
|
75
103
|
`npm install <absolute-path-to-tarball>`. The installed package has no Next.js or
|
|
76
104
|
other runtime dependency. The build packages the same signed decision implementation
|
|
77
105
|
as the Next.js adapter. Keep `@stopnetic/next` for its Next.js 16 guided installer.
|
|
78
106
|
|
|
79
|
-
## Reusable client/server setup
|
|
107
|
+
## Reusable client/server setup
|
|
80
108
|
|
|
81
|
-
Follow the [hosting guide](
|
|
109
|
+
Follow the [hosting guide](https://github.com/KlimentSidorov/stopnetic/blob/main/docs/javascript-hosting-guide.md) for the full
|
|
82
110
|
Netlify, Vercel or Node procedure, server settings, page HTTP 404 enforcement,
|
|
83
111
|
frontend/API wiring and diagnosis. The dashboard's Integration and Documentation
|
|
84
112
|
pages offer the same provider choices and complete copyable page-guard examples.
|
|
85
113
|
|
|
86
|
-
|
|
114
|
+
These commands and subpath exports are included in this release.
|
|
87
115
|
Older 0.0.1-pilot installations must upgrade before using them.
|
|
88
116
|
|
|
89
117
|
Run setup at the app's package.json, choose hosting, and preview before writing:
|
|
@@ -110,7 +138,7 @@ Functions secret store. Copy the generated cookie secret without committing it.
|
|
|
110
138
|
Wire the server page guard and EACH protected API following the generated guide.
|
|
111
139
|
Browser route checks are optional for retained SPA navigation.
|
|
112
140
|
Run `npm exec --no -- stopnetic-js check` after setting credentials (`--local-http`
|
|
113
|
-
for a loopback
|
|
141
|
+
for a loopback local test). This check validates configuration and generated files
|
|
114
142
|
offline; it cannot prove deployment routing, API coverage or browser integration.
|
|
115
143
|
Deploy once, then dashboard changes apply on subsequent guarded requests.
|
|
116
144
|
|
|
@@ -121,7 +149,7 @@ server environment loader. Production credentials belong in runtime settings.
|
|
|
121
149
|
|
|
122
150
|
### Shared browser startup and Node SSR
|
|
123
151
|
|
|
124
|
-
The generated [framework-independent guide](dist/client-guide.md) defaults to
|
|
152
|
+
The generated [framework-independent guide](https://unpkg.com/@stopnetic/js@0.1.0/dist/client-guide.md) defaults to
|
|
125
153
|
server document navigation: leave browser startup/layout intact, use normal
|
|
126
154
|
links, and let the server apply dashboard policies. It also gives an OPTIONAL
|
|
127
155
|
browser startup gate and separate OPTIONAL SPA router demos. Do not combine
|
|
@@ -199,10 +227,10 @@ request and preserve ordinary request bodies. Denials/outages return empty
|
|
|
199
227
|
|
|
200
228
|
For a real HTTP 404 on a Netlify SPA page, use the optional page-serving function
|
|
201
229
|
in `examples/netlify-spa-pages.mjs` and follow
|
|
202
|
-
[`docs/netlify-spa-page-requests.md`](
|
|
230
|
+
[`docs/netlify-spa-page-requests.md`](https://github.com/KlimentSidorov/stopnetic/blob/main/docs/netlify-spa-page-requests.md).
|
|
203
231
|
It checks signed access before reading the bundled entry HTML. The browser
|
|
204
232
|
boundary alone cannot change the initial document's HTTP status. This example
|
|
205
|
-
uses the
|
|
233
|
+
uses the server helpers included in this release; the setup CLI does not install it
|
|
206
234
|
automatically. Keep static bundles public and private data in guarded APIs.
|
|
207
235
|
|
|
208
236
|
For Vercel page responses, the manual Node routing middleware in
|
|
@@ -242,7 +270,7 @@ rollout. Hosting contracts are simulated locally; live provider tests are pendin
|
|
|
242
270
|
| Angular, Vue, React, Svelte SPA or plain HTML/JS | Node/Express server serving its built output, before static files and SPA fallback |
|
|
243
271
|
| Existing Node/Express server, including Express 4 and 5 | First root middleware, before body parsers, routes and data handlers |
|
|
244
272
|
| Node-hosted framework with Web `Request`/`Response` hooks | `createStopneticHandler` before the framework renders or serves data |
|
|
245
|
-
| Next.js 16 App Router | Published `@stopnetic/next
|
|
273
|
+
| Next.js 16 App Router | Published `@stopnetic/next` and its guided installer |
|
|
246
274
|
| Older Next.js with a customer-owned Node server | Generic middleware before the Next request handler; native older Next installers are not supplied |
|
|
247
275
|
| Static-only hosting / browser-only scripts | Needs a server or compatible edge/proxy in front, or a separately protected content API |
|
|
248
276
|
|
|
@@ -387,14 +415,14 @@ could expose an alternative path to protected content.
|
|
|
387
415
|
|
|
388
416
|
An installed guard's first valid request starts the site's account trial. Key
|
|
389
417
|
rotation/revocation and domain/account/subscription gates are checked by the service.
|
|
390
|
-
Access reports are best effort and cannot establish delivery guarantees.
|
|
391
|
-
With the updated dashboard,
|
|
392
|
-
and the first reported access result. The Challenge outcomes panel distinguishes
|
|
393
|
-
allowed, blocked, waiting, not completed and verified without an access result;
|
|
394
|
-
older evidence may be unavailable. It does not identify humans or bots. Install
|
|
395
|
-
the updated SDK on your server after deploying the dashboard update.
|
|
396
|
-
|
|
397
|
-
Validate your actual hosting, cache rules, browser flow, API paths and provider configuration
|
|
418
|
+
Access reports are best effort and cannot establish delivery guarantees.
|
|
419
|
+
With the updated dashboard, the SDK links same-page challenges, verification
|
|
420
|
+
and the first reported access result. The Challenge outcomes panel distinguishes
|
|
421
|
+
allowed, blocked, waiting, not completed and verified without an access result;
|
|
422
|
+
older evidence may be unavailable. It does not identify humans or bots. Install
|
|
423
|
+
the updated SDK on your server after deploying the dashboard update.
|
|
424
|
+
|
|
425
|
+
Validate your actual hosting, cache rules, browser flow, API paths and provider configuration
|
|
398
426
|
before onboarding paying customers.
|
|
399
427
|
|
|
400
428
|
## Maintainer checks and release
|
|
@@ -402,14 +430,19 @@ before onboarding paying customers.
|
|
|
402
430
|
From this folder: `npm ci`, `npm test`, `npm run test:package`. Tests include real
|
|
403
431
|
Node HTTP traffic, Express 4/5 static/SPA/API serving, challenges, body preservation,
|
|
404
432
|
signed decision failures and package consumption from ESM, CommonJS and TypeScript.
|
|
405
|
-
The tarball includes
|
|
406
|
-
examples,
|
|
433
|
+
The tarball includes runtime/types in `dist`, the setup CLI in `bin`, the public
|
|
434
|
+
frontend/SSR examples, README, MIT license and manifest. No secrets, tests, build
|
|
435
|
+
scripts or dashboard are published. Build from the repository
|
|
407
436
|
before packing; published consumers do not need the repository or build scripts.
|
|
408
437
|
|
|
409
438
|
Publishing is a separate owner step after these checks:
|
|
410
439
|
|
|
411
440
|
```sh
|
|
412
|
-
npm publish --access public --tag
|
|
441
|
+
npm publish --access public --tag latest --registry=https://registry.npmjs.org/
|
|
413
442
|
```
|
|
414
443
|
|
|
415
444
|
Publishing this package does not update the existing `@stopnetic/next` release.
|
|
445
|
+
|
|
446
|
+
## Source and support
|
|
447
|
+
|
|
448
|
+
[Source repository](https://github.com/KlimentSidorov/stopnetic/tree/main/integrations/javascript) | [Report an issue](https://github.com/KlimentSidorov/stopnetic/issues)
|