# Boot seed files

Your app's prices and webhook endpoint loaded from a file before the first request, with secrets taken from the simulator's environment.

A boot seed file gives your app its prices and its webhook endpoint from the first request, with no setup script. Start the simulator with `--seed` naming the file, or in a container with `RYSTIC_SEED`. A value written `{"$env": "NAME"}` takes the simulator's environment variable `NAME`, so the endpoint signs with the secret your app already verifies with:

```bash
echo '{"state_product": {"prod_pro": {"id": "prod_pro", "object": "product", "name": "Pro", "active": true}}, "state_price": {"price_pro_monthly": {"id": "price_pro_monthly", "object": "price", "product": "prod_pro", "active": true, "currency": "usd", "unit_amount": 2000, "lookup_key": "pro_monthly", "type": "recurring", "recurring": {"interval": "month", "interval_count": 1}}}, "state_webhook_endpoint": {"we_app": {"id": "we_app", "object": "webhook_endpoint", "url": "http://app:3000/api/webhooks/stripe", "enabled_events": ["checkout.session.completed"], "secret": {"$env": "STRIPE_WEBHOOK_SECRET"}, "status": "enabled"}}}' > seed.json
export RYSTIC_URL=$(rystic run stripe-twin -d --port 0 --name seeded --seed seed.json --env RYSTIC_WEBHOOK_DELIVERY=on --env STRIPE_WEBHOOK_SECRET=whsec_app_secret --json | jq -r .data.url)
curl -s "$RYSTIC_URL/v1/prices/price_pro_monthly" -u sk_test_123: | jq -c '{id, unit_amount, lookup_key}'
# -> {"id":"price_pro_monthly","unit_amount":2000,"lookup_key":"pro_monthly"}
curl -s "$RYSTIC_URL/v1/webhook_endpoints/we_app" -u sk_test_123: | jq -c '{id, url, status}'
# -> {"id":"we_app","url":"http://app:3000/api/webhooks/stripe","status":"enabled"}
```

### What stops the simulator at startup

The simulator refuses a seed file it cannot load as written, and its message says where in the file:

| The seed file has | Refused |
|---|---|
| `{"$env": "NAME"}` with `NAME` unset or empty | always |
| `{"$env": "NAME"}` where `NAME` is not a variable name or is one of the simulator's own `RYSTIC_` settings | always |
| a key repeated within one object | always |
| an enabled endpoint without an absolute `http` or `https` `url` | with `RYSTIC_WEBHOOK_DELIVERY=on` |
| an enabled endpoint without a `secret` | with `RYSTIC_WEBHOOK_DELIVERY=on` |

Started without `STRIPE_WEBHOOK_SECRET`, the same file stops the simulator:

```bash
rystic run stripe-twin -d --port 0 --name unset --seed seed.json --json | jq -r .error.message
# -> ...: /state_webhook_endpoint/we_app/secret: environment variable STRIPE_WEBHOOK_SECRET is not set
```

---

Source: https://www.rystic.ai/docs/simulators/stripe/features/boot-seed · Markdown: https://www.rystic.ai/docs/simulators/stripe/features/boot-seed.md
