Repository navigation
Closed
Description
Summary
omp-web uses very little of Next.js: three pages, all of which render the client-side AppShell, plus 70 API route handlers written against the Web Request/Response API. Meanwhile, Next blocks features we need. I propose running omp-web on Bun: Bun.serve for the API, static files and WebSockets, and Bun's bundler for the React app. The implementation is #344, stacked on #342. User-visible behavior, URLs, ports and environment variables stay the same.
Why
- No WebSocket support. Remote and local hosts (feat(hosts): run sessions on other machines through an ompweb host daemon #339, feat(hosts): omp runs survive web-server restarts through a local daemon #342) link to the web server over several long-lived HTTP legs, with separate requests for binary data. A WebSocket would replace them with one socket that carries text and binary frames. A Next route handler cannot accept the WebSocket handshake (the HTTP upgrade); the only way around it is a custom server wrapped around Next.
- Body limit. The proxy layer silently truncates request bodies over 10 MB, so
/api/hosts/linkhas to bypass it. - Two module instances. The startup hook (
instrumentation) and the route handlers load separate copies of the same modules, which has already caused a class-identity bug. - Traps. For example,
next buildduring development breaksnext dev, Google Fonts are downloaded at build time (a source of CI flakes), and AGENTS.md has to warn that "this is NOT the Next.js you know". - It matches omp. omp is a Bun program, and Bun includes most of what we use separately today: TypeScript without a loader, SQLite, image resizing (
Bun.Imagereplacessharp), proxy support infetch(replacesundici), and a test runner.
Feasibility spike (Linux)
| Area | Result |
|---|---|
| API routes | All 70 load and run under Bun.serve; Bun's 10 s idle timeout is lifted per authenticated request so SSE and the host link stay open |
| WebSocket | Auth checked before the upgrade; text and binary frames in both directions |
node:sqlite, web-push, startup hook, password gate |
Work unchanged (the PR then moves the store to bun:sqlite) |
| Front end | Renders with small replacements for next/dynamic and next/navigation; fonts self-hosted |
| Tests | The whole suite now runs under bun test (1985 pass in #344) |
| Thumbnails | Bun.Image resize plus WebP output matches sharp |
Distribution
The npm package bun becomes a dependency, so npm i -g @kahme247/ompweb and npx keep working with no separate Bun install. A small Node launcher runs the server under that Bun binary.
Open points
- macOS and Windows will be verified on real machines and in Windows CI before feat: run omp-web on Bun instead of Next.js #344 is marked ready.
- feat: run omp-web on Bun instead of Next.js #344 also ships a compiled
ompwebbinary per platform (server program only; the client files sit beside it).
This was agreed with the maintainer beforehand; this issue records the rationale and tracks #344.
Metadata
Metadata
Assignees
Labels
No labels
Activity