Releases

Announcing Vendure v2.2

April 15, 2024

Michael Bromley

Michael Bromley

CTO & Co-Founder

Vendure v2.2 is out now and brings massive improvements to performance, developer experience & extensibility.

Vendure is an open-source platform for building ambitious commerce applications, and we are happy to announce that the next feature release of Vendure - version 2.2.0 - is now available!

Performance

Vendure 2.2.0 updates every major dependency to the latest versions. Most significantly, a major update to our data-access layer has resulted in massive improvements for applications with a very large number of products, customers, and orders.

As background, we use the TypeORM library to allow your Vendure application to connect to a wide range of SQL databases. Due to a particular bug, we had been stuck on an old version that was released in 2022. The good news is that this bug was finally addressed, unblocking our upgrade path. Still - the upgrade was not plain sailing. The data access layer is one of the most complex parts of Vendure, and any changes must be made carefully. In this case, we were upgrading 9 versions at once, and on a code base the size of Vendure - a lot of things broke!

Luckily we have a couple of superpowers that ultimately allowed us to succeed:

  • Our comprehensive test suite: we have over 1,600 end-to-end tests which exercise virtually every aspect of our public API, all the way from the GraphQL layer to the database. These tests allow us to confidently make major upgrades and refactors with a strong assurance that if the tests pass, then Vendure still works.

  • Our incredible open source community. In particular Eugene Nitsenko worked closely with me over several weeks on a number of contributions (#2686, #2744, #2741, #2740) which collectively yielded dramatic performance improvements.

Eugene is an engineer working on a huge multi-national marketplace app which has millions of products over multiple sales channels and multiple languages. Theirs is one of the largest, most demanding Vendure applications I have come across, and their performance requirements really pushed things to the limit and beyond.

Here are the results from testing v2.2 against their huge dataset:

If you are working with smaller data sets, then the performance gains will probably be less dramatic - but you can now rest assured that even as your data grows (which it always does!) then Vendure is well-prepared to handle it.

Developer Experience

From the getting started experience to the documentation to the carefully-designed APIs, we are obsessed with making your life as a developer easier. Building e-commerce applications should not be a confusing, laborious process that requires months of training.

In our last release we introduced a CLI tool that was able to scaffold a basic empty plugin. It used a template-based approach which could generate new files, but could not make any modifications to your existing code. This approach severely limited the types of tasks it could do, so we needed a new approach.

With v2.2, we have completely re-written the CLI using a much more sophisticated architecture which is able to analyze and understand your project's source code down to the level of every individual variable, class and function. Using this advanced analysis we can intelligently modify your code to add new entities, services, API extensions, job queues, and more!

With our new CLI, developing your next feature will not only be radically faster - you'll also have the assurance that the code follows the best practices we have established over many years of building real-world Vendure applications.

Watch our intro video for a demonstration of how the CLI will turbo-charge your productivity!

Extensibility

Vendure is already unmatched in its ability to extend to satisfy virtually any commerce use-case. This release introduces several major new capabilities that allow you to take things even further.

Entity Duplication API

A long-requested feature is the ability to duplicate products. Many shops have similar products so the ability to duplicate an existing product makes the process of creating a new one much more convenient for administrators.

With v2.2 we finally tackled this. But as always, we thought about how we could design a general-purpose API to support the duplication of any entity - including your own plugin-defined custom entities.

The result is our new EntityDuplicator interface and corresponding duplicateEntity mutation. By default we ship duplicator for Products, Collections and Promotions.

Duplication is also deeply integrated into the Admin UI - you can even specify user-configurable parameters which will render as UI inputs, and the values can then be used inside your duplication logic.

Custom fields on your entities

Two of Vendure's most powerful features: custom entities allow you to extend the default data model. Need to support blog posts, organizations, product reviews? Define a custom entity for that.

Custom fields on the other hand allow you to extend existing entities with custom data, including powerful features like validation, automatic UI generation, filtering and sorting.

Now you can combine the two: define custom fields on both built-in and custom entities.

This unlocks a whole world of possibility when it comes to developing plugins that can be extended by other users. Picture this: you develop a Blog plugin and use it across multiple Vendure projects. However, in addition to the common fields like "title" and "content", each project needs to store project-specific data on the BlogPost entity. This is now possible by adding custom fields in the same way as with any entity.

Custom field permissions

Vendure ships with a powerful and extensible role-based access control system. You can now use the permission system to control access to custom fields.

Let's say you defined an importId field on the Product entity to enable sync with an external system. You probably don't want all admins to be able to access and potentially change that field. You can now limit that field so that only specific admins can access it. Admins who lack permissions will neither be able to access the value nor will they even see the field in the admin UI.

Admin UI Alerts

Our admin UI features an alerts area in the top bar that highlights important actions to the administrator. We've now added a new API that allows you to specify your own custom alerts.

The API is flexible enough to take alerts from any source, even external systems, and can likewise trigger any kind of custom logic when the alert is clicked.

For instance, you could define an alert for orders that require approval in a custom order process plugin, or an alert when unusual customer behavior is detected in a security plugin.

Admin UI drop down menus

Every list and detail view in the Admin UI can now be extended with a drop down menu which appears in the top right of the action bar.

This is perfect for custom actions which, while not a primary call-to-action, nevertheless need to be easily accessible to the administrator.

For example, an invoice Generation plugin could add the "Print invoice" button in the drop down menu of the order detail page.

Override Admin UI routes

It is now possible to completely override any of the built-in routes of the Admin UI app with your own custom implementation. For example, you might have a very custom requirement for the order detail page which cannot be handled through our existing customization methods. Now you'll be able to define your own custom page component with React or Angular and have it seamlessly appear in place of the default.

Other notable features

  • Custom fields can now be defined on the ProductVariant entity, unlocking the possibility of more sophisticated price calculations.

  • A new ProductVariantPriceUpdateStrategy allows you to respond to price updates and makes it easy to e.g. keep prices of variants in sync across channels.

  • Complex boolean filters are now supported on all list queries, allowing you to express logic like "show me all orders which are in the 'PaymentSettled' state, and either the customer name or the order code matches 'xyz'". We're already using this to power richer filtering in our Admin UI.

  • Support for greater precision on monetary values. Our MoneyStrategy interface now allows you to specify the number of decimal places to store monetary values. This is a vital feature for certain industries, such as B2B parts suppliers where individual units can be priced at fractions of a cent.

  • Several improvements have been made to Order management: you can now change the shipping method and customer of a completed order, giving more flexibility to customer service administrators. We've also overhauled the UX of refunding orders - you can now control precisely which payments get refunded in orders with multiple payments (such as credit card and store credit).

  • Our AssetServerPlugin now supports dynamic image quality using the new q=<1-100> query parameter.

  • The EventBus has a new API for registering blocking event handlers. This is an advanced feature which allows you to handle events during, rather than after, the code which published the event.

  • New components & hooks for your React-based UI extensions: a new RichTextEditor component, useLazyQuery hook for defining deferred queries, and useDataService hook for direct access to our underlying data fetching layer.

  • Simplified API for handling clicks on action bar buttons which make it even easier to add custom functionality to the Admin UI.

  • A new EmailSendEvent is published by the EmailPlugin which allows you to hook in to the sending process and respond to failed send attempts.

  • The new ErrorHandlerStrategy gives you more control over global error handling across the server and worker, improving integration with performance and monitoring tools.

  • Support for Norwegian Bokmål has been added to the Admin UI, bringing our support to 20 global languages.

  • Additional options can be passed to the bootstrap() function, allowing e.g. integration with NestJS devtools for advanced analysis of your Vendure application. (See #2568)

A complete listing of all changes can be found in the v2.2.0 Changelog.

Upgrading

Due to updates to our dependencies, Yarn v1.x is no longer supported. If you are using it, you should switch to a version which is maintained, or to a different package manager such as npm or pnpm.

  1. Update all your Vendure packages to v2.2.0 and install

  2. Install the @vendure/cli package as a devDependency

  3. Run npx vendure migrate to generate a database migration. There are a number of DB schema changes relating to foreign key indexes which should not alter any data. As always, review and test migrations before applying to production!

Breaking Changes

  • The minimum supported Node.js version is now v18.x.

  • If you are using the MolliePlugin: a new mollieOrderId has been added in order to prevent duplicate payments in Mollie. This will require a DB migration to add the custom field to your DB schema.

  • Our TypeScript version was upgraded from v4.9.5 to v5.3.3. As with any update to TypeScript, you may see new compiler errors due to improvements in TypeScript's type checking capabilities.

Thank you, Vendure community!

We would like to thank our incredible community for your support, suggestions, bug reports, and direct code contributions to this release. Our community comprises developers from all over the world, working for companies of all sizes - small owner-operated businesses, fast-growing startups, to Fortune 500 enterprises. This diverse set of experience and insight enables us to continuously evolve a rock-solid, versatile feature set.

The following users contributed directly to this release:

Akshit Bhardwaj, Aleksander Bondar, Alexis Vigoureux, Casper Iversen, Eugene Nitsenko, Fred Cox, Gautier Darchen, HausTechTeam, HoseinGhanbari, Lacey Pevey, Marensius Bae Pettersen, Martijn, Pieter Doms, Serge Morel, armitjs, casperiv

Vendure
Get started

Create your first commerce experience with Vendure in less than 2 minutes

Vendure is a registered trademark. Our trademark policy ensures that our brand and products are protected. Feel free to reach out if you have any questions about our trademarks.

Newsletter

Get the latest product news and announcements delivered directly to your inbox.

© Copyright 2022 - 2024, Vendure GmbH. All rights reserved.