Skip to main content

Getting data into production

Once you have set up your production deployment, you'll need some way to get your products and other data into the system.

The main tasks will be:

  1. Creation of the database schema
  2. Importing initial data like roles, tax rates, countries etc.
  3. Importing catalog data like products, variants, options, facets
  4. Importing other data used by your application

Creating the initial database schema

The recommended way to create the schema for a new production deployment is to generate an initial migration locally against an empty database. This migration will contain the full database schema for your current Vendure configuration, and can then be committed to source control and run in production in the same way as all later schema changes.

To create the initial migration:

  1. Point your local Vendure config at an empty database of the same type as production.
  2. Keep dbConnectionOptions.synchronize set to false.
  3. Generate an initial migration:
  1. Review the generated migration file and commit it to source control.
  2. Run pending migrations in production as part of your deployment process:

If your server entry point already calls runMigrations(config) before bootstrap(config), the committed initial migration will be applied automatically when the server starts.

Using synchronize for the first run

Another possible way to create the schema for a brand-new, empty database is to temporarily enable TypeORM's synchronize feature for the first run. This is simpler, but an initial migration is preferable because it makes the production schema reproducible and auditable.

If you use this approach, enable synchronize with an explicit boolean environment variable:

src/vendure-config.ts

Set the DB_SYNCHRONIZE variable to true on first start, and then after the schema is created, set it to false or remove it. Do not pass the raw environment variable directly to synchronize, because environment variables are strings and the string "false" is still truthy.

For ongoing schema changes, always use migrations rather than synchronize.

Importing initial & catalog data

Importing initial and catalog data can be handled by Vendure populate() helper function - see the Importing Product Data guide.

Importing other data

Any kinds of data not covered by the populate() function can be imported using a custom script, which can use any Vendure service or service defined by your custom plugins to populate data in any way you like. See the Stand-alone scripts guide.

Was this chapter helpful?
Report Issue
Edited May 26, 2026ยทEdit this page