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 data entering the domain from outside your code- e.g. server function inputs, form validation, third-party data at the point it's fetched
todo.types.ts- plain types for everything else- e.g. component props, internal state, and function outputs your own code already trusts
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.