Skip to content

Commit

Permalink
docs(start): better info on hosting (#2380)
Browse files Browse the repository at this point in the history
* docs(start): clarify running builds locally

* docs: improve upon the base

---------

Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
  • Loading branch information
willenleal and SeanCassiere committed Sep 19, 2024
1 parent 409b21c commit 230c460
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/framework/react/start/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,5 @@ function Home() {
That's it! 🤯 You've now set up a TanStack Start project and written your first route. 🎉

You can now run `npm run dev` to start your server and navigate to `http://localhost:3000` to see your route in action.

You want to deploy your application? Check out the [hosting guide](./hosting.md).
130 changes: 128 additions & 2 deletions docs/framework/react/start/hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,132 @@ Vercel is a leading hosting platform that provides a fast, secure, and reliable
- To learn more about Vercel, visit the [Vercel website](https://vercel.com?utm_source=tanstack)
- To sign up, visit the [Vercel dashboard](https://vercel.com/signup?utm_source=tanstack)

## Documentation & APIs
## Deployment

Documentation for deploying your application with different hosting providers is coming soon!
> [!WARNING]
> The page is still a work in progress. We'll keep updating this page with guides on deployment to different hosting providers soon!
When a TanStack Start application is being deployed, the `deployment.preset` value in the `app.config.ts` file determines the deployment target. The deployment target can be set to one of the following values:

- [`vercel`](#vercel): Deploy to Vercel
- [`cloudflare-pages`](#cloudflare-pages): Deploy to Cloudflare Pages
- [`netlify`](#netlify): Deploy to Netlify
- [`node-server`](#nodejs): Deploy to a Node.js server
- [`bun`](#bun): Deploy to a Bun server
- ... and more to come!

Choose the deployment target that best suits your needs and follow the deployment guidelines below to deploy your TanStack Start application to your preferred hosting provider.

### Vercel

Deploying your TanStack Start application to Vercel is easy and straightforward. Just set the `deployment.preset` value to `vercel` in your `app.config.ts` file, and you're ready to deploy your application to Vercel.

```ts
// app.config.ts
import { defineConfig } from '@tanstack/start/config'

export default defineConfig({
deployment: {
preset: 'vercel',
},
})
```

Deploy you application to Vercel and you're ready to go!

### Cloudflare Pages

Deploying your TanStack Start application to Cloudflare Pages is easy and straightforward. Just set the `deployment.preset` value to `cf-pages` in your `app.config.ts` file, and you're ready to deploy your application to Cloudflare Pages.

```ts
// app.config.ts
import { defineConfig } from '@tanstack/start/config'

export default defineConfig({
deployment: {
preset: 'cloudflare-pages',
},
})
```

Deploy you application to Cloudflare Pages and you're ready to go!

### Netlify

Deploying your TanStack Start application to Vercel is easy and straightforward. Just set the `deployment.preset` value to `netlify` in your `app.config.ts` file, and you're ready to deploy your application to Vercel.

```ts
// app.config.ts
import { defineConfig } from '@tanstack/start/config'

export default defineConfig({
deployment: {
preset: 'netlify',
},
})
```

Deploy you application to Netlify and you're ready to go!

### Node.js

Deploying your TanStack Start application to a Bun server is easy and straightforward. Just set the `deployment.preset` value to `node-server` in your `app.config.ts` file, and you're ready to deploy your application to a Node.js server.

```ts
// app.config.ts
import { defineConfig } from '@tanstack/start/config'

export default defineConfig({
deployment: {
preset: 'node-server',
},
})
```

Then you can run the following command to build and start your application:

```sh
npm run build
```

Once the build is complete, you can start your application by running:

```sh
node .output/server/index.mjs
```

### Bun

> [!IMPORTANT]
> Currently, the Bun specific deployment guidelines only work with React 19. If you are using React 18, please refer to the [Node.js](#nodejs) deployment guidelines.
Make sure that your `react` and `react-dom` packages are set to version 19.0.0 or higher in your `package.json` file. If not, run the following command to upgrade the packages:

```sh
npm install react@rc react-dom@rc
```

Set the `deployment.preset` value to `bun` in your `app.config.ts` file, and you're ready to deploy your application to a Node.js server.

```ts
// app.config.ts
import { defineConfig } from '@tanstack/start/config'

export default defineConfig({
deployment: {
preset: 'bun',
},
})
```

Then you can run the following command to build and start your application:

```sh
bun run build
```

Once the build is complete, you can start your application by running:

```sh
bun run .output/server/index.mjs
```

0 comments on commit 230c460

Please sign in to comment.