remix package. Remix 3 is published under the next tag on npm while it is in beta. Its server runs on Bun as-is.
This guide covers Remix 3. To create a Remix 2 project, use
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. app/actions/home-page.tsx renders the starter home page.
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, so the script fails under Bun. See Node.js
compatibility. bun --watch restarts the server on changes instead.The router is a
fetch handler, so you can also serve the app with Bun.serve() instead of node:http.
server.ts
See the Remix documentation to learn more.