Top Related Projects
Building blocks for digital commerce
Open Source eCommerce Framework on Symfony
Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
Shopware 6 is an open commerce platform based on Symfony Framework and Vue and supported by a worldwide community and more than 1.500 community extensions
A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
Quick Overview
Vendure is an open-source, headless e-commerce framework built on top of Node.js, TypeScript, and GraphQL. It provides a flexible and scalable architecture for building custom e-commerce solutions, allowing developers to create and manage online stores with a focus on performance, extensibility, and developer experience.
Pros
- Headless Architecture: Vendure separates the front-end and back-end components, allowing for greater flexibility and the ability to build custom user interfaces.
- GraphQL API: Vendure provides a powerful GraphQL API, enabling efficient data fetching and reducing the need for multiple API calls.
- Extensibility: Vendure is designed to be highly extensible, with a plugin system that allows developers to add custom functionality and integrate with third-party services.
- TypeScript: Vendure is written in TypeScript, providing a robust type system and improved developer experience.
Cons
- Learning Curve: Vendure's headless architecture and use of GraphQL may have a steeper learning curve for developers unfamiliar with these technologies.
- Complexity: As a feature-rich e-commerce framework, Vendure can be more complex to set up and configure compared to simpler e-commerce solutions.
- Maturity: Vendure is a relatively new project, and while it is actively developed, it may not have the same level of community support and third-party integrations as more established e-commerce platforms.
- Performance: Depending on the complexity of the e-commerce application, the GraphQL API and headless architecture may introduce some performance overhead compared to more traditional e-commerce platforms.
Getting Started
To get started with Vendure, follow these steps:
- Install Node.js and npm (or yarn) on your system.
- Create a new Vendure project using the Vendure CLI:
npm install -g @vendure/cli vendure create my-vendure-project
- Navigate to the project directory and start the Vendure server:
cd my-vendure-project npm run start
- Open your web browser and visit
http://localhost:3000/admin
to access the Vendure admin interface. - Follow the on-screen instructions to set up your Vendure store, including creating products, managing orders, and configuring settings.
Vendure also provides a range of plugins and extensions that can be installed to add additional functionality to your e-commerce solution. You can explore the available plugins in the Vendure plugin directory.
Competitor Comparisons
Building blocks for digital commerce
Pros of Medusa
- More flexible and customizable architecture, allowing for easier extension and modification
- Better support for headless commerce and multi-channel selling
- Stronger focus on developer experience with a more modern tech stack
Cons of Medusa
- Smaller community and ecosystem compared to Vendure
- Less comprehensive documentation and fewer learning resources
- Potentially steeper learning curve for developers new to the platform
Code Comparison
Medusa (JavaScript/TypeScript):
const product = await productService.create({
title: "T-Shirt",
variants: [
{ title: "Small", prices: [{ amount: 1000, currency_code: "usd" }] },
{ title: "Medium", prices: [{ amount: 1200, currency_code: "usd" }] }
]
});
Vendure (TypeScript):
const product = await productService.create({
translations: [{ languageCode: LanguageCode.en, name: "T-Shirt" }],
productVariants: [
{ translations: [{ languageCode: LanguageCode.en, name: "Small" }], price: 1000 },
{ translations: [{ languageCode: LanguageCode.en, name: "Medium" }], price: 1200 }
]
});
Both examples demonstrate creating a product with variants, but Medusa's approach is more concise and JavaScript-friendly, while Vendure's is more structured and TypeScript-oriented.
Open Source eCommerce Framework on Symfony
Pros of Sylius
- More mature and established e-commerce framework with a larger community
- Built on Symfony, providing a robust and well-documented foundation
- Offers a wider range of built-in features and integrations out of the box
Cons of Sylius
- Steeper learning curve due to its complexity and Symfony-based architecture
- Less flexible for headless commerce scenarios compared to Vendure
- Potentially heavier and slower performance for simpler e-commerce projects
Code Comparison
Sylius (PHP):
class Product extends BaseProduct
{
public function __construct()
{
parent::__construct();
$this->initializeTranslationsCollection();
}
}
Vendure (TypeScript):
@Entity()
export class Product extends VendureEntity {
@Column()
name: string;
@Column()
slug: string;
}
The code snippets demonstrate the different approaches to defining product entities in Sylius and Vendure. Sylius uses PHP and extends a base product class, while Vendure utilizes TypeScript with decorators for entity definition.
Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
Pros of Magento 2
- Extensive ecosystem with a large community and marketplace for extensions
- Robust enterprise-level features for complex e-commerce requirements
- Comprehensive documentation and extensive learning resources
Cons of Magento 2
- Steeper learning curve and more complex architecture
- Higher resource requirements and potentially slower performance
- More expensive to develop and maintain, especially for smaller businesses
Code Comparison
Magento 2 (PHP):
<?php
namespace Magento\Catalog\Model;
class Product extends \Magento\Catalog\Model\AbstractModel
{
public function getName()
{
return $this->_getData(self::NAME);
}
}
Vendure (TypeScript):
import { Product } from '@vendure/core';
import { DeepPartial } from '@vendure/common/lib/shared-types';
export class ProductService {
async create(input: DeepPartial<Product>): Promise<Product> {
// Implementation
}
}
Magento 2 uses a more traditional OOP approach with PHP, while Vendure leverages TypeScript and modern JavaScript practices. Vendure's code tends to be more concise and type-safe, whereas Magento 2's codebase is more extensive and complex due to its broader feature set and legacy considerations.
Shopware 6 is an open commerce platform based on Symfony Framework and Vue and supported by a worldwide community and more than 1.500 community extensions
Pros of Shopware
- More mature and established e-commerce platform with a larger community
- Offers a user-friendly administration interface out of the box
- Provides a wide range of built-in features and plugins
Cons of Shopware
- Less flexible architecture compared to Vendure's headless approach
- Steeper learning curve due to its monolithic structure
- Potentially higher resource requirements for hosting and maintenance
Code Comparison
Shopware (PHP):
$product = new ProductEntity();
$product->setName('Example Product');
$product->setPrice(new Price(100, 'EUR'));
$this->productRepository->create([$product], Context::createDefaultContext());
Vendure (TypeScript):
const product = await this.productService.create({
translations: [{ languageCode: LanguageCode.en, name: 'Example Product' }],
slug: 'example-product',
variants: [{ sku: 'EX-001', price: 1000 }],
});
Both examples demonstrate creating a product, but Vendure's approach is more modular and TypeScript-based, while Shopware uses a more traditional PHP object-oriented style.
A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
Pros of WooCommerce
- Larger ecosystem with extensive plugins and themes
- Easier setup for non-technical users
- Better integration with WordPress
Cons of WooCommerce
- Less flexible for custom development
- Performance can be slower for large-scale stores
- Tighter coupling to WordPress
Code Comparison
WooCommerce (PHP):
add_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
add_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
Vendure (TypeScript):
import { VendureConfig } from '@vendure/core';
export const config: VendureConfig = {
apiOptions: {
port: 3000,
adminApiPath: 'admin-api',
shopApiPath: 'shop-api',
},
// ...
};
WooCommerce is built on WordPress and uses PHP with hooks and actions for customization. Vendure is a headless e-commerce framework using TypeScript and GraphQL, offering more flexibility for developers but requiring more technical expertise. WooCommerce is easier to set up and has a larger ecosystem, while Vendure provides better performance and scalability for complex, custom e-commerce solutions.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Vendure
An open-source headless commerce platform built on Node.js with GraphQL, Nest & TypeScript, with a focus on developer productivity and ease of customization.
www.vendure.io
- Getting Started: Get Vendure up and running locally in a matter of minutes with a single command
- Live Demo
- Vendure Discord: Join us on Discord for support and answers to your questions
Branches
master
- The latest stable release, currently the 2.x series.minor
- The next patch release, including new featuresmajor
- The next major release (v3.0)v2.x
- The 2.x line, which will receive critical fixes until the end-of-life on 31.12.2024. The code in this branch is under the MIT license.
Structure
This project is a monorepo managed with Lerna. Several npm packages are published from this repo, which can be found in the packages/
directory.
vendure/
âââ docs/ # Documentation source
âââ e2e-common/ # Shared config for package e2e tests
âââ license/ # License information & CLA signature log
âââ packages/ # Source for the Vendure server, admin-ui & core plugin packages
âââ scripts/
âââ changelog/ # Scripts used to generate the changelog based on the git history
âââ codegen/ # Scripts used to generate TypeScript code from the GraphQL APIs
âââ docs/ # Scripts used to generate documentation markdown from the source
Development
[!IMPORTANT] The following instructions are for those who want to develop the Vendure core framework or plugins (e.g. if you intend to make a pull request). For instructions on how to build a project using Vendure, please see the Getting Started guide.
1. Install top-level dependencies
npm install
The root directory has a package.json
which contains build-related dependencies for tasks including:
- Building & deploying the docs
- Generating TypeScript types from the GraphQL schema
- Linting, formatting & testing tasks to run on git commit & push
2. Build all packages
npm run build
Packages must be built (i.e. TypeScript compiled, admin ui app built, certain assets copied etc.) before being used.
Note that this can take a few minutes.
3. Set up the server
The server requires an SQL database to be available. The simplest option is to use SQLite, but if you have Docker available you can use the dev-server docker-compose file which will start up both MariaDB and Postgres as well as their GUI management tools.
Vendure uses TypeORM, and officially supports MySQL, PostgreSQL and SQLite, though other TypeORM-supported databases may work.
- Configure the dev config, making sure the connection settings in the
getDbConfig()
function are correct for the database type you will be using. - Create the database using your DB admin tool of choice (e.g. phpMyAdmin if you are using the docker image suggested above). Name it according to the
getDbConfig()
settings. If you are using SQLite, you can skip this step. - Populate mock data:
If you do not specify thecd packages/dev-server DB=<mysql|postgres|sqlite> npm run populate
DB
variable, it will default to "mysql".
4. Run the dev server
cd packages/dev-server
DB=<mysql|postgres|sqlite> npm run start
Or if you are in the root package
DB=<mysql|postgres|sqlite> npm run dev-server:start
If you do not specify the DB
argument, it will default to "mysql".
Testing admin ui changes locally
If you are making changes to the admin ui, you need to start the admin ui independent from the dev-server:
cd packages/admin-ui
npm run start
- Go to http://localhost:4200 and log in with "superadmin", "superadmin"
This will auto restart when you make changes to the admin ui. You don't need this step when you just use the admin ui just to test backend changes.
Testing your changes locally
This example shows how to test changes to the payments-plugin
package locally, but it will also work for other packages.
- Open 2 terminal windows:
- Terminal 1 for watching and compiling the changes of the package you are developing
- Terminal 2 for running the dev-server
# Terminal 1
cd packages/payments-plugin
npm run watch
:warning: If you are developing changes for the core
package, you also need to watch the common
package:
# Terminal 1
# Root of the project
npm run watch:core-common
- After the changes in your package are compiled you have to stop and restart the dev-server:
# Terminal 2
cd packages/dev-server
DB=sqlite npm run start
- The dev-server will now have your local changes from the changed package.
Code generation
graphql-code-generator is used to automatically create TypeScript interfaces for all GraphQL server operations and admin ui queries. These generated interfaces are used in both the admin ui and the server.
Running npm run codegen
will generate the following files:
packages/common/src/generated-types.ts
: Types, Inputs & resolver args relating to the Admin APIpackages/common/src/generated-shop-types.ts
: Types, Inputs & resolver args relating to the Shop APIpackages/admin-ui/src/lib/core/src/common/generated-types.ts
: Types & operations relating to the admin-ui queries & mutations.packages/admin-ui/src/lib/core/src/common/introspection-result.ts
: Used by the Apollo ClientIntrospectionFragmentMatcher
to correctly handle fragments in the Admin UI.- Also generates types used in e2e tests in those packages which feature e2e tests (core, elasticsearch-plugin, asset-server-plugin etc).
Testing
Server Unit Tests
The core and several other packages have unit tests which are can be run all together by running npm run test
from the root directory, or individually by running it from the package directory.
Unit tests are co-located with the files which they test, and have the suffix .spec.ts
.
If you're getting Error: Bindings not found.
, please run npm rebuild @swc/core
.
End-to-end Tests
Certain packages have e2e tests, which are located at /packages/<name>/e2e/
. All e2e tests can be run by running npm run e2e
from the root directory, or individually by running it from the package directory.
e2e tests use the @vendure/testing
package. For details of how the setup works, see the Testing docs.
When debugging e2e tests, set an environment variable E2E_DEBUG=true
which will increase the global Jest timeout and allow you to step through the e2e tests without the tests automatically failing due to timeout.
Release Process
All packages in this repo are released at every version change (using Lerna's fixed mode). This simplifies both the development (tracking multiple disparate versions is tough) and also the developer experience for users of the framework (it is simple to see that all packages are up-to-date and compatible).
To make a release:
1. npm run publish-release
It will run lerna publish
which will prompt for which version to update to. Although we are using conventional commits, the version is not automatically being calculated from the commit messages. Therefore the next version should be manually selected.
Next it will build all packages to ensure the distributed files are up to date.
Finally, the command will create changelog entries for this release.
2. git push origin master --follow-tags
The reason we do not rely on Lerna to push the release to Git is that this repo has a lengthy pre-push hook which runs all tests and builds the admin ui. This long wait then invalidates the npm OTP and the publish will fail. So the solution is to publish first and then push.
License
See LICENSE.md.
Top Related Projects
Building blocks for digital commerce
Open Source eCommerce Framework on Symfony
Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
Shopware 6 is an open commerce platform based on Symfony Framework and Vue and supported by a worldwide community and more than 1.500 community extensions
A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot