TanStack Start Project Structure
Standard TanStack Start project structure I use for my projects, can be copied into a
CLAUDE.md/AGENTS.md file for agents to follow.
Project Structure
src/libcontains the project's library code, grouped by domain via this naming convention (e.g. for atodosdomain):todos.server.ts— server-only code, usually paired withtodos.server.test.tsto unit test it.todos.functions.ts— a thin wrapper exposing server functions, importing fromtodos.server.ts.- Exported server functions should be named with the
Fnsuffix, e.g.getTodosFn,createTodoFn, etc.- This makes it clearer what is a server function and what isn't
- Exported server functions should be named with the
todos.schemas.ts— Zod schemas for the domain.todo.types.ts— TypeScript types for the domain, usually used if Zod schemas are not required.todos.ts— isomorphic code that can run on either the client or server (e.g. date helpers), usually paired withtodos.test.tsto unit test it.