@thomas.f/prnext 0.1.16-alpha → 0.1.18-alpha

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.
Files changed (215) hide show
  1. package/AI.md +63 -0
  2. package/README.md +35 -503
  3. package/build/ADAPTERS.md +27 -2
  4. package/build/actions.mjs +6 -1
  5. package/build/analyze.mjs +340 -0
  6. package/build/app-config.mjs +20 -8
  7. package/build/app-static.mjs +41 -14
  8. package/build/app-styles.mjs +79 -0
  9. package/build/app.mjs +99 -31
  10. package/build/build-lock.mjs +6 -6
  11. package/build/bundle-runtime.mjs +39 -11
  12. package/build/cache-components.mjs +1 -1
  13. package/build/cache-handlers.mjs +1 -1
  14. package/build/check.mjs +56 -11
  15. package/build/compact-css.mjs +53 -0
  16. package/build/compilation-cache.mjs +269 -0
  17. package/build/compilation-store.mjs +142 -0
  18. package/build/compiler.mjs +51 -4
  19. package/build/concurrent.mjs +12 -0
  20. package/build/config.mjs +50 -13
  21. package/build/create.mjs +239 -0
  22. package/build/css-modules.mjs +65 -10
  23. package/build/deployment-assets.mjs +89 -0
  24. package/build/deployment-config.mjs +18 -0
  25. package/build/dev-compiler-health.mjs +11 -0
  26. package/build/dev-css-update.mjs +85 -0
  27. package/build/dev-dependencies.mjs +44 -0
  28. package/build/dev-discovery.mjs +28 -0
  29. package/build/dev-worker.mjs +14 -5
  30. package/build/dev.mjs +64 -6
  31. package/build/dynamic.mjs +1 -1
  32. package/build/edge.mjs +5 -4
  33. package/build/fonts.mjs +1 -1
  34. package/build/framework-imports.mjs +50 -0
  35. package/build/html-only-config.mjs +53 -0
  36. package/build/html-only-graph.mjs +67 -0
  37. package/build/incremental.mjs +8 -4
  38. package/build/index.mjs +140 -112
  39. package/build/inspect.mjs +3 -0
  40. package/build/inspection-summary.mjs +37 -4
  41. package/build/instrumentation.mjs +30 -0
  42. package/build/loader-cache.mjs +53 -26
  43. package/build/metadata-routes.mjs +3 -4
  44. package/build/migrate.mjs +60 -57
  45. package/build/migration-audit.mjs +1 -1
  46. package/build/native-type-config.mjs +37 -0
  47. package/build/npm-packages.mjs +3 -18
  48. package/build/package-manager.mjs +308 -0
  49. package/build/persistent-cache.mjs +112 -0
  50. package/build/precompress.mjs +62 -30
  51. package/build/prerender-cache.mjs +70 -0
  52. package/build/prerender-config.mjs +29 -0
  53. package/build/prerender-pages.mjs +100 -0
  54. package/build/prerender-pool.mjs +165 -0
  55. package/build/prerender-process-worker.mjs +58 -0
  56. package/build/prerender-worker.mjs +10 -0
  57. package/build/production-builder.mjs +129 -0
  58. package/build/react-compiler-report.mjs +225 -0
  59. package/build/react-compiler.mjs +139 -0
  60. package/build/runtime-contract.mjs +2 -2
  61. package/build/scan.mjs +4 -4
  62. package/build/source-analysis.mjs +42 -0
  63. package/build/static-adapter.mjs +13 -5
  64. package/build/static-export.mjs +4 -4
  65. package/build/static-input.mjs +48 -0
  66. package/build/styles.mjs +17 -3
  67. package/build/transform-cache.mjs +37 -4
  68. package/build/transform.mjs +1 -1
  69. package/build/type-command.mjs +41 -0
  70. package/build/typed-routes.mjs +95 -0
  71. package/build/typescript-dev-worker.mjs +18 -0
  72. package/build/typescript-dev.mjs +49 -0
  73. package/build/typescript-native-worker.mjs +55 -0
  74. package/build/typescript-native.mjs +18 -0
  75. package/build/typescript-toolchain.mjs +19 -0
  76. package/build/typescript-watch.mjs +22 -0
  77. package/build/typescript.mjs +11 -8
  78. package/build/webpack-graph.mjs +170 -30
  79. package/build/worker-memory.mjs +9 -0
  80. package/build/worker-preload.mjs +9 -0
  81. package/cli.mjs +162 -122
  82. package/compat/activity-cache.cjs +26 -0
  83. package/compat/after.cjs +6 -4
  84. package/compat/app-layout-context.cjs +52 -2
  85. package/compat/base64.cjs +10 -0
  86. package/compat/cache-handlers.cjs +12 -2
  87. package/compat/cache-wire.cjs +28 -0
  88. package/compat/cache.cjs +2 -1
  89. package/compat/cache.d.cts +4 -0
  90. package/compat/cookies.cjs +21 -5
  91. package/compat/data-cache.cjs +12 -8
  92. package/compat/flight-delta.cjs +150 -0
  93. package/compat/headers.cjs +4 -2
  94. package/compat/incremental-cache.cjs +20 -7
  95. package/compat/index.d.ts +89 -10
  96. package/compat/link.cjs +12 -9
  97. package/compat/link.d.cts +4 -3
  98. package/compat/navigation-authorization.cjs +9 -0
  99. package/compat/navigation-stages.cjs +19 -0
  100. package/compat/navigation.d.cts +4 -3
  101. package/compat/offline-store.cjs +11 -0
  102. package/compat/offline.cjs +5 -0
  103. package/compat/offline.d.cts +2 -0
  104. package/compat/redis-cache.cjs +201 -0
  105. package/compat/redis-cache.d.cts +37 -0
  106. package/compat/router.d.cts +4 -3
  107. package/compat/server-primitives.cjs +31 -11
  108. package/compat/server.d.cts +15 -2
  109. package/compat/static-generation.cjs +7 -0
  110. package/compat/typed-route.d.cts +17 -0
  111. package/compat/use-cache.cjs +3 -0
  112. package/docs/ai/compatibility.md +275 -0
  113. package/docs/ai/data.md +288 -0
  114. package/docs/ai/deployment.md +269 -0
  115. package/docs/ai/manifest.json +11 -0
  116. package/docs/ai/quickstart.md +171 -0
  117. package/docs/ai/routing.md +214 -0
  118. package/docs/ai/troubleshooting.md +155 -0
  119. package/index.mjs +2 -0
  120. package/native/diagnostics.mjs +34 -0
  121. package/native/resolve.mjs +7 -2
  122. package/package.json +44 -7
  123. package/release/ai-docs.mjs +48 -0
  124. package/release/verify.mjs +2 -0
  125. package/runtime/action-client.mjs +10 -4
  126. package/runtime/action-server.mjs +2 -0
  127. package/runtime/ai-docs.mjs +202 -0
  128. package/runtime/app-client.mjs +226 -68
  129. package/runtime/app-content.mjs +4 -3
  130. package/runtime/app-partial-client.mjs +3 -0
  131. package/runtime/app-partial.mjs +1 -1
  132. package/runtime/app-prefetch-constants.mjs +4 -0
  133. package/runtime/app-prefetch.mjs +2 -3
  134. package/runtime/app-render-key.mjs +5 -0
  135. package/runtime/app-render.mjs +100 -28
  136. package/runtime/app-routing.mjs +22 -9
  137. package/runtime/app-static.mjs +18 -8
  138. package/runtime/app-stream-html.mjs +10 -53
  139. package/runtime/app-style-selection.mjs +34 -0
  140. package/runtime/app-styles.mjs +154 -0
  141. package/runtime/cache-components-rsc.mjs +4 -1
  142. package/runtime/cache-request.mjs +2 -1
  143. package/runtime/cloud/archive.mjs +5 -6
  144. package/runtime/compile-cache.mjs +8 -0
  145. package/runtime/deployment-client.mjs +19 -0
  146. package/runtime/dev-ai-brands.mjs +26 -0
  147. package/runtime/dev-ai-style.mjs +99 -0
  148. package/runtime/dev-build-reasons.mjs +25 -0
  149. package/runtime/dev-cache-control.mjs +53 -0
  150. package/runtime/dev-client.mjs +245 -46
  151. package/runtime/dev-compiler-broker.mjs +42 -0
  152. package/runtime/dev-console-copy.mjs +19 -0
  153. package/runtime/dev-console.mjs +106 -0
  154. package/runtime/dev-dependency-graph.mjs +40 -0
  155. package/runtime/dev-element-picker-style.mjs +27 -0
  156. package/runtime/dev-element-picker.mjs +213 -0
  157. package/runtime/dev-error-overlay-style.mjs +41 -0
  158. package/runtime/dev-error-overlay.mjs +167 -0
  159. package/runtime/dev-error-report.mjs +121 -0
  160. package/runtime/dev-file-changes.mjs +1 -1
  161. package/runtime/dev-gateway.mjs +44 -0
  162. package/runtime/dev-host-relay.mjs +66 -0
  163. package/runtime/dev-indicator.mjs +191 -0
  164. package/runtime/dev-issue-motion.mjs +214 -0
  165. package/runtime/dev-lazy-tool.mjs +34 -0
  166. package/runtime/dev-logo.mjs +2 -0
  167. package/runtime/dev-notification.mjs +81 -0
  168. package/runtime/dev-popout.mjs +34 -0
  169. package/runtime/dev-position.mjs +107 -0
  170. package/runtime/dev-preview-touch.mjs +122 -0
  171. package/runtime/dev-runtime-pool.mjs +45 -0
  172. package/runtime/dev-runtime-spare.mjs +57 -0
  173. package/runtime/dev-tools-client.mjs +155 -0
  174. package/runtime/dev-tools-mcp.mjs +126 -0
  175. package/runtime/dev-tools-metrics.mjs +31 -0
  176. package/runtime/dev-tools-model.mjs +42 -0
  177. package/runtime/dev-tools-panel.mjs +341 -0
  178. package/runtime/dev-tools-result.mjs +37 -0
  179. package/runtime/dev-tools-server.mjs +256 -0
  180. package/runtime/dev-tools-source.mjs +104 -0
  181. package/runtime/dev-tooltip.mjs +94 -0
  182. package/runtime/dev-ui-icons.mjs +8 -0
  183. package/runtime/dev-workbench-style.mjs +106 -0
  184. package/runtime/dev-workbench.mjs +428 -0
  185. package/runtime/dev-worker-logs.mjs +31 -0
  186. package/runtime/development.mjs +324 -0
  187. package/runtime/document.mjs +1 -1
  188. package/runtime/edge.mjs +6 -5
  189. package/runtime/env.mjs +2 -1
  190. package/runtime/fetch-cache.mjs +10 -8
  191. package/runtime/flight-delta.mjs +50 -0
  192. package/runtime/flight-tap.mjs +28 -0
  193. package/runtime/html-only.mjs +27 -0
  194. package/runtime/http.mjs +2 -0
  195. package/runtime/incremental-cache.mjs +25 -4
  196. package/runtime/instrumentation.mjs +49 -0
  197. package/runtime/navigation-recovery.mjs +36 -0
  198. package/runtime/navigation.mjs +7 -0
  199. package/runtime/node-html-stream.mjs +47 -0
  200. package/runtime/pages-client.mjs +24 -8
  201. package/runtime/pages-navigation.mjs +54 -64
  202. package/runtime/persistent/client.mjs +6 -5
  203. package/runtime/persistent/daemon.mjs +66 -56
  204. package/runtime/persistent/native-proxy.mjs +63 -0
  205. package/runtime/prefetch-scheduler.mjs +110 -0
  206. package/runtime/preload.mjs +12 -0
  207. package/runtime/profile.mjs +14 -0
  208. package/runtime/profiles.json +2 -2
  209. package/runtime/render.mjs +3 -0
  210. package/runtime/route-pattern.mjs +44 -0
  211. package/runtime/rsc-worker.mjs +41 -12
  212. package/runtime/trace.mjs +78 -0
  213. package/runtime/typed-route.mjs +19 -0
  214. package/runtime/watch-project.mjs +29 -18
  215. package/runtime/worker.mjs +102 -24
