mbrv.org: Murat's Bun, React & Vite template
by murat
Most TypeScript bundlers that support UI hot reloads require running server & client on different processes/ports, leading to a cascade of problems.
MBRV runs on a single bun process without sacrificing dev or prod features, such as hot reloads or server-side rendering.
bun ito install packagesbun run devprovides hot reloads & source mapsbun run buildprepares production buildbun run prodserves production
client/contains React UI codeshared/folder contains shared interfaces, types, and functions that both client & server can useserver/contains http & socket APIs- Express endpoints in
server/apis/http.ts - Socket.io setup in
server/apis/sockets.ts
- Express endpoints in
- Server & client run on the same process, same port
- No proxies or CORS issues
- Speed aside, bun makes it a pleasure to run TypeScript without a transpiler
run.tsas single entry point
- UI code changes appear instantly in the browser
- Page will reload if any server code is changed
- Server & client can use shared TypeScript interfaces, types, and functions via
shared/folder
- SSR is done with explicit code, no framework magic
- Enabled by default, with entry point in
server/ssr.tsx - Use
--ssr=falseto disable SSR