Skip to content

jpcpereira93/react-router-bun-hono-template

Repository files navigation

Welcome to React Router with Bun and Hono Server!

Remix React Router React Vite Bun Hono Vitest React Testing Library Biome Docker

A modern, production-ready template for building full-stack React applications using React Router with Bun and Hono.

Open in StackBlitz

Features

  • 🚀 Server-side rendering (w/ Bun & Hono Server!)
  • ⚡️ Hot Module Replacement (HMR)
  • 📦 Asset bundling and optimization
  • 🔄 Data loading and mutations
  • 🔒 TypeScript by default
  • 🎉 TailwindCSS for styling
  • 📖 React Router docs
  • 🧪 Vitest + React Testing Library for testing
  • 🔍 BiomeJS for code linting & formatting

Getting Started

Prerequisites

This template uses bun as the package manager and Javascript Runtime. So, you need to install bun globally:

curl -fsSL https://bun.sh/install | bash

Installation

Install the dependencies:

bun install

Development

Start the development server with HMR:

bun dev

Your application will be available at http://localhost:5173.

Building for Production

Create a production build:

bun run build

Deployment

Docker Deployment

This template includes a Dockerfile to simplify the deployment:

To build and run using Docker:

# Build the image
docker build -t my-app .

# Run the container
docker run -p 3000:3000 my-app

The containerized application can be deployed to any platform that supports Docker, including:

  • AWS ECS
  • Google Cloud Run
  • Azure Container Apps
  • Digital Ocean App Platform
  • Fly.io
  • Railway

DIY Deployment

If you're familiar with deploying Node or Bun applications, the built-in app server is production-ready.

Make sure to deploy the output of bun run build

├── package.json
├── bun.lockb
├── build/
│   ├── client/    # Static assets
│   └── server/    # Server-side code

Linting & Formatting

Biome is used to ensure code consistency across the project. It is already included a config file with the default + recommended options to enable when using this setup. Feel free to change it to your liking!

To run all the biome checks (linting and formatting):

bun biome check

To automatically fix linting issues and format code:

bun biome check --write

Testing

This template uses Vitest as the testing framework and React Testing Library for component testing. There's also included a basic setup with recommended settings.

To run the tests, use the following command:

bun run test

This will run all the unit and integration tests.

To watch and re-run tests on file changes during development:

bun run test:watch

Styling

This template comes with Tailwind CSS already configured for a simple default starting experience. You can use whatever CSS framework you prefer.


About

A Remix/React-Router v7 template using Bun and Hono.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published