# Going live

Source: https://developers.swell.is/guides/going-live

You've built and tested your store in the test environment — this guide covers the steps to launch it: moving configuration and data to the live environment, installing apps, switching keys, enabling live payments, and verifying everything end to end.

### How environments are separated

Each environment has its own isolated database — the only objects shared between them are users and account settings (see [Test environments](https://developers.swell.is/guides/test-environments) for details). The practical implication: nothing you created in the test environment moves to live by itself. Products, settings, installed apps, and configuration all need to be recreated or copied.

### Recreate configuration in live

Switch to the live environment with the store switcher in the dashboard, then work through your store's configuration: general settings, currencies and locales, shipping and tax settings, checkout settings, and notification toggles. Settings are managed per environment, so review each page you customized in test.

### Copy data with a script

There's no built-in tool for copying records between environments, but the Backend API makes it straightforward: create two API clients — one with a test key and one with a live key — and copy collections across.

```javascript
const swell = require('swell-node');

const test = swell.createClient('my-store', 'sk_test_...');
const live = swell.createClient('my-store', 'sk_live_...');

let page = 1;
while (true) {
  const { results } = await test.get('/products', { limit: 100, page });
  if (!results.length) break;

  for (const product of results) {
    await live.post('/products', product);
  }

  page++;
}
```

Posting the full record preserves its `id`, which keeps references between records intact — important when copying multiple collections that link to each other. Copy collections in dependency order (products and customers before anything that references them), and see the [Migrate to Swell](https://developers.swell.is/guides/migrate-to-swell) guide for ordering details and the `$migrate` flag's tradeoffs. In most cases you'll only copy catalog data — test orders and test customers usually shouldn't follow you to production.

### Install your apps in live

Apps are installed per environment. During development, the CLI pushes your app to the test environment; to go live, install a released version into the live environment:

```txt
swell app install -s your-store-id -e live
```

Two things to know about live installs:

- App settings are per environment and start empty in live — reconfigure every app's settings after installing, including any gateway credentials or API keys the app needs.
- Live installs are issued their own app API keys — if a storefront or external service uses an app public key, make sure it uses the live environment's key.

Updating an installed app in a live store requires incrementing the app version first — see [App development](https://developers.swell.is/apps/app-development) for the versioning workflow.

### Switch to live API keys

The API key in a request determines which environment handles it — swapping keys is the actual cutover. Replace `pk_test_` keys in your storefront and `sk_test_` keys in your server code and integrations with their `pk_live_` and `sk_live_` equivalents from Developer → API keys.

### Take payments live

Test environments only allow payment gateways in test mode, so this step can only happen in live: in Settings → Payments, connect your gateway with its live credentials and disable any test/sandbox mode. If a payment app provides your gateway, its live credentials belong in the app's settings, as noted above.

### Point external services at production

Review anything that talks to your store from outside: webhook endpoints should be your production URLs, and external services calling app functions must use the live app keys. Likewise, any scheduled jobs or integrations using a secret key should be switched to the live key.

### Launch checks

- Place a real order end to end — checkout, payment, confirmation email — and refund it if needed. Keep in mind that live orders count toward your plan's revenue calculations, unlike test orders.
- Confirm notifications are enabled and delivering — send tests from Settings → Notifications.
- Watch for errors in Developer → Console (Logs tab), or with `swell logs --env live` from the CLI.
- Keep the test environment — it remains your safe place to develop and test app updates before installing them into live.