package/README.md CHANGED
@@ -1,568 +1,100 @@
1
1
  <p align="center">
2
2
  <a href="https://prnext.dev">
3
- <img src="https://raw.githubusercontent.com/Lorkydey/PRNext/main/.github/assets/prnext-logo.svg" alt="PRNext logo" width="112" height="112">
3
+ <picture>
4
+ <source media="(prefers-reduced-motion: reduce)" srcset="https://raw.githubusercontent.com/Lorkydey/PRNext/main/.github/assets/prnext-logo-metallic-static.png">
5
+ <img src="https://raw.githubusercontent.com/Lorkydey/PRNext/main/.github/assets/prnext-logo-metallic.gif" alt="PRNext logo with a metallic finish" width="160" height="160">
6
+ </picture>
4
7
  </a>
5
8
  </p>
6
9
 
10
+ <!-- Logo effect rendered with React Bits Metallic Paint, copyright 2026 David Haz (MIT + Commons Clause): https://reactbits.dev/animations/metallic-paint -->
11
+
7
12
  <h1 align="center">PRNext</h1>
8
13
 
9
14
  <p align="center">
10
- <a href="https://www.npmjs.com/package/@thomas.f/prnext"><img src="https://img.shields.io/npm/v/%40thomas.f%2Fprnext/alpha?style=for-the-badge&amp;label=npm&amp;labelColor=161b22&amp;color=007ec6" alt="Current npm alpha version" height="28" align="absmiddle"></a> &nbsp;
11
- <a href="https://github.com/Lorkydey/PRNext/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Lorkydey/PRNext?style=for-the-badge&amp;label=license&amp;labelColor=161b22&amp;color=98d6ac" alt="MIT License" height="28" align="absmiddle"></a> &nbsp;
12
- <a href="https://x.com/PRNextdev"><img src="https://img.shields.io/badge/-%40PRNextdev-171717?style=for-the-badge&amp;logo=x&amp;logoColor=white" alt="Follow @PRNextdev on X" height="28" align="absmiddle"></a>
15
+ <a href="https://www.npmjs.com/package/@thomas.f/prnext"><img src="https://img.shields.io/npm/v/%40thomas.f%2Fprnext?style=for-the-badge&amp;label=npm&amp;labelColor=161b22&amp;color=007ec6" alt="npm version"></a>
16
+ <a href="https://github.com/Lorkydey/PRNext/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Lorkydey/PRNext?style=for-the-badge&amp;labelColor=161b22&amp;color=98d6ac" alt="MIT License"></a>
13
17
  </p>
