docs/pages/packages/shared.mdx 732 B raw
1
# `shared`
2
3
The `shared` package is primarily used for types that you may want to pass between server and client, but it can also be used for functions or libraries. When you create a project with `bun create bhvr@latest` this is the structure of the package.
4
5
```
6
shared
7
├── package.json
8
├── src
9
│   ├── index.ts
10
│   └── types
11
│       └── index.ts
12
└── tsconfig.json
13
```
14
15
It will resemble a barrel export pattern, so the contents of `src/index.ts` are the following
16
17
```typescript src/index.ts
18
export * from "./types"
19
```
20
21
By running either `bun run build` or `bun run dev` the types will be compiled and exported from the `dist` build folder and can be used in `client` or `server`.