> For the complete documentation index, see [llms.txt](https://seat-airlines.gitbook.io/seat-airlines-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://seat-airlines.gitbook.io/seat-airlines-docs/for-developers/run-it-locally.md).

# Run it locally

The page in one command, what works on localhost, and testing the Worker without a Cloudflare account.

## The page

You need Node.js 18 or later (CI builds with Node 22).

```bash
npm install
npm run dev        # http://localhost:3000
```

| Command             | Does                                                                                               |
| ------------------- | -------------------------------------------------------------------------------------------------- |
| `npm run dev`       | Development server on port 3000                                                                    |
| `npm run typecheck` | TypeScript, no output                                                                              |
| `npm run build`     | Type-check, then bundle to `dist/`                                                                 |
| `npm run preview`   | Serve the built `dist/` on port 3000                                                               |
| `npm test`          | The test suites: the wall, the directory rules, the holder list, balances, and the flight controls |

## What works on localhost

With no configuration the page flies the committed token and talks to the production Worker. That Worker only answers requests from `seat-airlines.space`, so on `localhost`:

| Works                                                      | Does not                                                                                          |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| The market flies the aircraft — Jupiter answers any origin | The holder list and balances are refused, so **the cabin is empty** and check-in reads **unread** |
| The sky, the views and the departure board                 | The wall's adverts (they hang only on held seats), publishing, and the directory                  |

To see a full cabin locally, point the page at a Worker **you** deploy whose `ALLOWED_ORIGINS` includes `http://localhost:3000`:

```bash
VITE_BANNERS_API=https://<your-worker>.workers.dev npm run dev
```

## Testing the Worker

The Worker's own test setup needs no Cloudflare account. It runs on Miniflare with simulated KV and D1, a test mint, and a holder list that the end-to-end suite serves itself on port 8788 — so it is for exercising the routes, not for flying the real aircraft.

```bash
cd worker
npm install
npm test                 # signature and image checks, with a real ed25519 keypair

# Apply the directory schema to the local database once, with the Worker stopped:
npx wrangler d1 migrations apply seat-airlines-directory --local --config wrangler.local.toml

npm run dev:local        # http://127.0.0.1:8787
npm run test:e2e         # in another shell: the full route suite
```

`npm run dev:local:r2` runs the same Worker with the R2 storage path instead of KV. Run `rm -rf .wrangler/state` between the two modes, with the Worker stopped, because they share simulated state.

See [`worker/README.md`](https://github.com/DOGECOIN87/Seat-Airlines/blob/main/worker/README.md) for what each test case proves.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://seat-airlines.gitbook.io/seat-airlines-docs/for-developers/run-it-locally.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