14
18
 
15
- A Rust-powered web runtime with React rendering on Node.js and a static adapter for completed browser builds.
16
-
17
- > **Very early alpha.** Built for experimentation and feedback. Next.js compatibility is partial; expect bugs, missing features and breaking changes.
18
-
19
- ## Install & upgrade
19
+ A React framework with a Rust-powered runtime.
20
20
 
21
- Node.js **22.23.4+, 24.22.1+ or 26.12.1+** · Windows, macOS and Linux glibc · x64 and ARM64
22
-
23
- <details>
24
- <summary><strong>Install · migrate an existing Next.js app</strong></summary>
21
+ ## Install
25
22
 
26
- Run these commands from your application directory. The current alpha requires matching React, React DOM and React Server Components versions:
23
+ Run in your application directory:
27
24
 
28
25
  ```sh
29
- npm install @thomas.f/prnext@alpha react@19.3.1 react-dom@19.3.1 react-server-dom-webpack@19.3.1
30
- npx --no-install prnext migrate --dry-run
31
- npx --no-install prnext migrate
32
- npx --no-install prnext check
33
- npx --no-install prnext dev
26
+ npm i @thomas.f/prnext
34
27
  ```
35
28
 
36
- Review the dry run before applying migration. Migration backs up your package files and keeps Next.js and your application source. Compatibility checks help find issues; they do not guarantee that every Next.js feature works.
37
-
38
- Install only `@thomas.f/prnext`. Keep optional dependencies enabled: npm installs the matching native component automatically. Rust is not required to use a published release.
39
-
40
- `reactCompiler: false` and `typedRoutes: false` are supported. Enabling either option fails with an explicit diagnostic: PRNext does not yet run React Compiler or generate and validate typed route declarations. Keep builds that require these features on Next.js.
41
-
42
- The current source candidate also supports `devIndicators: false`, configured
43
- `experimental.optimizePackageImports` for pure ESM barrels with `sideEffects: false`,
44
- and App Router `maxDuration` values from 1 to 300 seconds. Import optimization
45
- preserves client/server boundaries and falls back to normal bundling when a barrel
46
- cannot be safely expanded. Duplicate App convention files follow `pageExtensions`
47
- priority and emit a warning. Identical public/App metadata files are accepted;
48
- conflicting content still fails explicitly. Route Handlers can call shared
49
- `use server` functions directly; pages retain their Flight/Server Action
50
- registrations. Mixed npm component exports preserve the real React server
51
- instance without requiring unused client hooks to exist in that environment.
52
-
53
- Node Route Handlers and Server Actions can use `after()` from `next/server`. Callbacks run after the
54
- response finishes or disconnects, including error responses, and retain their
55
- request context. Tracked work prevents idle worker retirement without blocking the
56
- next HTTP request. There are at most 128 tasks per request, within `maxDuration`
57
- (25 seconds by default, including the response's running time). Cookie reads are supported;
58
- post-response cookie writes are rejected. Server Actions wait for the HTTP response
59
- to finish, not just their intermediate Flight render. Server Component and Edge
60
- `after()` lifecycles are not implemented and fail explicitly. `revalidateTag`,
61
- `revalidatePath` and `updateTag` are also rejected inside an `after()` callback;
62
- perform supported invalidation in the Route Handler or Server Action before
63
- returning. This differs from the full Next.js lifecycle. During service shutdown,
64
- the 30-second standalone drain (35 seconds for global Host shutdown) can shorten a route's larger `maxDuration`. Ordinary sleep/eviction instead allows a 300-second drain. Forced
65
- termination, a memory-budget violation or a machine failure can still interrupt
66
- work; use durable external job storage for tasks that must survive these events.
67
-
68
- `experimental.proxyClientMaxBodySize` accepts a byte count or a size such as
69
- `'25mb'`, up to 32 MiB (default 10 MiB). Like Next's body clone, overflow retains
70
- only complete chunks before the limit and warns; a chunk crossing the limit is
71
- discarded. General request ingress remains capped at 32 MiB and Server Actions at
72
- 8 MiB. PostgreSQL's `pg` stays external by default so its optional native driver
73
- remains lazy; explicitly putting `pg` in `transpilePackages` opts out.
74
-
75
- Google font build inputs are cached under `.prnext-cache/fonts-v1` (64 MiB,
76
- 256 entries, verified content hashes). A warm cache permits offline rebuilding;
77
- a cold build still needs access to Google's font endpoints. Remove this cache to
78
- refresh downloaded font inputs. This does not cache dynamic page responses.
79
-
80
- Set `typescript: {}` to check an existing `tsconfig.json` during production builds using the application's installed `typescript` package. `typescript.tsconfigPath` selects a custom configuration for type checking and compilation, including its inherited path aliases. `typescript.ignoreBuildErrors: true` explicitly skips the production check; development builds also skip it. Checks run in a temporary child process without emitting files or editing the configuration. Unlike Next.js, omitting `typescript` preserves PRNext's existing transpile-only behavior. PRNext does not install TypeScript, create `next-env.d.ts`, generate Next.js route types, or implement the Next.js TypeScript language-service plugin; retain the project's type declarations and run separate editor checks as needed. See the [Next.js option definitions](https://nextjs.org/docs/app/api-reference/config/next-config-js/typescript).
29
+ Node.js **22.23.4+, 24.22.1+ or 26.12.1+**. Windows, macOS and Linux (glibc), x64 and ARM64. No Rust installation needed.
81
30
 
82
- </details>
31
+ **Experimental alpha.** Next.js compatibility is partial.
83
32
 
84
- <details>
85
- <summary><strong>Upgrade · update an existing PRNext project</strong></summary>
86
-
87
- Stop your development or production process before changing dependencies. If you use `pstart`, follow the [persistent app upgrade guide](#upgrade-persistent-apps) first.
88
-
89
- ```sh
90
- npm install @thomas.f/prnext@alpha react@19.3.1 react-dom@19.3.1 react-server-dom-webpack@19.3.1
91
- npx --no-install prnext --version
92
- npx --no-install prnext check
93
- npx --no-install prnext build
94
- ```
33
+ ## Create a project
95
34
 
96
- Then restart your app with its usual command; for a foreground production server:
35
+ The `create` command requires PRNext 0.1.18-alpha or later.
97
36
 
98
37
  ```sh
99
- npx --no-install prnext start
38
+ npx @thomas.f/prnext create my-app
39
+ cd my-app
40
+ npm run dev
100
41
  ```
101
42
 
102
- This updates the existing `@thomas.f/prnext` dependency and its native component together. You do not need to migrate an already-migrated project again. Commit the updated package manifest and lockfile.
103
-
104
- Use `@alpha` to select the current alpha release. `latest` is a separate npm tag; a dependency already installed in a project does not change until you update it.
105
-
106
- </details>
43
+ TypeScript by default. Add `--js` for JavaScript.
107
44
 
108
45
  <details>
109
- <summary><strong>Build & run · development and production</strong></summary>
46
+ <summary><strong>Use an existing Next.js app</strong></summary>
110
47
 
111
- For development:
48
+ Preview changes with `npx --no-install prnext migrate --dry-run`. Review the output, then run:
112
49
 
113
50
  ```sh
51
+ npx --no-install prnext migrate
52
+ npx --no-install prnext check
114
53
  npx --no-install prnext dev
115
54
  ```
116
55
 
117
- For production:
118
-
119
- ```sh
120
- npx --no-install prnext build
121
- npx --no-install prnext start
122
- ```
123
-
124
- The portable command is `prnext`. The shortcut `prn` is available in compatible shells. On Windows 10 and Windows Server 2022, use `prnext`: [Windows reserves the name PRN](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file).
56
+ Read the [compatibility guide](https://github.com/Lorkydey/PRNext/blob/main/packages/prnext/docs/ai/compatibility.md) before migrating.
125
57
 
126
58
  </details>
127
59
 
128
60
  <details>
129
- <summary><strong>Runtime profiles · balanced, speed, memory and classic</strong></summary>
130
-
131
- Balanced is the default. Set a profile when starting the production server:
132
-
133
- | Profile | Command | Priority |
134
- | --- | --- | --- |
135
- | Balanced | `npx --no-install prnext start --profile balanced` | Memory, CPU and response times |
136
- | Speed | `npx --no-install prnext start --profile speed` | Throughput and responsiveness |
137
- | Memory | `npx --no-install prnext start --profile memory` | Lower memory usage |
138
- | Classic | `npx --no-install prnext start --profile classic` | Original runtime settings |
139
-
140
-
141
- Worker retirement can be configured in `next.config.mjs` (PRNext extension):
142
-
143
- ```js
144
- export default {
145
- workerRetirement: { idleSeconds: 300, laneIdleSeconds: 30, keepWarm: false },
146
- };
147
- ```
148
-
149
- Values are resolved **per field**: CLI > process environment > built configuration > profile.
150
- The CLI options are `--worker-idle-seconds`, `--lane-idle-seconds`, and
151
- `--keep-warm [true|false]` (a bare flag means true). The corresponding environment
152
- variables are `PRNEXT_WORKER_IDLE_SECONDS`, `PRNEXT_LANE_IDLE_SECONDS`, and
153
- `PRNEXT_KEEP_WARM` (`true`/`false` or `1`/`0`). Seconds must be integers from 0 to
154
- 604800; invalid supplied values fail even when a higher-priority value exists.
155
- Configuration-file changes require a new build; CLI/environment changes require
156
- restarting the server.
157
-
158
- `idleSeconds: 0` disables host idle retirement. `laneIdleSeconds: 0` disables
159
- early retirement of surplus lanes; the host deadline still applies to those
160
- lanes. Set both to zero to disable all idle retirement. `keepWarm: true` overrides
161
- the resolved host deadline and retains one primary lane per used host, while
162
- surplus lanes still retire. It creates no workers or artificial requests before
163
- real traffic. To restore a shorter CLI deadline when a lower-priority source sets
164
- `keepWarm: true`, also pass `--keep-warm false`. Active requests across **all**
165
- lanes reset the host deadline; streams and tracked post-response work remain
166
- protected. Keeping a host warm trades retained memory for lower wake latency;
167
- it does not change the profile's response, buffer or V8 limits.
168
-
169
- New builds include `runtime-contract.json`, separately declaring transport and
170
- lifecycle versions and fingerprints of the runtime modules. `start` and
171
- `host --check` reject missing, incompatible, future or mixed dynamic runtimes
172
- before accepting traffic and print `prnext build <project>`. Rebuild and restart after
173
- updating PRNext. Keep the selected production build immutable while it is in
174
- use; this is a startup check, not a continuous file watcher. A copied metadata file cannot upgrade old runtime modules;
175
- `--worker` must remain inside the verified build runtime directory. This is
176
- artifact consistency checking, not a signature or a sandbox. Legacy builds
177
- without any worker routes or middleware can still serve files without Node.
178
- The multi-app `host` supervisor's whole-application `idleSeconds`/memory policy
179
- is separate: keeping a Node worker warm does not override application sleep,
180
- shutdown or resource-budget termination.
181
-
182
- `prnext start` sizes Tokio's blocking I/O pool to four times the larger of its
183
- runtime thread count and requested render workers (minimum 4, maximum 256).
184
- `PRNEXT_BLOCKING_THREADS=1..1024` explicitly overrides it. This bounds threads,
185
- not the number of incoming HTTP connections. Filesystem admission separately
186
- bounds submitted blocking work and file response bodies, including slow clients:
187
-
188
- | Environment variable | Default | Accepted range | Scope per server process |
189
- |---|---:|---:|---|
190
- | `PRNEXT_FILE_CONCURRENCY` | 64 | 1–4096 | File preparation and live file source bodies |
191
- | `PRNEXT_FILE_WORK_CONCURRENCY` | 16 | 1–1024 | Submitted static/path/cache helper tasks, queued or running |
192
- | `PRNEXT_FILE_QUEUE` | 128 | 0–4096 | Waiting callers at each admission gate; 0 rejects immediately |
193
- | `PRNEXT_FILE_WAIT_MS` | 2000 | 1–60000 | Maximum admission wait at each gate |
194
-
195
- Invalid values fail startup before listening. Full queues and admission timeouts
196
- return HTTP 503 with `Retry-After: 1` and `Cache-Control: no-store`. These deadlines
197
- apply to admission, not the duration of an accepted response. Cancelling a queued
198
- caller releases its slot. An already running filesystem operation keeps its
199
- permit until it settles, including a pending file read after a client disconnects;
200
- an operating-system call cannot be forcibly cancelled safely. Large file bodies
201
- use a one-frame channel with backpressure. No deadline cuts off an active stream.
202
- Their asynchronous open/read operations retain a file-response permit; they are
203
- not included in the helper-task queue counter. These controls are not a global
204
- limit on application or background I/O.
205
- The limits do not bound TCP/kernel buffers or all HTTP connections, and an
206
- unresponsive disk can occupy the bounded capacity until its operation returns.
207
- Pages cache lookups use the same bounded filesystem admission. Their overload
208
- follows the existing page-capacity 503 path, including Pages JSON requests;
209
- it does not invoke error-page generation or regenerate a valid cached page.
210
-
211
- File operations stay off the async runtime threads; HTTP validators, range
212
- handling and path confinement are unchanged. The multi-app supervisor retains
213
- its existing pool sizing because
214
- its long-lived child-output readers have different requirements.
215
-
216
- For local diagnosis only, `PRNEXT_METRICS_FILE=<path>` adds one observer thread
217
- and cumulative counters once per second (file wraps at 16 MiB). It reports
218
- Tokio threads, instrumented filesystem tasks/queues and worker events. Nested
219
- filesystem timings are wall time, not CPU, and must not be added together.
220
- `fileAdmission` and `fileWorkAdmission` report occupancy, peaks, submitted and
221
- released work, rejections, timeouts, cancelled waits and wait duration. Their
222
- `waitingHeaderBytes` estimate counts URI and header content only; it excludes
223
- allocation overhead, request objects, bodies and TCP/kernel buffers. Use process
224
- memory measurements for the total footprint. Metrics never initialize admission
225
- settings or override values selected at startup.
226
- `activeJobs` sums transport jobs across the separate render/API pools;
227
- `queuedJobs` excludes HTTP callers waiting before transport admission.
228
- `laneIdleRetirements` includes release of a cancelled lane's retained host
229
- reference, so it is not a count of distinct TCP connections closed. Host starts
230
- and watchdog kills are separate events; RSC isolate restarts do not have an
231
- independent cumulative counter. Normal operation has no observer thread or
232
- sampling timer.
233
- `--inspect` additionally records Node startup, module and RSC initialization
234
- phases; use uninstrumented runs for throughput comparisons.
235
-
236
- Render workers start on demand. Idle connection lanes retire after 30 seconds in `memory` and legacy `compact`. `balanced` keeps each host's primary lane warm for 300 seconds and retires surplus lanes after 30 seconds; `speed` and `classic` keep primary lanes warm and retire surplus lanes after 30 seconds. Retirement waits on idle deadlines rather than polling. Active responses and streams retain their lanes, and tracked application work keeps its Node host available even after the last lane retires. New requests can reuse that host while cache finalization continues. Once the work settles, the existing heartbeat releases this retention within one second. Releasing idle workers lowers retained memory but adds worker startup and module loading to the next request.
237
-
238
- Client disconnections release response permits and close incomplete transport lanes while retaining a healthy shared Node process. A lane whose terminal frame was fully validated can be reused. App Router cancellation pressure pauses new admission until abandoned work settles, with bounded queues and the original request deadlines; it does not immediately terminate unrelated responses. Successful response completion ends the RSC response deadline, while cache writes remain tracked until settlement. During this post-response work only, a shared watchdog probes the RSC isolate every five seconds and retires it if an acknowledgement takes more than 30 seconds. This measures responsiveness, not the total duration of asynchronous cache work; no RSC watchdog timer runs when that work is absent. Existing limits on cancelled requests and other API or middleware background work still apply.
239
-
240
- Explicit disposal of a worker pool starts a separate graceful shutdown: tracked work has up to 30 seconds to drain before Rust terminates and reaps the process, including a blocked JavaScript event loop. This shutdown grace does not limit normal idle cache finalization. Arbitrary detached tasks are outside the tracked lifecycle; applications that rely on them or long-lived in-process state should use `speed` or `classic` to keep their primary host warm. Such tasks are still not preserved across shutdown or worker failure.
241
-
242
- Each profile keeps its own admission, buffering and idle policy. Limits below are per worker host; render starts and live responses are separate budgets.
243
-
244
- | Profile | Render starts | Live responses | API concurrency | Response buffer | Primary idle deadline |
245
- |---|---:|---:|---:|---:|---|
246
- | `balanced` | 16 | 32 | 256 | 4 MiB | 300 seconds |
247
- | `speed` | 32 | 128 | 512 | 16 MiB | Keep warm |
248
- | `memory` | 8 | 28 | 64 | 1 MiB | 30 seconds |
249
- | `classic` | 16 | 32 | 512 | 8 MiB | Keep warm |
250
-
251
- On Linux with Node's `process.execve` available (Node 22.15+/23.11+), production `prnext start` replaces its CLI process with the native server. This removes a resident Node launcher from every profile without shrinking render or response budgets. Rust handles SIGINT, SIGTERM and SIGHUP gracefully; Linux also kills Node workers if their native parent dies, including when JavaScript is blocked. Explicit `--shutdown-on-stdin-eof` remains supported. Windows, macOS, older Node versions, IPC callers and Node instrumentation keep the supervised launch path. Only heap-sizing Node flags are eligible for replacement; other flags and `NODE_V8_COVERAGE` conservatively retain supervision. Node still labels `process.execve` experimental. This change does not remove the supervisors used by `pstart`, or change `host` and development mode.
252
-
253
- `balanced` keeps its 4 MiB V8 semi-space without `--optimize-for-size`. `speed` keeps its 16 MiB semi-space, larger concurrency and buffers, and warm hosts. `memory` keeps V8's size policy and early retirement; `classic` preserves its original V8 settings. Node heap flags can take precedence over the RSC isolate's young-generation resource limit: these settings are not total RSS caps. The earlier Windows V6 validation includes three 30-second measurements per scenario and a one-hour mixed endurance run; it predates this launcher change and is not an endurance result for this candidate. Workload and platform affect the CPU/RSS trade-off; a comparable Linux Nginx benchmark remains pending.
254
-
255
- An explicit `NODE_OPTIONS="--max-semi-space-size=4"` (including Node's underscore spelling) overrides the profile's nursery policy. PRNext also omits `--optimize-for-size` in that case: on Node 24.19.0, V8 otherwise replaces the explicit value with 1 MiB. This opts out of V8's broader size policy as well, so CPU and memory consumption can change; measure the chosen value for your workload. It does not add an old-generation heap limit or change the profile's admission, response buffers or idle retirement. Without an explicit override, PRNext uses the defaults of the selected profile.
256
-
257
- The V6 multi-application campaign keeps `start` on `balanced` and `host` on
258
- `memory`. With one shared CPU on Windows, `memory` completed both short trials
259
- at four applications / 512 MiB and eight applications / 1 GiB without allocation
260
- limit events. Its one-hour validation used four applications / 1 GiB, not those
261
- lowest budgets: 1,626,564 useful responses and 960 intentional cancellations,
262
- with no HTTP or validation errors. `balanced` gave lower neighbouring-application
263
- tail latency when the larger memory budget was available. These are independent
264
- `start` instances, not a benchmark of the hosting proxy. Windows commit limits,
265
- an active pagefile and process RSS sums are not Linux cgroup/PSS measurements;
266
- equivalent Linux density and endurance measurements remain pending. The local V6 report retains failures,
267
- variability and the small-static throughput cost of bounded admission.
268
-
269
- The filesystem work limit remains 16, the setting validated under overload and
270
- throughout the final endurance run. An explicit `PRNEXT_FILE_WORK_CONCURRENCY=64`
271
- improved small-file throughput by about 5% in two short configuration trials,
272
- but allows four times as many submitted helper tasks. It has not received the
273
- same endurance validation and is not a universal profile improvement.
274
-
275
- Results depend on your workload; see the [benchmark and its methodology](#early-benchmarks-against-nextjs).
276
-
277
- </details>
278
-
279
- ## Early benchmarks against Next.js
280
-
281
- Dynamic streaming with 128 concurrent clients and a deterministic local backend delayed by 40 ms:
282
-
283
- | Configuration | RAM | CPU load¹ | CPU/response | Throughput |
284
- |---|---:|---:|---:|---:|
285
- | Next.js | 605 MiB | 164% | 2.442 ms | 673 req/s |
286
- | **Balanced** | **207 MiB** | 124% | 1.704 ms | 726 req/s |
287
- | **Speed** | 496 MiB | 250% | **0.926 ms** | **2,698 req/s** |
288
- | **Memory** | **179 MiB** | **75%** | 2.067 ms | 362 req/s |
289
- | **Classic** | 303 MiB | 90% | 1.241 ms | 723 req/s |
290
-
291
- <details>
292
- <summary><strong>Benchmark methodology & trade-offs</strong></summary>
293
-
294
- ¹ 100% CPU = one fully utilized CPU core. RAM is measured under load.
295
-
296
- Measured September 27, 2026, on Apple M4 against Next.js 15.5.12. Values are medians of three six-second runs using identical application sources. This table covers one streaming scenario, not an overall average or guaranteed gains. Functional parity was checked before benchmarking.
297
-
298
- Under concurrent streaming, `memory` used 179 MiB versus 207 MiB for `balanced`, but served 362 versus 726 responses/s. On concurrent SSR, it used slightly more memory than `balanced`. The lowest-memory profile is workload-dependent.
299
-
300
- </details>
301
-
302
- ## Guides
303
-
304
- ### Build adapters
305
-
306
- PRNext keeps its React/Next-convention build as the default. The source candidate
307
- also imports static browser builds produced by Vite or another framework:
61
+ <summary><strong>Build for production</strong></summary>
308
62
 
309
63
  ```sh
310
- npm run build
311
- npx --no-install prnext build --adapter static --from dist --spa
64
+ npx --no-install prnext build
312
65
  npx --no-install prnext start
313
66
  ```
314
67
 
315
- Use `--spa` only for client-side routing. Omit it for a multi-page site. PRNext
316
- imports the completed public files; it does not compile Vue/Svelte source or run
317
- another framework's SSR server. Static requests require no Node render worker.
318
- This adapter needs the updated native binary built from the same source candidate;
319
- it is not part of the previously published alpha package.
320
-
321
- Every new build writes a versioned `build-output.json`. Inspect it with
322
- `prnext output --json`. See the [adapter contract](packages/prnext/build/ADAPTERS.md)
323
- and [compatibility scope](COMPATIBILITY.md) for supported inputs and boundaries.
324
-
325
- <details>
326
- <summary><strong>Deploy to PRNext Cloud (local development)</strong></summary>
327
-
328
- ### Deploy to PRNext Cloud
329
-
330
- The local CLI now supports browser login and source deployments. This feature is
331
- not yet included in a published npm release or deployed to the public Cloud app.
332
-
333
- ```sh
334
- prn login
335
- prn deploy ./my-app
336
- prn update ./my-app
337
- prn whoami
338
- prn logout
339
- ```
340
-
341
- `prnext` accepts the same commands. Login opens the browser and reuses its session,
342
- or returns to terminal approval after web sign-in. Confirm the code shown in your
343
- terminal. `--no-browser` prints the URL for manual authorization.
344
-
345
- `deploy` creates an upload project and saves its link in the ignored
346
- `.prnext-cloud/project.json`; `update` sends changes to that same project.
347
- `deploy --project ID` links an existing upload project. `--dry-run` lists source
348
- files without connecting or uploading; `--no-wait` returns after queueing.
349
- `--timeout SECONDS` controls waiting (default 600). After interruption or
350
- `--no-wait`, `update` resumes the recorded request first; run it again to deploy
351
- further changes. Server-side request IDs prevent duplicate queued builds.
352
-
353
- Archives exclude `.env*`, credentials, `node_modules`, `.git`, generated
354
- `.next`/`.prnext*` output and `.local`. Root `.gitignore` and `.prnextignore`
355
- support additional glob exclusions and `!` rules; nested/global Git ignore files
356
- are not read. Mandatory exclusions cannot be re-included. Nonexcluded symbolic
357
- links are refused. On a compatible Host server: 100 MiB ZIP, 500 MiB expanded,
358
- 15,000 files and 64 MiB per file. Transfers use resumable 4 MiB chunks on the VPS;
359
- legacy servers retain their 7 MiB upload limit. No object storage is required.
360
-
361
- When production `.env` files are detected, `deploy` and `update` ask before
362
- importing variables (default: no). `--with-env` explicitly opts in;
363
- `--without-env` skips the prompt. Noninteractive commands skip import unless
364
- `--with-env` is set. Variables travel through the encrypted environment API,
365
- never inside the source ZIP or project link. Matching remote keys are replaced;
366
- other keys remain. `NEXT_PUBLIC_` values may be exposed in the browser bundle.
367
- This feature requires the updated Host API and remains unpublished.
368
- Use project environment settings for secrets; inspect `--dry-run` for other
369
- sensitive files in your own source tree.
370
-
371
- Credentials stay under `~/.prnext/cloud/` (or private `PRNEXT_CLOUD_HOME`, outside
372
- the source directory). Tokens are scoped to project reads/uploads/deployments,
373
- expire after 30 days, and can be revoked with `logout` or in workspace settings.
374
- Browser sign-out does not revoke authorized terminals.
375
-
376
- For a local Cloud server, use `--server http://127.0.0.1:3003` or
377
- `PRNEXT_CLOUD_URL`. From this checkout, run
378
- `node packages/prnext/cli.mjs login --server http://127.0.0.1:3003`.
379
- Production defaults to `https://app.prnext.dev`; credentials are isolated by origin.
380
-
381
- A configured isolated Linux worker is required to deploy. A local Windows panel
382
- supports login and dry runs, but reports unavailable hosting explicitly.
383
- Approved offline dependencies, runtime network isolation and current Cloud quotas
384
- still apply; these commands do not bypass the hosting worker or configure DNS/TLS.
68
+ After upgrading PRNext, rebuild your app and restart it.
385
69
 
386
70
  </details>
387
71
 
388
-
389
72
  <details>
390
- <summary><strong>Check a migration before switching</strong></summary>
73
+ <summary><strong>Use with AI assistants</strong></summary>
391
74
 
392
- ### Check a migration before switching
75
+ Read the guides included with your installed version:
393
76
 
394
77
  ```sh
395
- prnext migrate ./my-app --check
396
- prnext migrate ./my-app --check --json
397
- prnext migrate ./my-app --check --against http://localhost:3000 --candidate http://localhost:3001 --routes paths.json
78
+ npx --no-install prnext docs --ai
398
79
  ```
399
80
 
400
- The source audit reports unsupported Next imports with file and line numbers, client/server import conflicts, dependency versions and scripts requiring manual changes. It leaves sources, package files and builds untouched. Configuration files are evaluated by the existing preflight; installed dependencies and custom loaders still require a build. Warnings are distinct from blocking errors. A failed audit or response comparison exits with code 1.
401
-
402
- For comparison, start the existing Next application and the PRNext candidate separately. `paths.json` is a JSON array such as `["/", "/products/123", "/api/catalog"]`; without it, the command selects non-parameterized page routes from the audit. It sends GET requests without authentication, follows no redirects, and compares status, content type, redirect destinations and bodies. JSON object key order is ignored; HTML compares text with scripts/styles removed. This verifies response samples, not hydration, styling, interactive behavior or every dynamic path. Timing observations are not controlled performance benchmarks. `--timeout 10000` sets each response's deadline in milliseconds.
403
-
404
- </details>
405
-
406
- <details>
407
- <summary><strong>Inspect routes, cache and timings</strong></summary>
408
-
409
- ### Inspect routes, cache and timings
410
-
411
- ```sh
412
- prnext build ./my-app
413
- prnext start ./my-app --inspect
414
- # In another terminal, after visiting the application:
415
- prnext inspect ./my-app
416
- prnext inspect ./my-app --json
417
- prnext inspect ./my-app --otlp > metrics.json
418
- ```
419
-
420
- The inspector explains static, dynamic and partially prerendered routes using build metadata, including observed App prerendering bailouts and Pages data hooks. Opt-in measurements show native HTTP timings, fetch destinations and timings, native data cache hits/misses/stale reads, bypass reasons and successful tag/path invalidations. A custom cache handler is identified as a delegation; its internal hit rate is not inferred. Native page-file cache decisions and client router caching are not counted as data-cache hits.
421
-
422
- The summary adds sampled HTTP p50/p95, server errors, worker startup p95, current
423
- worker queue/activity and recent Node worker RSS. Missing or stale resource samples
424
- are shown as unavailable, never as zero. RSS excludes the native server; worker
425
- threads sharing a PID are counted once. `start --inspect` also enables bounded native
426
- counter snapshots. These opt-in diagnostics do not change normal serving defaults.
427
-
428
- `inspect --otlp` writes an OTLP/JSON Metrics payload for a bounded local sample.
429
- The custom `prnext.http.response.headers.duration` histogram uses seconds and stops
430
- at response headers, excluding streaming body time. It is deliberately not named
431
- `http.server.request.duration`. Samples can span sessions and overlap repeated
432
- exports; this is a diagnostic snapshot, not a continuous traffic or billing counter.
433
- No collector connection or public diagnostics endpoint is enabled automatically.
434
-
435
- Timings end when headers are ready, so streaming body time is excluded. Samples are bounded, can span process sessions, and are written under the app's `.prnext-cache/inspect` directory. Request bodies, headers, cookies, URL queries and credentials are omitted; runtime tag/path identifiers are hashed consistently. Logs retain at most 1 MiB per segment plus a previous segment, with old process sessions pruned. Under load, diagnostics may drop samples. `--inspect` also works with `prnext dev`; standalone/native launches can set `PRNEXT_INSPECT_DIR` explicitly. No public diagnostic endpoint is added.
436
-
437
- </details>
438
-
439
- <details>
440
- <summary><strong>Host several applications</strong></summary>
441
-
442
- ### Host several applications
443
-
444
- ```sh
445
- npm run build -- examples/basic
446
- npm run build -- examples/app
447
- node packages/prnext/cli.mjs host examples/hosting/prnext.host.json --check
448
- node packages/prnext/cli.mjs host examples/hosting/prnext.host.json
449
- # In another terminal:
450
- node packages/prnext/cli.mjs host examples/hosting/prnext.host.json --status
451
- ```
452
-
453
- The example routes `basic.localhost:8080` and `app.localhost:8080` to separate applications. Resolve those hostnames to the listener address, or supply their exact `Host` header when testing. Installed packages use `prnext host config.json`. Configuration roots are relative to the JSON file. Each app has a unique name, root and exact hostname list, with optional `memoryMb`, `idleSeconds`, `workers`, `profile`, `env` and `inspect` settings. `--status --json` reads the local status snapshot beside the configuration, including its age; it does not connect to a live admin endpoint. Restart the host to apply configuration or build changes.
454
-
455
- The native gateway keeps each application asleep until requested. A waking app reserves its configured memory budget; if capacity is full, inactive apps can release theirs, while busy requests receive 503 rather than starting an unbudgeted app. Requests and streaming responses hold their reservation until completion or cancellation. Idle apps begin stopping after `idleSeconds` and wake on the next request. Sleep and capacity eviction retain the memory reservation while the child drains supported `after()` and ISR work, allowing up to 300 seconds plus five seconds for process cleanup. A wake waiting for that capacity can take longer. Status shows `draining` with the process still present; monitoring and memory-budget enforcement continue. Global Host shutdown shortens outstanding retirement to its own 35-second deadline. Persistent caches remain on disk; in-process state and untracked background jobs do not survive sleep. Apps receive their configured environment and a small platform environment allowlist, then load their own `.env` files.
456
-
457
- The watchdog samples the RSS of each app's native server and descendants about once per second. Exceeding `memoryMb` stops that process tree, can interrupt its in-flight requests, and imposes a 30-second cooldown. V8 also receives an initial heap guard unless the app config supplies `NODE_OPTIONS`. These are sampled operating budgets, not kernel-enforced hard limits; allow extra RAM for the gateway, the OS and sampling overshoot. Process separation isolates caches, environment and ordinary failures, but apps run as the same OS user: host only trusted applications. Use separate users or containers for untrusted tenants.
458
-
459
- The 0.1.12-alpha Windows host check used four applications sharing one CPU and a 1 GiB Job commit budget. Two 30-second mixed SSR/stream/API trials measured about 333 requests/s through `host` versus 361 directly with the same V8 heap guard (about 8% gateway cost in this fixture). The matching direct controls followed the host trials; these short runs are not a general capacity guarantee. Three sleep/resume cycles per trial used `idleSeconds: 3` to exercise retirement: 32 simultaneous arrivals completed in 1.92–2.35 seconds, with one startup per application and no failures. The default whole-app deadline remains 300 seconds. The gateway keeps its one-second status/RSS monitor running while apps sleep; idle CPU is not zero. No host endurance or Linux performance result is claimed.
460
-
461
- Hosting supports HTTP streaming and preserves the original application Host. Protocol upgrades such as WebSockets return 501. Put a TLS reverse proxy in front for public hosting; this command does not configure DNS, TLS, OS services or deploy to a VPS. Windows, macOS and Linux use the same JSON format and CLI.
462
-
463
- </details>
464
-
465
- <details>
466
- <summary><strong>Keep production apps running</strong></summary>
467
-
468
- ### Keep production apps running
469
-
470
- `prnext start` keeps its normal foreground behavior. Use the separate persistent commands when an app should survive closing the terminal:
471
-
472
- ```sh
473
- prnext build ./my-app
474
- prnext pstart ./my-app --name web --port 3000
475
- prnext pstatus
476
- prnext plogs web --follow
477
- # After rebuilding the app:
478
- prnext prestart web
479
- prnext pstop web
480
- ```
481
-
482
- `pstart` starts a detached supervisor and returns once the app passes its health check. Applications restart after a crash with increasing delays; ten failures within five minutes stop retries until `prestart`. A separate watchdog restarts the supervisor after a crash or an unresponsive event loop. Each app has a stable HTTP listener and its own native server and workers. This mode adds a Node HTTP proxy and two supervisor processes; it does not enable the idle sleep or memory reservations of `prnext host`.
483
-
484
- `prestart` copies the current production build, starts a replacement on a private port, and sends a GET to `--health-path` (default `/`). A 2xx or 3xx response must arrive within `--health-timeout 15000` milliseconds. Only then does new traffic switch to the replacement. If startup or the health check fails, the existing healthy instance keeps serving. Existing HTTP streams can finish for up to `--drain-timeout 30000` milliseconds, after which remaining requests are closed. Choose a health route that checks the dependencies your application needs. Two generations temporarily use memory and disk space during replacement.
485
-
486
- Build copies live under the project's ignored `.prnext-persistent` directory and are removed after their processes stop. Rebuilding does not replace the active generation's compiled files. Project dependencies, `public` files and persistent caches remain shared; avoid changing dependencies or deleting public assets while old requests still need them. HTTP streaming, original Host headers and multiple cookies are preserved. WebSocket/protocol upgrades return 501. A supervisor crash can interrupt requests; health-checked replacement is not a guarantee against machine failures or incompatible application changes. A TLS reverse proxy can sit in front of the persistent listener.
487
-
488
- Available commands:
489
-
490
- | Command | Behavior |
491
- | --- | --- |
492
- | `prnext pstart [directory] --name NAME` | Start or restore an app; identical repeated starts are idempotent |
493
- | `prnext prestart [name] [--all]` | Load the current build through a health-checked replacement |
494
- | `prnext pstop [name] [--all]` | Stop apps and keep them stopped across supervisor restarts |
495
- | `prnext pdelete [name] [--all]` | Stop apps and remove their saved configuration; retain logs |
496
- | `prnext pstatus [name] [--json]` / `prnext plist` | Show status, PIDs, build IDs, starts and active requests |
497
- | `prnext plogs [name] --lines 100 --follow` | Read/tail app output; `--supervisor` selects supervisor logs |
498
- | `prnext pdown` | Stop the supervisor and apps, retaining enabled flags for their next launch |
499
- | `prnext pstartup [--remove]` | Enable/remove automatic restoration at user login |
500
-
501
- Without a name, `prestart`, `pstop`, `pdelete` and `plogs` select the app registered for the current directory. `pstart` accepts `--hostname`, `--port`, `--workers`, `--profile`, `--inspect`, `--health-path`, `--health-timeout` and `--drain-timeout`; see `prnext pstart --help`. Change saved listener/settings with `pdelete`, then `pstart`. Applications load their project `.env` files; arbitrary caller-shell variables and secrets are not copied into the saved registry. The state directory defaults to `~/.prnext/processes`; set `PRNEXT_PM_HOME` consistently for a separate supervisor. Keep that directory private: it contains local control credentials and application logs. Logs rotate at 10 MiB with three retained segments per app and for the supervisor. App output can contain whatever the application logs.
502
-
503
- `pstartup` is opt-in and enables restoration on the **next user login**. On Windows it registers a hidden scheduled task for the current account; on macOS it writes a user LaunchAgent; on Linux it enables a systemd user service. These definitions restart a failed watchdog once managed by the OS. Windows and macOS user startup do not run before login. A Linux administrator can enable user lingering separately for boot-time operation without an interactive login. No OS startup settings change just by running `pstart`, and the command does not install a Windows system service or alter other accounts. Run `pstartup` again after moving or upgrading Node or the PRNext package. Platform references: [Windows scheduled tasks](https://learn.microsoft.com/en-us/powershell/module/scheduledtasks/new-scheduledtasksettingsset), [Apple launch agents](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html), [systemd user lingering](https://www.freedesktop.org/software/systemd/man/252/loginctl.html).
504
-
505
- ### Upgrade persistent apps
506
-
507
- The supervisor may be shared by several projects. Use the same user and `PRNEXT_PM_HOME` throughout, and record the applications and their settings first:
508
-
509
- ```sh
510
- npx --no-install prnext pstatus --json
511
- ```
512
-
513
- Before changing package files, stop the apps and supervisor using the **old installation**. These commands affect **all apps managed by that supervisor**, so schedule the interruption accordingly:
514
-
515
- ```sh
516
- npx --no-install prnext pstop --all
517
- npx --no-install prnext pdown
518
- ```
519
-
520
- Install the update and rebuild each affected project as described under [Install & upgrade](#install--upgrade). Using the new CLI, restart each app with its original name, port and other options. For example:
521
-
522
- ```sh
523
- npx --no-install prnext pstart --name web --port 3000
524
- ```
525
-
526
- If the saved Node or native executable path changed, remove that app's saved entry with `prnext pdelete NAME`, then register it again with `prnext pstart` and its recorded options. This removes saved settings but retains logs. If login startup was enabled, re-run `prnext pstartup` to refresh its paths.
527
-
528
- `pdown` alone keeps apps enabled for restoration; stop them first to prevent an old configuration from restarting during the upgrade.
81
+ Run `npx --no-install prnext docs --ai --init` to add a guide reference to your project's `AGENTS.md`.
529
82
 
530
83
  </details>
531
84
 
532
85
  <details>
533
86
  <summary><strong>Develop from this repository</strong></summary>
534
87
 
535
- ### Develop from this repository
536
-
537
- Install Node.js 22+ and Rust with rustup, then run:
538
-
539
88
  ```sh
540
89
  npm ci
541
90
  npm run build:native
542
91
  npm run dev -- examples/app
543
92
  ```
544
93
 
545
- These commands also work in PowerShell and Command Prompt. On Windows, source builds require Visual Studio Build Tools with the Desktop development with C++ workload and a Windows SDK, plus NASM on x64. Rustup selects the repository's Rust 1.98 toolchain. Linux source builds need a C/C++ toolchain, NASM and pkg-config; macOS needs Xcode command line tools and NASM.
546
-
547
- For production locally, run `npm run build -- examples/app`, then `npm run start -- examples/app`. Standalone output runs with `node server.js` on its build OS and architecture, including Windows. Published native packages remove the Rust/C++ build requirement for consumers. Keep the framework and platform components on matching release versions.
548
-
549
- For source builds, `cargo build --release --locked --features gzip-zlib-rs` enables an experimental alternative gzip/deflate backend. Ubuntu x64 trials reduced JSON API CPU cost but increased cumulative streaming RSS, so this option is disabled by default. It also changes the Rust PNG/TIFF codecs; runtime profiles and Node heap settings remain unchanged. Compare CPU, response size and memory on your workload before choosing it.
94
+ Source builds require Rust 1.98 and native build tools: Visual Studio C++ tools and a Windows SDK on Windows, Xcode command line tools on macOS, or a C/C++ toolchain and pkg-config on Linux. Install NASM on macOS, Linux and Windows x64.
550
95
 
551
96
  </details>
552
97
 
553
- ## Contributing
554
-
555
- Read the [contribution guide](https://github.com/Lorkydey/PRNext/blob/main/CONTRIBUTING.md),
556
- [Code of Conduct](https://github.com/Lorkydey/PRNext/blob/main/CODE_OF_CONDUCT.md)
557
- and [security policy](https://github.com/Lorkydey/PRNext/blob/main/SECURITY.md).
558
-
559
- <details>
560
- <summary><strong>License & credits</strong></summary>
561
-
562
- ### License and credits
563
-
564
- PRNext is licensed under the [MIT License](LICENSE), copyright © 2026 Thomas (Lorkydey). Commercial use, modification, and redistribution are permitted; keep the copyright and license notice when distributing copies or substantial portions of the software. Third-party components retain their own licenses.
98
+ ## Documentation
565
99
 
566
- If PRNext helps your project, a credit such as **“PRNext by Thomas (Lorkydey)”** with a link to [prnext.dev](https://prnext.dev) would be appreciated. A public credit is optional, not an additional license condition.
567
-
568
- </details>
100
+ [Guides](https://github.com/Lorkydey/PRNext/blob/main/packages/prnext/AI.md) · [Releases](https://github.com/Lorkydey/PRNext/releases) · [Contributing](https://github.com/Lorkydey/PRNext/blob/main/CONTRIBUTING.md) · [MIT License](https://github.com/Lorkydey/PRNext/blob/main/LICENSE)