Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,36 @@ countdown.

## Hosting on Cloudflare

The build output in `dist` is a static site, so it runs on Cloudflare Pages as
it is. Use `npm run build` as the build command and `dist` as the output
directory. Set the `VITE_` variables as build variables, because Vite writes
them into the bundle at build time.

The routes are handled in the browser by React Router. Pages serves
`index.html` for any path that is not a file when the site has no top level
`404.html`, so deep links such as `/seat-picker` work without a `_redirects`
file.
The build output in `dist` is a static site, served on Cloudflare Workers as
static assets. `wrangler.jsonc` sets it up:

```sh
npm run build
npx wrangler deploy
```

Set the `VITE_` variables before `npm run build`, because Vite writes them into
the bundle at build time.

The routes are handled in the browser by React Router. `wrangler.jsonc` sets
`not_found_handling` to `single-page-application`, so a deep link such as
`/seat-picker` serves `index.html` and the app takes it from there.

`npx wrangler deploy` creates your own Worker named `seatlayer-react-example`,
with no custom domain. Rename it in `wrangler.jsonc` if you like.

### Hosting our copy

The live demo at examples-react.seatlayer.io is this repository deployed with
the `hosted` environment in `wrangler.jsonc`, which sets the Worker name
`seatlayer-examples-react` and the custom domain:

```sh
npm run build
npx wrangler deploy --env hosted
```

You do not need this environment for your own copy.

Add `?embed=1` to any route to hide the navigation and the route heading, so
the example sits cleanly in an iframe.
Expand Down
14 changes: 11 additions & 3 deletions wrangler.jsonc
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
{
// Hosted copy of this example on Cloudflare Workers static assets.
// This example on Cloudflare Workers static assets.
// Build first (npm run build), then deploy with: npx wrangler deploy
// That deploys your own copy under the name below, with no custom domain.
// The "hosted" environment is the SeatLayer copy on
// examples-react.seatlayer.io; you do not need it.
"$schema": "node_modules/wrangler/config-schema.json",
"name": "seatlayer-examples-react",
"name": "seatlayer-react-example",
"compatibility_date": "2026-09-01",
"assets": {
"directory": "./dist",
"not_found_handling": "single-page-application"
},
"routes": [{ "pattern": "examples-react.seatlayer.io", "custom_domain": true }]
"env": {
"hosted": {
"name": "seatlayer-examples-react",
"routes": [{ "pattern": "examples-react.seatlayer.io", "custom_domain": true }]
}
}
}
Loading