This episode walks through a real project setup: scaffolding Vite with React-TypeScript, installing all five TanStack libraries, organizing the folder structure, and configuring TypeScript and ESLint so your code stays consistent and type-safe.

The first two episodes built conceptual understanding. Now it's time to take action: build a React project with the entire TanStack ecosystem installed and configured correctly. This project will be the home for the experimental code throughout the series.
Episode 3 covers scaffolding a project with Vite, installing TanStack Query, Table, Router, Virtual, and Charts, the recommended folder structure, and TypeScript and ESLint configuration to keep your code consistent.
Make sure the episode 0 toolchain is working before you begin. If it is, follow the step-by-step guide below.
Vite is our main build tool. Run the following scaffold:
npm create vite@latest belajar-tanstack -- --template react-ts
cd belajar-tanstack
npm installnpm create vite@latest belajar-tanstack -- --template react-ts creates a project with TypeScript enabled. After npm install, run npm run dev to make sure the boilerplate page appears at http://localhost:5173.
Now install all the TanStack libraries at once:
npm i @tanstack/react-query @tanstack/react-query-devtools
npm i @tanstack/react-table
npm i @tanstack/react-router @tanstack/router-plugin
npm i @tanstack/react-virtual
npm i @tanstack/react-chartsSummary of each package:
@tanstack/react-query: data fetching and caching hooks.@tanstack/react-query-devtools: query debugging panel.@tanstack/react-table: headless table core.@tanstack/react-router: type-safe router.@tanstack/router-plugin: Vite plugin for file-based routing.@tanstack/react-virtual: list and table virtualization.@tanstack/react-charts: charts for dashboards.Check the dependency list in package.json:
"dependencies": {
"@tanstack/react-charts": "^2.0.0",
"@tanstack/react-query": "^5.0.0",
"@tanstack/react-table": "^8.0.0",
"@tanstack/react-virtual": "^3.0.0"
}All packages use the @tanstack/* prefix. The installed major versions may differ from the example above — that's normal, TanStack regularly ships minor and major releases.
The following structure separates query, table, router, and components so it stays scale-friendly:
src/
├── components/ # komponen UI umum
├── features/ # fitur per modul: todos, dashboard
├── hooks/ # custom hooks memakai useQuery
├── routes/ # route tree TanStack Router
├── lib/ # queryClient, fetchers, helpers
├── main.tsx
└── App.tsxThe lib/ folder is where queryClient is created once and then imported anywhere. routes/ holds route definitions, and hooks/ houses query functions so components stay lean. This pattern is used starting from episode 4.
The type-safe router requires special settings in tsconfig.json:
{
"compilerOptions": {
"strict": true,
"moduleResolution": "bundler",
"jsx": "react-jsx"
}
}strict: true enables the strict type checking that Router and Query inference need. moduleResolution: "bundler" is the right choice for Vite projects. If you use file-based routing, add tanstackRouterPlugin to vite.config.ts so route codegen runs automatically.
The Vite React-TS project already ships with ESLint configuration. Keep formatting tidy with Prettier:
npm i -D prettier eslint-config-prettierAdd eslint-config-prettier at the end of the ESLint config extends list so Prettier rules don't conflict with lint rules. That way, code formatting stays uniform across the whole team automatically.
Episode 3 completed the setup: the Vite React-TypeScript project was created, all five TanStack libraries installed, the folder structure organized, and TypeScript and ESLint configured. From here, you have the stage to write your first query in episode 4.
Key takeaways:
npm create vite for scaffolding.@tanstack/* prefix.@tanstack/react-query-devtools is useful for debugging.strict: true in tsconfig matters for type inference.eslint-config-prettier keeps code consistent.In the next episode, episode 4, we'll discuss query and data fetching — QueryClientProvider, useQuery, staleTime and gcTime, error handling with retry, and background refetching. This is the core episode that changes how you fetch data in React. Make sure npm run dev is running, because the first experiments begin!