A fullstack boilerplate for developing modern web applications with a Hono-based backend powered by Bun and a React-powered frontend. This repository is designed to provide a smooth developer experience with clear organizational structure, rapid startup, and integrated Cloudflare D1 database support.
Before you get started, ensure you have the following prerequisites installed:
- Bun
- Wrangler CLI
- A Cloudflare account with access to D1 databases
-
Install Dependencies
Run
bun installin both thefrontendandbackenddirectories:cd frontend && bun install cd ../backend && bun install
-
Create the D1 Database
Use the Wrangler CLI to create your Cloudflare D1 database:
wrangler d1 create <DATABASE_NAME>
After creation, update the
wrangler.jsoncfile in the backend directory with the output details, such as yourCLOUDFLARE_DATABASE_ID. -
Configure Environment Variables
In the
backenddirectory, copy the.env.examplefile to.env:cp .env.example .env
Then, update the following variables in your
.envfile with your Cloudflare credentials and database details:CLOUDFLARE_ACCOUNT_IDCLOUDFLARE_DATABASE_IDCLOUDFLARE_D1_TOKENDB_NAME
-
Run the Application
To start the backend server:
bun run dev
For development of the frontend (if using Vite or the bundled script), you can run:
bun run dev