Skip to content
/ fullstack-bun Public template

Single-page web app project template curated for performance, developer experience, and type safety. Bun/Elysia backend, React Router frontend, Socket.IO and TanStack Query bridging the gap.

License

Notifications You must be signed in to change notification settings

cdleveille/fullstack-bun

Repository files navigation

fullstack-bun

Single-page web app project template curated for performance, developer experience, and type safety. Bun/Elysia backend, React Router frontend, Socket.IO and TanStack Query bridging the gap.

Features

  • Server/client interaction is 100% type-safe. See api.ts and useApi.ts for simple HTTP and WebSocket examples.

  • Scalar documentation for API routes is served on /api/reference. OpenAPI Specification raw .json data is served on /api/reference/json.

  • The client meets PWA requirements for an installable, native app-like experience on a variety of platforms, and boasts a near-perfect PageSpeed Insights score out of the box.

  • Installs a service worker for caching static assets and API responses client-side, enabling offline functionality and faster subsequent loads with fewer requests to the server.

  • Includes a Dockerfile, fly.toml, and GitHub workflow for deploying to fly.io on pushes to the main branch. The Dockerfile compiles the app into a standalone binary and runs it in a distroless image.

Not Implemented

  • Server-side rendering

  • Database

  • Authentication

  • CSS Framework

  • Tests

...but I may look into adding these in the future!

Development

Install Bun.

Optionally create a .env file in the root directory to override default environment variables. See .env.example for available options.

Install dependencies and launch:

bun install
bun run dev

Production

Build client and compile server to standalone binary:

bun run build
bun run compile

Start server by executing the compiled main binary or by running:

bun run start

Alternatively, build and run in a Docker container:

docker build -t fullstack-bun .
docker run -p 3000:3000 fullstack-bun

Stack

About

Single-page web app project template curated for performance, developer experience, and type safety. Bun/Elysia backend, React Router frontend, Socket.IO and TanStack Query bridging the gap.

Topics

Resources

License

Stars

Watchers

Forks