A full-stack TypeScript monorepo starter with shared types, using Bun, Hono, Vite, and React
While there are plenty of existing app building stacks out there, many of them are either bloated, outdated, or have too much of a vendor lock-in. bhvr is built with the opinion that you should be able to deploy your client or server in any enviorment while also keeping type saftey.
- Full-Stack TypeScript: End-to-end type safety between client and server
- Shared Types: Common type definitions shared between client and server
- Monorepo Structure: Organized as a workspaces-based monorepo
- Modern Stack:
.
├── client/ # React frontend
├── server/ # Hono backend
├── shared/ # Shared TypeScript definitions
│ └── src/types/ # Type definitions used by both client and server
└── package.json # Root package.json with workspaces
# Install dependencies for all workspaces
bun install
# Run shared types in watch mode, server, and client all at once
bun run dev
# Or run individual parts
bun run dev:shared # Watch and compile shared types
bun run dev:server # Run the Hono backend
bun run dev:client # Run the Vite dev server for React
# Build everything
bun run build
# Or build individual parts
bun run build:shared # Build the shared types package
bun run build:client # Build the React frontend
Deplying each piece is very versatile and can be done numerous ways, and exploration into automating these will happen at a later date. Here are some references in the meantime.
Client
Server
Types are automatically shared between the client and server thanks to the shared package and TypeScript path aliases. You can import them in your code using:
import { ApiResponse } from '@shared/types';