remix package. It is published under the next tag on npm while it is in beta, and its server runs on Bun as-is.
This guide covers Remix 3. Remix 2 projects are created with
create-remix instead.Scaffold a new project with the Remix CLI.
terminal
terminal
The generated
server.ts creates a node:http server that hands every request to the app’s router. Bun runs it directly; pass --watch to restart the server whenever a file it imports changes.
terminal
app/routes.ts and app/router.ts, and the starter home page is rendered by app/actions/home-page.tsx.
The
scripts generated in package.json run the server with Node.js and the remix/node-tsx TypeScript loader. Bun runs TypeScript itself, so point the scripts at bun instead.
package.json
terminal
The generated
hmr script (hmr.ts) also loads remix/node-tsx, which relies on module.registerHooks(). Bun does
not implement that API yet (see Node.js compatibility), so the script fails
under Bun; bun --watch restarts the server on changes instead.The router is a
fetch handler, so the app can also be served with Bun.serve() instead of node:http.
server.ts
See the Remix documentation to learn more.