README.md 2.0 K raw
1
# đŸĻĢ bhvr
2
3
A full-stack TypeScript monorepo starter with shared types, using Bun, Hono, Vite, and React
4
5
## Features
6
7
- **Full-Stack TypeScript**: End-to-end type safety between client and server
8
- **Shared Types**: Common type definitions shared between client and server
9
- **Monorepo Structure**: Organized as a workspaces-based monorepo
10
- **Modern Stack**:
11
  - [Bun](https://bun.sh) as the JavaScript runtime
12
  - [Hono](https://hono.dev) as the backend framework
13
  - [Vite](https://vitejs.dev) for frontend bundling
14
  - [React](https://react.dev) for the frontend UI
15
16
## Project Structure
17
18
```
19
.
20
├── client/               # React frontend
21
├── server/               # Hono backend
22
├── shared/               # Shared TypeScript definitions
23
│   └── src/types/        # Type definitions used by both client and server
24
└── package.json          # Root package.json with workspaces
25
```
26
27
## Getting Started
28
29
### Installation
30
31
```bash
32
# Install dependencies for all workspaces
33
bun install
34
```
35
36
### Development
37
38
```bash
39
# Run shared types in watch mode, server, and client all at once
40
bun run dev
41
42
# Or run individual parts
43
bun run dev:shared  # Watch and compile shared types
44
bun run dev:server  # Run the Hono backend
45
bun run dev:client  # Run the Vite dev server for React
46
```
47
48
### Building
49
50
```bash
51
# Build everything
52
bun run build
53
54
# Or build individual parts
55
bun run build:shared  # Build the shared types package
56
bun run build:client  # Build the React frontend
57
```
58
59
## Type Sharing
60
61
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:
62
63
```typescript
64
import { ApiResponse } from '@shared/types';
65
```
66
67
## Learn More
68
69
- [Bun Documentation](https://bun.sh/docs)
70
- [Vite Documentation](https://vitejs.dev/guide/)
71
- [React Documentation](https://react.dev/learn)
72
- [Hono Documentation](https://hono.dev/docs)
73
- [TypeScript Documentation](https://www.typescriptlang.org/docs/)