Skip to content

Commit 1889db3

Browse files
committed
builder alpha.2
1 parent 14647a8 commit 1889db3

File tree

95 files changed

+8035
-3726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+8035
-3726
lines changed

.claude/tanstack-patterns.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# TanStack Patterns
2+
3+
## loaderDeps Must Be Specific
4+
5+
Only include properties actually used in the loader. This ensures proper cache invalidation.
6+
7+
```typescript
8+
// Bad: includes everything
9+
loaderDeps: ({ search }) => search,
10+
loader: async ({ deps }) => {
11+
await fetchData({ page: deps.page, pageSize: deps.pageSize })
12+
}
13+
14+
// Good: only what's used
15+
loaderDeps: ({ search }) => ({
16+
page: search.page,
17+
pageSize: search.pageSize,
18+
}),
19+
loader: async ({ deps }) => {
20+
await fetchData({ page: deps.page, pageSize: deps.pageSize })
21+
}
22+
```
23+
24+
## Loaders Are Isomorphic
25+
26+
Loaders run on both server and client. They cannot directly access server-only APIs.
27+
28+
```typescript
29+
// Bad: direct server API access
30+
loader: async () => {
31+
const data = await fs.readFile('data.json')
32+
return { data }
33+
}
34+
35+
// Good: call a server function
36+
loader: async () => {
37+
const data = await serverFn({ data: { id: '123' } })
38+
return { data }
39+
}
40+
```
41+
42+
## Environment Shaking
43+
44+
TanStack Start strips any code not referenced by a `createServerFn` handler from the client build.
45+
46+
- Server-only code (database, fs) is automatically excluded from client bundles
47+
- Only code inside `createServerFn` handlers goes to server bundles
48+
- Code outside handlers is included in both bundles
49+
50+
## Importing Server Functions
51+
52+
Server functions wrapped in `createServerFn` can be imported statically. Never use dynamic imports for server-only code in components.
53+
54+
```typescript
55+
// Bad: dynamic import causes bundler issues
56+
const rolesQuery = useQuery({
57+
queryFn: async () => {
58+
const { listRoles } = await import('~/utils/roles.server')
59+
return listRoles({ data: {} })
60+
},
61+
})
62+
63+
// Good: static import
64+
import { listRoles } from '~/utils/roles.server'
65+
66+
const rolesQuery = useQuery({
67+
queryFn: async () => listRoles({ data: {} }),
68+
})
69+
```
70+
71+
## Server-Only Import Rules
72+
73+
1. `createServerFn` wrappers can be imported statically anywhere
74+
2. Direct server-only code (database clients, fs) must only be imported:
75+
- Inside `createServerFn` handlers
76+
- In `*.server.ts` files

.claude/typescript.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# TypeScript Conventions
2+
3+
## Avoid Type Casting
4+
5+
Never cast types unless absolutely necessary. This includes:
6+
7+
- Manual generic type parameters (e.g., `<Type>`)
8+
- Type assertions using `as`
9+
- Type assertions using `satisfies`
10+
11+
## Prefer Type Inference
12+
13+
Infer types by going up the logical chain:
14+
15+
1. **Schema validation** as source of truth (Convex, Zod, etc.)
16+
2. **Type inference** from function return types, API responses
17+
3. **Fix at source** (schema, API definition, function signature) rather than casting at point of use
18+
19+
```typescript
20+
// Bad
21+
const result = api.getData() as MyType
22+
const value = getValue<MyType>()
23+
24+
// Good
25+
const result = api.getData() // Type inferred from return type
26+
const value = getValue() // Type inferred from implementation
27+
```
28+
29+
## Generic Type Parameter Naming
30+
31+
All generic type parameters must be prefixed with `T`.
32+
33+
```typescript
34+
// Bad
35+
function withCapability<Args extends unknown[], R>(
36+
handler: (user: AuthUser, ...args: Args) => R,
37+
) { ... }
38+
39+
// Good
40+
function withCapability<TArgs extends unknown[], TReturn>(
41+
handler: (user: AuthUser, ...args: TArgs) => TReturn,
42+
) { ... }
43+
```
44+
45+
Common names: `T`, `TArgs`, `TReturn`, `TData`, `TError`, `TKey`, `TValue`

.claude/ui-style.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# UI Style Guide 2026
2+
3+
## Layout
4+
5+
- Fewer, well-defined containers over many small sections
6+
- Generous spacing creates separation before adding visual effects
7+
- Cards are acceptable when they express grouping or hierarchy
8+
9+
## Corners
10+
11+
- Rounded corners are standard
12+
- Subtle radius values that feel intentional, not playful
13+
- Avoid sharp 90-degree corners unless intentionally industrial
14+
15+
## Shadows and Depth
16+
17+
- Soft, low-contrast, diffused shadows
18+
- Shadows imply separation, not elevation theatrics
19+
- No heavy drop shadows or strong directional lighting
20+
- One to two shadow layers max
21+
22+
## Cards
23+
24+
- Cards should feel grounded, not floating
25+
- Light elevation, border plus shadow, or surface contrast
26+
- Don't overuse cards as a default layout primitive
27+
28+
## Color and Surfaces
29+
30+
- Soft neutrals, off-whites, warm grays
31+
- Surface contrast or translucency instead of strong outlines
32+
- Glass/frosted effects acceptable when subtle and accessible
33+
34+
## Interaction
35+
36+
- Micro transitions reinforce spatial relationships
37+
- Hover/focus states feel responsive, not animated
38+
- No excessive motion or springy effects
39+
40+
## Typography
41+
42+
- Strong headings, calm body text
43+
- No visual noise around content
44+
45+
## What to Avoid
46+
47+
- Chunky shadows
48+
- Overly flat, sterile layouts
49+
- Neumorphism as primary style
50+
- Over-designed card grids
51+
52+
**Summary: If depth does not improve comprehension, remove it.**

.claude/workflow.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Workflow
2+
3+
## Build Commands
4+
5+
- `pnpm test`: Run at end of task batches
6+
- `pnpm build`: Only for build/bundler issues or verifying production output
7+
- `pnpm lint`: Check for code issues
8+
- `dev` runs indefinitely in watch mode
9+
10+
Don't build after every change. This is a visual site; assume changes work.
11+
12+
## Debugging Visual Issues
13+
14+
When something doesn't work or look right:
15+
16+
1. Use Playwright MCP to view the page and debug visually
17+
2. Use `pnpm build` only for build/bundler issues
18+
3. Use `pnpm lint` for code issues
19+
20+
## Playwright Testing
21+
22+
Preferred method for verifying visual changes:
23+
24+
- Navigate to the relevant page
25+
- Take snapshots/screenshots to verify UI
26+
- Interact with elements to test functionality

0 commit comments

Comments
 (0)