How shared types work in bhvr
mainThe shared package is the source of truth for data contracts used by both the client and server. By defining types in shared/src/types, you achieve end-to-end type safety.
Workflow
- Define a type in
shared/src/types/index.ts. - Export it from
shared/src/index.tsusingexport * from "./types". - Import the type in either the
clientorserverusing thesharedpackage alias.
When you run bun run dev or bun run build, the shared package is compiled so its exports are available to the other workspaces via TypeScript path aliases.