update solid start docs #5347
Mergedbrenelz(GitHub profile, opens in a new tab)merged 2 commits into
main fromrefs/pull/5347/headmerged by brenelz(GitHub profile, opens in a new tab) github-actions[bot](GitHub profile, opens in a new tab) added labelsdocumentation
- @@ -26,9 +26,9 @@2626 npm install -D vite-tsconfig-paths2727 ```282829-Now, you'll need to update your `app.config.ts` file to include the following:29+Now, you'll need to update your `vite.config.ts` file to include the following:30303131 ```ts3232 // app.config.ts33-import { defineConfig } from '@tanstack/react-start/config'33+import { defineConfig } from 'vite'3434 import viteTsConfigPaths from 'vite-tsconfig-paths'docs/start/framework/solid/build-from-scratch.md lines 25 to 26@@ -21,0 +6,21 @@6+ [!NOTE]7+ If you chose to quick start with an example or cloned project, you can skip this guide and move on to the [Routing](../routing) guide.8+9+_So you want to build a TanStack Start project from scratch?_10+11+This guide will help you build a **very** basic TanStack Start web application. Together, we will use TanStack Start to:12+13+Serve an index page14+Display a counter15+Increment the counter on the server and client16+17+Let's create a new project directory and initialize it.18+19+```shell20+mkdir myApp21+cd myApp22+npm init -y23+```24+25+ [!NOTE] > We use `npm` in all of these examples, but you can use your package manager of choice instead.26+docs/start/framework/solid/build-from-scratch.md lines 114 to 125@@ -21,0 +105,21 @@105+106+## Add the Basic Templating107+108+There are 2 required files for TanStack Start usage:109+110+The router configuration111+The root of your application112+113+Once configuration is done, we'll have a file tree that looks like the following:114+115+```116+.117+├── src/118+│ ├── routes/119+│ │ └── `__root.tsx`120+│ ├── `router.tsx`121+│ ├── `routeTree.gen.ts`122+├── `vite.config.ts`123+├── `package.json`124+└── `tsconfig.json`125+```docs/start/framework/solid/environment-variables.md lines 94 to 99@@ -5,0 +79,21 @@79+export function FeatureGatedComponent() {80+ const enableNewFeature = import.meta.env.VITE_ENABLE_NEW_FEATURE === 'true'81+82+ if (!enableNewFeature) return null83+84+ return <NewFeature />85+}86+```87+88+## Environment File Setup89+90+### File Hierarchy (Loaded in Order)91+92+TanStack Start automatically loads environment files in this order:93+94+```95+.env.local # Local overrides (add to .gitignore)96+.env.production # Production-specific variables97+.env.development # Development-specific variables98+.env # Default variables (commit to git)99+```docs/start/framework/solid/getting-started.md lines 10 to 13@@ -1,9 +1,13 @@11 ---2-ref: docs/start/framework/react/getting-started.md3-replace:4- {5- '@tanstack/react-start': '@tanstack/solid-start',6- 'React': 'SolidJS',7- 'react-router': 'solid-router',8- }2+id: getting-started3+title: Getting Started94 ---5+6+## Start a new project from scratch7+8+Choose one of the following options to start building a _new_ TanStack Start project:9+10+[TanStack Start CLI] - Just run `npm create @tanstack/start@latest`. Local, fast, and optionally customizable11+[TanStack Builder](#) (coming soon!) - A visual interface to configure new TanStack projects with a few clicks12+[Quick Start Examples](../quick-start) Download or clone one of our official examples13+[Build a project from scratch](../build-from-scratch) - A guide to building a TanStack Start project line-by-line, file-by-file.docs/start/framework/solid/hosting.md lines 197 to 205@@ -5,0 +185,21 @@185+186+```187+ "nitro": "npm:nitro-nightly",188+```189+190+```tsx191+import { tanstackStart } from '@tanstack/solid-start/plugin/vite'192+import { defineConfig } from 'vite'193+import viteSolid from 'vite-plugin-solid'194+import { nitro } from 'nitro/vite'195+196+export default defineConfig({197+ plugins: [198+ tanstackStart(),199+ nitro(/*200+ // nitro config goes here, e.g.201+ { config: { preset: 'node-server' } }202+ */)203+ viteSolid({ssr: true}),204+ ],205+})docs/start/framework/solid/hosting.md lines 251 to 255@@ -5,0 +235,21 @@235+236+### Bun237+238+Follow the [`Nitro`](#nitro) deployment instructions.239+Depending on how you invoke the build, you might need to set the `'bun'` preset in the Nitro configuration:240+241+```ts242+// vite.config.ts243+import { tanstackStart } from '@tanstack/solid-start/plugin/vite'244+import { defineConfig } from 'vite'245+import viteSolid from 'vite-plugin-solid'246+import { nitroV2Plugin } from '@tanstack/nitro-v2-vite-plugin'247+// alternatively: import { nitro } from 'nitro/vite'248+249+export default defineConfig({250+ plugins: [251+ tanstackStart(),252+ nitroV2Plugin({ preset: 'bun' })253+ // alternatively: nitro( { config: { preset: 'bun' }} ),254+ viteSolid({ssr: true}),255+ ],docs/start/framework/solid/observability.md lines 100 to 135@@ -5,0 +115,21 @@115+ } catch (error) {116+ const duration = Date.now() - startTime117+ console.error(118+ `[${timestamp}] ${request.method} ${request.url} - Error (${duration}ms):`,119+ error,120+ )121+ throw error122+ }123+})124+125+// Apply to all server routes126+export const Route = createFileRoute('/api/users')({127+ server: {128+ middleware: [requestLogger],129+ handlers: {130+ GET: async () => {131+ return json({ users: await getUsers() })132+ },133+ },134+ },135+})docs/start/framework/solid/observability.md lines 169 to 176@@ -5,0 +156,21 @@156+ }157+158+ return data159+ } catch (error) {160+ const duration = Date.now() - startTime161+ console.error(`[LOADER] Dashboard error after ${duration}ms:`, error)162+ throw error163+ }164+ },165+ component: Dashboard,166+})167+168+function Dashboard() {169+ const data = Route.useLoaderData()170+171+ // Track client-side render time172+ Solid.createEffect(() => {173+ const renderTime = performance.now()174+ console.log(`[CLIENT] Dashboard rendered in ${renderTime}ms`)175+ })176+docs/start/framework/solid/routing.md lines 71 to 115@@ -9,0 +95,21 @@95+ component: RootComponent,96+})97+98+function RootComponent() {99+ return (100+ <RootDocument>101+ <Outlet />102+ </RootDocument>103+ )104+}105+106+function RootDocument({ children }: Readonly<{ children: Solid.JSX.Element }>) {107+ return (108+ <>109+ <HeadContent />110+ {children}111+ <Scripts />112+ </>113+ )114+}115+```docs/start/framework/solid/routing.md lines 156 to 159@@ -9,0 +139,21 @@139+```140+src/141+├── routeTree.gen.ts <-- The generated route tree file142+```143+144+This file is automatically generated when you run TanStack Start (via `npm run dev` or `npm run start`). This file contains the generated route tree and a handful of TS utilities that make TanStack Start's type-safety extremely fast and fully inferred.145+146+**You may gitignore this file, since it is a build artifact.**147+148+## Nested Routing149+150+TanStack Router uses nested routing to match the URL with the correct component tree to render.151+152+For example, given the following routes:153+154+```155+routes/156+├── __root.tsx <-- Renders the <Root> component157+├── posts.tsx <-- Renders the <Posts> component158+├── posts.$postId.tsx <-- Renders the <Post> component159+```docs/start/framework/solid/server-routes.md lines 454 to 468@@ -5,0 +448,21 @@448+449+Sometimes you may need to set headers in the response. You can do this by either:450+451+Passing an object as the second argument to the `Response` constructor.452+453+ ```ts454+ // routes/hello.ts455+ import { createFileRoute } from '@tanstack/solid-router'456+ export const Route = createFileRoute('/hello')({457+ server: {458+ handlers: {459+ GET: async ({ request }) => {460+ return new Response('Hello, World!', {461+ headers: {462+ 'Content-Type': 'text/plain',463+ },464+ })465+ },466+ },467+ })468+ // Visit /hello to see the responsedocs/start/framework/solid/static-prerendering.md lines 18 to 59@@ -5,0 +39,21 @@39+40+ // Delay between retries in milliseconds41+ retryDelay: 1000,42+43+ // Callback when page is successfully rendered44+ onSuccess: ({ page }) => {45+ console.log(`Rendered ${page.path}!`)46+ },47+ },48+ // Optional configuration for specific pages (without this it will still automatically49+ // prerender all routes)50+ pages: [51+ {52+ path: '/my-page',53+ prerender: { enabled: true, outputPath: '/my-page/index.html' },54+ },55+ ],56+ }),57+ viteSolid({ ssr: true }),58+ ],59+})
birkskyum(GitHub profile, opens in a new tab) approved these changes
brenelz(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Walkthrough#
Large documentation migration: many React-targeted Start docs were rewritten or replaced with Solid-specific front matter and comprehensive Solid/TanStack Start guides; minor React docs update switching config references to vite.config.ts and small formatting tweaks. No runtime code changes.
Changes#
docs/start/framework/solid/*docs/start/framework/react/path-aliases.md,docs/start/framework/react/server-routes.md,docs/start/framework/react/fetching-external-api.md,docs/start/framework/react/reading-writing-file.mdapp.config.tstovite.config.tsand update example import todefineConfigfromvite; reformat code fences in server-routes docs. No runtime changes.docs/start/framework/solid/server-functions.md@tanstack/react-router→@tanstack/solid-routeralongside existing React→Solid mappings. Documentation-only change.Sequence Diagram(s)#
Estimated code review effort#
🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related PRs#
Suggested labels#
package: solid-start,package: react-startSuggested reviewers#
Poem#
Pre-merge checks and finishing touches#
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 4393ed159431cbcb3ba0f204002b6813af1bfa99 and 33da42ae4f12b9e818a5e800a97c06abcacd2c10.
📒 Files selected for processing (3)
docs/start/framework/react/fetching-external-api.md(1 hunks)docs/start/framework/react/path-aliases.md(1 hunks)docs/start/framework/react/reading-writing-file.md(1 hunks)✅ Files skipped from review due to trivial changes (2)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
Files:
docs/start/framework/react/path-aliases.mddocs/{router,start}/**
📄 CodeRabbit inference engine (AGENTS.md)
Files:
docs/start/framework/react/path-aliases.md⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share