A fun little demo where Bun does almost everything.
This project exists for one reason: I wanted to play with Bun's built-in features and see what it feels like to let Bun handle almost everything in a small app.
Bun runs the server, handles WebSocket upgrades, bundles the frontend, manages packages, runs the tests, and talks to SQLite directly. The dependency list stays intentionally small so the project highlights Bun itself rather than a stack of abstractions.
The app itself is a small live polling room. Hosts can create rooms, queue draft polls, open a poll, and watch results update in real time while participants vote. It's simple on purpose. That simplicity makes it easier to explore Bun's capabilities.
- Bun as the package manager instead of
npm,pnpm, oryarn - Bun as the runtime instead of
node - Bun as the HTTP server via
Bun.serveinstead of adding Express or Hono - Bun as the bundler for the browser app instead of
vite - Bun as SQLite support via
bun:sqlite - Bun as WebSocket support for room-level realtime updates
- Bun as the test runner via
bun testinstead ofvitestorjest
- React 19
- Tailwind CSS v4
- SQLite
That's basically it. Bun handles everything else.
If I add an ORM, a WebSocket abstraction, a router framework, a schema layer, a migration tool, a state library, and three utility packages, then I learn less about Bun and more about the packages I chose. Those tools can be great. They just aren't the point here.
Keeping the dependency list lean means:
- the code is small enough to read in one sitting
- the platform capabilities are doing real work
- the overall system is easier to understand end to end
I would not treat this repo as a blueprint for every real production app. It's a fun demo and a learning project, not a serious argument that every app should skip the usual layers.
For instance, in real life, I'd strongly consider an ORM like Prisma or Drizzle, schema validation with zod, or at least a more deliberate data access layer once the schema starts growing and the queries become more complex.
And yes, Bun has more built-ins we could have explored here too. For example, we could have pushed the demo further with Bun's Redis integration and used it to experiment with caching.
This repo shows that Bun can carry a surprising amount of a small app while keeping the setup lightweight. Not sure if everything is production-ready, but pretty cool anyway!
- Create rooms with short codes
- Store host access with a generated host token
- Compose draft polls before opening them
- Allow only one open poll per room
- Persist rooms, polls, options, and votes in SQLite
- Broadcast live room state over WebSockets
- Track presence from active socket connections
- Keep closed polls in room history
bun install
bun run devOpen http://localhost:3000.
bun run devstarts the app with hot reloadbun run startstarts the app without hot reloadbun run testruns the test suitebun run test:coverageruns tests with coveragebun run seedseeds the databasebun run db:resetremoves the SQLite database files
By default the SQLite database lives at data/bun-as-everything.sqlite.
This project is open source and available under the MIT License.
See LICENSE for the full text.
