# Test and Live

> Build on Test, then copy the tool to Live and ship.

Toolaby has two environments, both on `toolaby.app`: **Live**, and **Test** under `/test`. On Test the dashboard is at `toolaby.app/test/dev`, and a workspace's buyer pages are at an address Toolaby makes for it, like `quiet-otter-4172.toolaby.app/test/…`. The workspace's name is its address on Live: `<workspace>.toolaby.app`. Each has its own dashboard, buyers, prices and keys. Nothing on Test is real: buyers pay with Stripe's test cards, and Stripe runs in test mode.

The mode is in the dashboard's top bar. On Test, every page carries a stripe saying so.

You have one account for both, kept on Live: Test signs you in through Live. When you switch account or sign out on Live, Test does the same the next time you open or return to one of its pages.

A new account starts on Test: its first sign-in opens Test's dashboard, which asks for the workspace's name. The workspace on Live is made when you ship: your first visit to Live asks for its name, the same as on Test ([Ship](https://toolaby.app/docs/ship.md)). A developer who already sells can make it on Live first, from the link under the name field.

Test needs nothing to connect: a workspace has a Stripe test account from its first minute, made by Toolaby, and card payments switch on a minute or two later. **Configure → Payments** on Test shows it. On Live, **Connect** makes a Stripe account of your own for the workspace, once.

On Test every feature is on, whatever your plan, and nothing is billed, except mail from your own domain, which is set up on Live ([why](https://toolaby.app/docs/buyer-pages.md#mail-from-your-own-domain)). Your plan is chosen on Live. See [Plans](https://toolaby.app/docs/plans.md).

Test is for trying things, so it holds 100 people in each workspace, whatever your plan: the addresses with an account there or a licence of your tools. Past 100, a new address is refused where it would come in: signing in, a grant, a seat, an import or a move. A buyer who is not signed in is asked to sign in before a checkout. Everyone already there keeps their access. Your own `+toolaby-test` address never counts. Everything Test mails has `[Test]` at the start of its subject. Your users get the Live build.

## The tool key

An extension holds one string, the tool key: `tk_test_…` from Test, `tk_live_…` from Live. It is the whole configuration: which tool, which side, and the workspace's public key. The client refuses a key that is not a tool key at startup.

A key works from any extension until you name yours. You name it with its Chrome Web Store listing or its Microsoft Edge Add-ons listing, under the tool's **Settings → Store**, or by choosing a copy on the tool's **Set up** page: it lists by id the extensions that connected without the wiring's `key`, each with **This one is mine**. From then on the key works from:

* the store copy, and the Edge store's, which has an id of its own;
* every copy whose manifest carries the wiring's `key`;
* the copy you chose on the Set up page, if any.

Any other extension is refused with `403 forbidden_origin`, and the Set up page lists it by id with **Use this copy instead**. Nothing an extension sends names it for you.

## Going live

1. At the foot of the tool's **Set up** page, select **Copy to Live**. The tool, its Free plan, features and prices are created on Live. Prices need Stripe connected there.
2. In the extension's folder, run `npx -y toolaby@latest wire <tool-id> --live --force`. It writes the live key, and puts the workspace's Live address under `externally_connectable` in place of its Test address.
3. Build, run `npx -y toolaby@latest pack`, and upload the zip to the Chrome Web Store.

On Live, the tool's **Overview** lists what is left and ticks each step as it happens: connecting Stripe, the prices, a copy with the Live key, the store listing. Copied before connecting Stripe, a tool has no prices on Live: connect, then **Copy to Live** again. [Ship to the Chrome Web Store](https://toolaby.app/docs/ship.md) has each step, what you see when it worked, and updates.

Copy again whenever Test has something new. Live is never copied back to Test.

## What differs per side

|                            | Test                                                                     | Live                                    |
| -------------------------- | ------------------------------------------------------------------------ | --------------------------------------- |
| Dashboard                  | `toolaby.app/test/dev`                                                   | `toolaby.app/dev`                       |
| Buyer pages                | an address made for the workspace: `quiet-otter-4172.toolaby.app/test/…` | `<workspace>.toolaby.app/…`             |
| Stripe                     | test mode; an account Toolaby makes for the workspace                    | your own account, made when you connect |
| Tool key                   | `tk_test_…`                                                              | `tk_live_…`                             |
| API key                    | `wk_test_…`                                                              | `wk_live_…`                             |
| Webhook `livemode`         | `false`                                                                  | `true`                                  |
| Buyers, customers, members | separate                                                                 | separate                                |

Membership is per side: invite a person on each side you want them in. See [Members](https://toolaby.app/docs/members.md).
