Seed Data¶
Vectis Commerce includes a comprehensive demo dataset that can be installed with a single command. The seed pipeline creates a fully working B2B wholesale environment suitable for development, testing, and demos.
Quick Start¶
# Install the package (enables the `vectis` CLI)
pip install -e .
# Run all 11 seed steps
vectis seed
# Or via python -m
python -m vectis.core.seed_all
CLI Reference¶
| Command | Description |
|---|---|
vectis seed |
Run all seed steps in dependency order |
vectis seed --only <step> |
Run a single step (e.g. --only products) |
vectis seed --reset |
Drop all tables, recreate, and seed (dev only) |
vectis seed --list |
List available seed steps |
Seed Steps¶
The pipeline runs 11 steps in dependency order:
| # | Key | What it creates |
|---|---|---|
| 1 | base |
Default channel, roles, core permissions, admin user, exchange rates |
| 2 | geo |
~250 countries, regions, trade blocs, US counties and cities |
| 3 | cms |
5 CMS policy pages (contact, shipping, returns, privacy, terms) |
| 4 | tax |
4 tax categories, 6 US state rates, 3 tobacco excise rates |
| 5 | demo |
4 wholesale accounts with employees, locations, addresses, notification templates |
| 6 | products |
12 brands, 9 categories, 17 products, ~180 variants with stock; attributes, traits, collections, images, meta |
| 7 | pricing |
2 price lists with volume tiers, 4 payment terms, account price overrides |
| 8 | promotions |
3 discount rules (WELCOME10, free shipping, BULK5) |
| 9 | shipping |
USPS + generic providers, boxes, 3 zones, zone-method assignments |
| 10 | fraud |
Fraud rules, blocklist, 15 demo orders with risk profiles |
| 11 | tags |
6 tags with product assignments, 9 search synonym groups |
Demo Credentials¶
| Role | Password | |
|---|---|---|
| Admin | admin@vectis.local |
admin |
| Wholesaler (Pacific Vape) | demo@vapeshop.com |
demo1234 |
| Wholesaler (Empire Vape) | mike@empirevape.com |
demo1234 |
| Wholesaler (West Coast) | sarah@westcoastsmoke.com |
demo1234 |
| Wholesaler (CloudNine) | james@cloudnine.com |
demo1234 |
Fixture File¶
All demo data is defined in a single JSON fixture:
This file is the canonical source of truth for demo data. Seed scripts load
from it at runtime, converting JSON strings to Python Decimal values where
needed. To update the demo dataset, edit this file and re-run vectis seed --reset.
The fixture contains: brands, categories, products (with flavors and nicotine levels), demo accounts, notification templates, tax categories and rates, price lists, payment terms, discount rules, tags, tag assignments, and search synonyms.
Adding New Seed Steps¶
- Create a new
seed_<module>.pyinvectis/core/ - Add the data definitions to
fixtures/demo_data.json - Implement the
seed_<module>()async function (idempotent, check-before-insert) - Register the step in
SEED_STEPSinseed_all.py - Update this documentation
All seed functions must be idempotent — they check for existing records before inserting and skip gracefully if data already exists.
Architecture¶
vectis/core/
├── cli.py # `vectis seed` CLI entry point
├── seed_all.py # Orchestrator (11 steps)
├── seed.py # Step 1: base system
├── seed_cms_pages.py # Step 3: CMS pages
├── seed_tax.py # Step 4: tax configuration
├── seed_demo.py # Step 5: demo accounts
├── seed_products.py # Step 6: product catalog
├── seed_pricing.py # Step 7: pricing
├── seed_promotions.py # Step 8: promotions
├── seed_shipping.py # Step 9: shipping
├── seed_fraud.py # Step 10: fraud demo data
├── seed_tags.py # Step 11: tags + search
└── fixtures/
├── __init__.py # load_fixture() helper
└── demo_data.json # Canonical demo dataset
The geo seed lives separately at vectis/modules/geo/seed.py (Step 2) because
it loads data from CSV files in vectis/modules/geo/data/.
Permissions Sync at Boot¶
Permission rows no longer wait for a re-seed: at every api boot, core permission codenames and every extension manifest's permissions are upserted into the permissions table (vectis/core/permission_sync.py). The sync is additive-only and idempotent — missing rows are inserted, existing rows are never updated or deleted. New extensions should namespace their codenames as ext.<name>.<perm>.
No role wiring yet
Rows created by the boot sync belong to no role until the admin role-wiring work ships (not yet shipped). super_admin's "*" grant is a seed-time expansion, so even super admins don't automatically hold permissions created after seeding — grant them explicitly if needed.
Re-Seeding After Setting Additions¶
Setting additions are still not auto-applied on container restart. When a new feature adds a setting (e.g., cart_ai_provider_priority), the dev API container needs a re-seed before the new key is visible:
docker exec vectis-api-1 python -m vectis.core.seed_all --only base
docker exec vectis-api-1 python -m vectis.core.seed_all --only demo # for new demo accounts
If something looks "broken for everyone" after pulling main, re-seed before debugging — setting keys silently fall behind otherwise.
Notable Recent Settings (verified in code)¶
| Key | Purpose | Source |
|---|---|---|
cart_ai_provider_priority |
Order of providers tried by cartAiParseToLookupItems |
modules/platform/services.py, modules/cart/resolvers.py |
allow_store_credit_overdraft |
Allow store-credit redemption beyond balance — creates an overdraft draft | modules/store_credit/services.py, modules/platform/services.py |
money.decimal_places |
Money precision; validated at save and busts pricing cache | core/database.py |
shipping.precompute_enabled |
Toggle the Valkey-backed shipping rate precompute | modules/fulfillment/precompute.py (constant PRECOMPUTE_ENABLED_KEY) |
Per-channel approval workflow (B2B) lives on the channel admin settings, not as a top-level setting key. Inspect via AdminChannelSettingsType.approvalMode, defaultCartApproverEmployeeId, defaultPaymentApproverEmployeeId, defaultOrderApproverEmployeeId, cartApprovalInvalidatesOnEdit.