Documentation

Updates & Upgrading

When the author publishes a new version, follow this sequence. The golden rule: backup first, never skip migrations, always smoke-test after.

On this page

Before you start

  1. Read the update notes β€” new versions list changes, new environment variables, and breaking changes.
  2. Backup: database dump + storage/ folder (how).
  3. Note your version: check "version" in package.json and save it with your backup.
  4. Update on a test copy first if possible β€” especially for major upgrades.

Updating a local install

# 1. Stop the dev server (Ctrl+C in its terminal)

# 2. Replace the source with the new version.
#    Keep your .env! Copy it aside and back afterwards:
cp .env ~/salex-env-backup

# 3. Extract/copy the new version into the project folder, then restore:
cp ~/salex-env-backup .env

# 4. Refresh dependencies, client, schema:
npm install
npm run db:generate
npm run db:deploy

# 5. Start again:
npm run dev

βœ“ Success: the server starts cleanly and the post-update tests below pass.

Updating a production server

cd /var/www/salex
cp .env ~/env-backup-$(date +%F)

# bring in the new code (upload or git pull), then:
cp ~/env-backup-$(date +%F) .env
npm install
npm run db:generate
npm run db:deploy
npm run build
pm2 restart salex
db:deploy is the only migration command for production. It applies pending migrations in order and is safe to re-run. If the update notes mention new seed scripts, run exactly the ones listed β€” nothing else.

Downtime is typically 10–60 seconds (the restart). For near-zero downtime, build first, then restart β€” pm2 makes the swap quick.

Post-update tests

  1. Homepage and a product page render; images load.
  2. Admin login works; dashboard loads.
  3. One test checkout with your payment provider's test/sandbox mode.
  4. Order appears in Admin β†’ Orders with correct shipping charge snapshot.
  5. Vendor dashboard opens and shows its orders (multi-vendor check).
  6. Check pm2 logs salex --lines 50 for new errors.

If something breaks

  1. Stop: pm2 stop salex.
  2. Restore the previous source version (keep the same .env unless notes say otherwise).
  3. npm install && npm run build && pm2 restart salex.
  4. If migrations were applied and must be reverted, restore the database backup from before the update β€” do not hand-edit migration tables.
  5. Report the error text to the author's support with your environment details (names only, never secrets).