Video summary
TanStack Start is no joke.
Main summary
Key takeaways
What this video covers
Goal: Build a local monorepo containing Payload CMS as the backend and TanStack Start as the frontend, sharing types and calling Payload’s local API from TanStack Start.
- Tools demonstrated: Payload CMS, TanStack Start (RC), pnpm workspaces, TypeScript, Vite, Zod, payload rich-text converter packages, and various CLI project generators.
- End result: a monorepo where the frontend calls the local Payload API via TanStack Start server functions, with shared TypeScript types across packages.
Key technological concepts & product features
TanStack Start
- Full‑stack framework for React (and Solid) with SSR, streaming, and server functions.
- File-based routing with automatic route/layout generation.
- Does not yet ship React Server Components — you must use server functions for local API calls.
- Strong developer experience: fast startup, automatic routing, simple DX compared to some other setups.
Payload CMS
- Headless CMS used as the backend (collections, media relations, rich text, slug generation).
- Can generate TypeScript types for use across the monorepo to keep the frontend type-safe.
- Provides a local API usable from TanStack server functions (via
getPayload/payload.find).
Integration patterns demonstrated
Monorepo setup
- Create
pnpm-workspace.yamland top-levelpackage.jsonscripts (dev scripts for CMS and website,generate-types, etc.). - Generate a Payload app (
create payload app) and a TanStack Start app (pnpm create tanstack-start). - Export Payload config and types from the CMS
source/index.tsso the website can import config & types.
Calling Payload from TanStack Start
Because TanStack Start pages aren’t React Server Components yet, use server functions to fetch data from Payload:
- Create a server function that validates input (Zod).
- In the handler, dynamically import Payload and the CMS config (
getPayload+ config import from the CMS source). - Use
payload.findto query collections (e.g.,posts) and return the result to the page’s loader. - On the page, use a route loader +
useLoaderDatato access returned data.
File-based routing and dynamic routes
- Create files like
posts/$slug.tsx(TanStack Start file-based routing) and use server functions/loaders to fetch the document byslug.
Types & shared typings
- Generate Payload types via a script and import them in the frontend so collections and documents are strongly typed across the monorepo.
Practical implementation details, problems encountered & workarounds
- React Server Components are not yet supported in TanStack Start — use server functions for server-side data fetching.
- Type errors when fetching documents with rich text:
- Selecting full rich-text fields sometimes led to type/SSR problems. Workarounds:
- Use
payload.findwithselectto limit fields and avoid problematic nested structures. - If you need the full document, a temporary coercion is
JSON.stringify/JSON.parseto remove runtime/typing artifacts (not ideal long-term). - Regenerate types and restart dev servers to refresh types after changes.
- Use
- Selecting full rich-text fields sometimes led to type/SSR problems. Workarounds:
- Vite SSR issues with Payload imports:
- Add
optimizeDeps/excludeentries (excludepayloadand related packages) in Vite config to avoid SSR build/runtime errors.
- Add
- Images:
- Payload media returns a media object — cast/handle it on the frontend as needed.
- TanStack Start recommends image tools like
unpicfor image handling (unlike Next.js’ built-in Image).
- Rich text rendering:
- Install Payload’s conversion utilities (e.g.,
payload rich-text lexical-html) to convert rich text to HTML. - Render converted HTML in the page (e.g.,
dangerouslySetInnerHTML) or use a proper renderer.
- Install Payload’s conversion utilities (e.g.,
- Misc essentials:
- Install Zod for server function input validation.
- Use pnpm scripts to run both CMS and website concurrently.
- Pay attention to ports and CORS when running CMS + website locally.
Step-by-step checklist (high level)
- Create Payload backend:
npx create-payload-app(blank template) — remove front-end if unused. - Create TanStack Start app:
pnpm create tanstack-start(enable file-based routing). - Set up
pnpm-workspace.yamland top-levelpackage.jsonscripts for dev, generate types, etc. - Export Payload config & types from CMS
source/index.tsfor cross-package imports. - Create collections (e.g.,
posts) in Payload with fields:title,slug, rich text, image relation. - Generate types (script) and install needed packages (Zod, payload rich-text converter).
- In the TanStack Start route:
- Create a server function (
createServerFunction) with input validation (Zod). - Dynamically import Payload and CMS config in the server function handler.
- Query Payload (
payload.find) and return results. - In the route loader, call the server function and use
useLoaderDatain the component to render results.
- Create a server function (
- Handle images & rich text: cast media types, use image tooling (e.g.,
unpic), convert rich text to HTML for rendering. - If encountering SSR/type issues: try Vite
optimizeDepsexclude, regenerate types, or useJSON.stringify/JSON.parseas a temporary coercion.
Reviewer observations / opinions
- Presenter liked TanStack Start’s developer experience (speed, automatic routing) and sees potential for it as a competitor to Next.js.
- Rough edges exist due to RC status: missing React Server Components and some type friction with rich text and SSR.
- Overall, integration with Payload CMS was straightforward and performant.
- Monorepo approach is recommended for shared types and tighter integration.
Resources & references mentioned
- Payload CMS templates & docs (examples, rich text conversion).
- TanStack Start docs and example repo (routing, server functions).
- Packages referenced: Zod, Payload’s rich-text lexical-html converter,
unpic(for images), plus pnpm workspace tooling.
Main speaker / sources
- Presenter: NLV Codes (YouTuber; references nlvcodes.com and his channel).
- Primary sources: Payload CMS documentation & templates, TanStack Start documentation & example repo, and community/chat examples used during the coding session.
Rate this summary
Your feedback will help improve summaries.
Improve this summary
Reprocess with a stronger model when the summary feels incomplete or inaccurate.
Translate summary in another language
Ask questions to this video
Chat for follow-up questions, clarifications, and source-backed answers.