Skip to content

Commit 741821b

Browse files
docs(start): Add Railway instructions (#4910)
I was puzzled why Railway wasn't starting a server, then realized TanStack Start doesn't define the start command by default
1 parent e83fb3b commit 741821b

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

docs/start/framework/react/hosting.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ When a TanStack Start application is being deployed, the `target` value in the T
3636
- [`netlify`](#netlify): Deploy to Netlify
3737
- [`vercel`](#vercel): Deploy to Vercel
3838
- [`cloudflare-pages`](#cloudflare-pages): Deploy to Cloudflare Pages
39+
- [`railway`](#railway): Deploy to Railway
3940
- [`node-server`](#nodejs): Deploy to a Node.js server
4041
- [`bun`](#bun): Deploy to a Bun server
4142
- ... and more to come!
@@ -108,6 +109,41 @@ directory = "./.output/public"
108109

109110
Deploy your application to Cloudflare Workers using their one-click deployment process, and you're ready to go!
110111

112+
### Railway
113+
114+
Railway automatically detects Build and Start commands when building and deploying to a service.
115+
116+
Set the `target` value to `node-server` in your `vite.config.ts` file.
117+
118+
```ts
119+
// vite.config.ts
120+
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
121+
import { defineConfig } from 'vite'
122+
123+
export default defineConfig({
124+
plugins: [tanstackStart({ target: 'node-server' })],
125+
})
126+
```
127+
128+
Ensure `build` and `start` npm scripts are present in your `package.json` file:
129+
130+
```json
131+
"build": "vite build",
132+
"start": "node .output/server/index.mjs"
133+
```
134+
135+
Then you can run the following command to build your application:
136+
137+
```sh
138+
npm run build
139+
```
140+
141+
You can start your application by running:
142+
143+
```sh
144+
npm run start
145+
```
146+
111147
### Node.js
112148

113149
Set the `target` value to `node-server` in your `vite.config.ts` file.

0 commit comments

Comments
 (0)