Skip to content

Commit d0dddc3

Browse files
committed
docs: style guide
1 parent f40d247 commit d0dddc3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

apps/dashboard/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,17 @@ Some env vars can be overridden that are required for some external services to
2323

2424
To define env vars please create a `.env` file based on the `.env.example` template at the root level of the project. This file is ignored by git so you can safely add it to your local copy of the project.
2525

26-
**Add your thirdweb clientID and secret key to build a basic functioning version of the site.**
26+
**Add your thirdweb clientID and secret key to build a basic functioning version of the site.**
27+
28+
## Code Structure and Style Guide
29+
30+
### Components
31+
- Components should go in a `components` folder next to the app page they are used in.
32+
- If a component is reused in multiple pages, it should go in the lowest level route folder it is used in. For example, if a chart component is used in all analytics subroutes `/analytics/...`, it should go in the `/analytics/components` folder.
33+
- All low-level components such as buttons, inputs, etc. should be shadcn components found in `@/ui`.
34+
- All composed components reused across all page routes are `blocks`, and should also go in the `@/ui` folder.
35+
36+
### Data fetching
37+
- Use RSC wherever possible.
38+
- Write data fetching code in its own function in the same file as the component it is used in, not exported.
39+
- If the same data fetching function is used in multiple components, place it in a file in an `api` folder at the lowest level possible (just like components). If you need to do this you probable aren't organizing your components properly.

0 commit comments

Comments
 (0)