Skip to content

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, 10 roles, 37 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 Email 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:

vectis/core/fixtures/demo_data.json

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

  1. Create a new seed_<module>.py in vectis/core/
  2. Add the data definitions to fixtures/demo_data.json
  3. Implement the seed_<module>() async function (idempotent, check-before-insert)
  4. Register the step in SEED_STEPS in seed_all.py
  5. 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/.

Re-Seeding After Permission / Setting Additions

Permission and setting additions are not auto-applied on container restart. When a new feature adds a permission (e.g., cart.bypass_approval) or 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 — perm lists and 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 (Decided #232) modules/platform/services.py, modules/cart/resolvers.py
allow_store_credit_overdraft Allow store-credit redemption beyond balance — creates an overdraft draft (Decided #173) modules/store_credit/services.py, modules/platform/services.py
money.decimal_places Money precision; validated at save and busts pricing cache (Decided #104) core/database.py
shipping.precompute_enabled Toggle the Redis-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.