https://github.com/renderffx/ppr-scratch
partial-pre-rendering engine react 19
https://github.com/renderffx/ppr-scratch
ppr render static-hole
Last synced: 6 days ago
JSON representation
partial-pre-rendering engine react 19
- Host: GitHub
- URL: https://github.com/renderffx/ppr-scratch
- Owner: renderffx
- License: isc
- Created: 2026-05-26T14:18:45.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-05-26T17:53:03.000Z (about 1 month ago)
- Last Synced: 2026-05-26T18:27:10.514Z (about 1 month ago)
- Topics: ppr, render, static-hole
- Language: JavaScript
- Homepage:
- Size: 94.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ppr-scratch
[](https://github.com/renderffx/ppr-scratch/actions/workflows/ci.yml)
Next.js-style Partial Prerendering engine using React 19 Canary (`prerenderToNodeStream` / `resumeToPipeableStream`).
## Quick Start
```bash
npm install
npm run build
npm start
# http://localhost:3000
```
## Commands
| Command | Description |
|---------|-------------|
| `npm run build` | Full pipeline: prereqs → clean → bundle → RSC flight → prerender |
| `npm start` | Start Express server on port 3000 |
| `npm run test` | Artifact contract tests |
| `npm run test:unit` | Unit tests (phase, dynamic-apis, flight-cache) |
| `npm run test:e2e` | End-to-end prerender→resume pipeline test |
| `npm run test:all` | All tests |
| `npm run dev:loop` | Build + all tests |
| `npm run clean` | Remove `dist/` |
| `npm run clean:cache` | Remove `.rsc_cache/` |
| `npm run prewarm` | Prewarm RSC cache entries |
## API
| Method | Path | Description |
|--------|------|-------------|
| GET | `/` | Serves static prerendered shell HTML |
| GET | `/rsc-payload` | Raw RSC Flight v1 binary payload |
| GET | `/cache/:name` | Cached RSC entry by component name |
| POST | `/resume` | Resume postponed boundaries (JSON) |
| POST | `/resume/stream` | Resume boundaries as chunked HTML |
| GET | `/api/status` | Build status and artifact health |
| GET | `/api/manifest` | Raw build manifest |
Environment: `PORT` (default 3000), `PPR_RESUME_TIMEOUT` (default 10000ms).
## Architecture
### Build Pipeline
```
src/App.js ──esbuild──▶ dist/App.bundle.js
│
build-rsc.js │
└── react-server-dom-webpack ──▶ dist/rsc-payload.bin
build.js
├── setPhase('prerender')
├── prewarm-cache → .rsc_cache/*.bin
├── prerenderToNodeStream(App)
│ └── dynamic components throw NEVER promise
│ └── Suspense boundaries → postponed state
│ └── onShellReady fires → abort(request) via patch
│ └── resolves with {postponed, prelude}
├── prelude → dist/shell.html ( markers)
├── postponed JSON → dist/postponed.json
├── RSC payload embedded in shell