Vendure - Quick setup

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
Search for a command to run...

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
No comments yet. Be the first to comment.
Most of you know me for my consistency, a golden arrow in my blog series. I've written 1000 articles in 1008 days! Almost an article a day, and my honeymoon was the only holiday I ever took. I'm super proud of this achievement; it has been a fantasti...

It's not the first time I'll be talking about community. I think it's an essential aspect of any successful tool. This shows in my previous explorations of Astro, Medusa, and now Vendure as well. All these products thrive in a super open, welcoming, ...

The cool part about Vendure is how easy it is to set up and how abstract each layer is. Basically, we get the following elements: External database Server Worker Admin UI Frontend While this is amazing, it also brings a bit of complexity when it co...

The previous article looked at customizing Vendure on a data and process level. In this article, we'll look at customizing emails, as they are often a big part of a webshop system. We'll be looking at two different layers of customization for customi...

Even though Vendure is a pretty significant project out of the box, in some cases, we might want to go in and modify some elements to work to our specific use case. In this article, I'll take a high-level look at some elements we can customize within...

In the previous article, we talked about Vendure, what it is, and why I find it an exciting commerce solution.
In this article, we'll get started and see how easy it is to set up.
Note: For these articles, I mainly use Vendure's documentation, which is comprehensive.
The easiest way to start with Vendure is to run their create command. This will set up everything you need to get started.
Out of the box, we get:
All you need to have is node (with npx) npm 5.2 and higher installed. With that, you can run the following command.
npx @vendure/create my-app
Where my-app is the actual name of your application.
In the installation process, you'll be asked which type of database you want to proceed with. You can pick whichever one works best for your system. It will also give you the option to populate with sample data.
To get started quickly, the SQLite option is very nice to get started with.
Once the script is done, you can navigate to your folder and run the application.
cd my-app
yarn dev
It will spool up all your available resources. Once healthy, you should see the following in your terminal.

As mentioned, we get access to the Vendure APIs, split into two categories.
An admin API and a Shop API. Administrators can use the admin API to manage products, orders, and more. The shop API is public-facing and can be used for our eventual storefront, mobile app, etc.
Let's take a quick look at how we can reach them. For the following examples, I'm using Insomnia, but any API tool will work.
Let's start with the shop API. To access it, we can use the following URL http://localhost:3000/shop-api.
The API uses GraphQL as its layer of communication. For instance, we can use the following graphQL query to get a list of products.
query products {
products {
items {
name
}
}
}
Which results in a list of all our product names:

Another fantastic element of Vendure is that it gets shipped with a GraphQL explorer built in, so we can visit the API URL and query from there.
Visit http://localhost:3000/shop-api and execute your queries.

The same goes for the admin API. However, we should use the following URL http://localhost:3000/admin-api.

Besides these fantastic APIs, we also get access to a default admin UI.
Visit the following URL: http://localhost:3000/admin/, and you can explore the admin interface.
It's an excellent place to start exploring how things are linked together. If you choose the population of data, you'll even be able to see some advanced linking and facets.

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter