A modern frontend application built with TanStack Start, demonstrating server-side rendering, infinite scroll pagination, and modern React patterns.
- Framework: TanStack Start (React 19, SSR)
- Routing: TanStack Router (file-based)
- Data Fetching: TanStack Query v5
- Validation: Zod v4
- Styling: Tailwind CSS v4
- Components: Radix UI primitives
- Icons: Lucide React
- Date Handling: Day.js
- Build: Vite 7
- Testing: Vitest + Testing Library
- Node.js 20+
- Yarn
# Install dependencies
yarn install
# Start development server
yarn devThe app will be available at http://localhost:3000.
| Command | Description |
|---|---|
yarn dev |
Start development server on port 3000 |
yarn build |
Build for production |
yarn serve |
Preview production build |
| Command | Description |
|---|---|
yarn test |
Run tests once |
yarn test:watch |
Run tests in watch mode |
yarn test:coverage |
Run tests with coverage report |
| Command | Description |
|---|---|
yarn lint |
Check for linting errors |
yarn lint:fix |
Fix linting errors |
yarn format |
Check code formatting |
yarn format:fix |
Fix code formatting |
yarn scan |
Run format, lint, and type check |
src/
├── config/ # App-wide configuration (constants, routes, query keys, validation)
├── utils/ # App-wide utility functions (dayjs date utilities, head generation, helpers)
├── hooks/ # App-wide custom React hooks (shared across features)
├── components/
│ ├── atoms/ # Reusable UI primitives (Button, Table, etc.)
│ └── layout/ # Layout components (Header, NotFound)
├── i18n/ # Internationalization (i18next config, translations)
├── theme/ # Theme provider and utilities
├── screens/ # Feature modules
│ └── [feature]/
│ ├── api/ # Feature-specific server functions
│ ├── components/ # Feature-specific components
│ ├── hooks/ # Feature-specific hooks
│ ├── utils/ # Feature-specific utilities
│ └── types/ # Feature-specific types
└── routes/ # TanStack Router file-based routes
| Location | Purpose | Example |
|---|---|---|
src/config/ |
App-wide configuration, constants | constants.ts, routes.ts |
src/utils/ |
App-wide utility functions | helpers.ts, date.ts |
src/hooks/ |
App-wide custom hooks (shared across features) | useLocalStorage.ts, useMediaQuery.ts |
src/screens/[feature]/ |
Feature-scoped code (api, components, hooks) | todos/hooks/useCreateTodoMutation.ts |
Rule: If it's used by multiple features → global folder (config/, utils/, hooks/). If it's feature-specific → feature folder (screens/[feature]/).
# Check and fix all issues
yarn scan
# Or run individually
yarn lint:fix
yarn format:fixThis project uses Conventional Commits. Commits are validated with commitlint.
# Examples
git commit -m "feat: add user authentication"
git commit -m "fix: resolve routing issue"
git commit -m "refactor: extract validation logic"# Run tests once
yarn test
# Run tests in watch mode
yarn test:watch
# Run tests with coverage report
yarn test:coverageAfter running yarn test:coverage, reports are generated in the ./coverage directory:
| Report | Location | Description |
|---|---|---|
| HTML | coverage/index.html |
Interactive browser-based report |
| Text | Terminal output | Quick summary in console |
| JSON | coverage/coverage-final.json |
Machine-readable coverage data |
| Cobertura | coverage/cobertura-coverage.xml |
CI/CD integration (GitLab, etc.) |
| Metric | Threshold |
|---|---|
| Lines | 50% |
| Functions | 50% |
| Branches | 40% |
| Statements | 50% |
Tests will fail if coverage drops below these thresholds.
Files are loaded in this order (later files override earlier):
.env.local # Local overrides (add to .gitignore)
.env.production # Production-specific variables
.env.development # Development-specific variables
.env # Default variables (commit to git)
Server Functions (Node.js) Client Components (Browser)
├── process.env.* ├── import.meta.env.VITE_*
├── Full access to all vars ├── Only VITE_ prefixed vars
├── Secrets are safe here ├── Everything is public here
└── Database, API keys, etc. └── URLs, flags, public config
The boundary is enforced by the bundler - server-only code is stripped from client bundles automatically by TanStack Start/Vite.