An Nx integrated monorepo for building and deploying a Vendure e-commerce application.
This repo follows Nx Integrated Repo conventions:
- apps
- admin-dashboard: React-based admin dashboard built with Vite and
@vendure/dashboard. Served as a standalone SPA. - server: The Vendure HTTP server (admin-api + shop-api)
- worker: The Vendure job queue worker (BullMQ)
- storefront: Here's where you'd add your storefront app
- admin-dashboard: React-based admin dashboard built with Vite and
- libs
- util-config: The VendureConfig shared by the server & worker
- util-testing: Utils used for the e2e tests
- plugin-*: Vendure plugins — create them as Nx libs and import them into the VendureConfig in
util-config
- static: Static assets needed by the server or worker, e.g. email template files
- tools: Custom Nx executors & generators
This repo uses Postgres as the DB, Redis to power the job queue, and optionally MinIO to serve assets. If MinIO is not used, assets will be stored on the local file system.
- Clone this repo
npm install- Copy
.env.exampleto.env, and set the connection details for Postgres, Redis and (optionally) MinIO - Run
docker-compose up -dto start all required services - Populate the database with test data (
npm run db:populate) - Run
npm run devto start the server and worker in watch mode - Run the dashboard (
npm run dev:dashboard)
Optional:
- Run
npm run dev:serverto only start the server ornpm run dev:workerfor the worker - Run
npm run dev:dashboardto start the dashboard in dev mode (hot reload)
When you make changes that require a DB migration, run:
npx nx run server:migration <migration-name>This generates a new migration file in ./apps/server/migrations. The migration runs automatically the next time you start the server. Review the migration file before running the server to ensure correctness.
Commit migration files to source control so they run in production on deploy.
Hint: If you update the migration file, make sure to delete the compiled file from cache before running the server again
This repo is designed to be deployed as Docker images:
- Server Dockerfile
- Worker Dockerfile
- Dashboard Dockerfile — nginx-based SPA
Configure your hosting platform to clone the repo and build the provided Dockerfiles to create ready-to-run images.
The build command uses a custom Nx executor named "package" (see /tools/executors/package). This executor creates a package.json for the server/worker containing only their run-time dependencies, rather than the entire root package.json.
nx g vendure-nx:vendure-plugin-generator --name=Example --uiExtension=truePlugins are generated in the libs directory. Each plugin includes a dashboard/ directory for React-based dashboard extensions (using @vendure/dashboard).
Read more: tools/vendure-nx/README.md
graphql-code-generator generates TypeScript types from the Vendure server's GraphQL APIs. This ensures resolvers and tests stay in sync with schema changes and CustomFields.
- Run the server with
npm run dev:server - Execute the
codegentarget for the library you are working on:
npx nx run <lib-name>:codegen