Welcome to Medusa - we are so excited to get you on board!
This tutorial will walk you through the steps to take to set up your local development environment. You will familiarize yourself with some of the core parts that make Medusa work and learn how to configure your development environment. Furthermore you will be introduced to how the plugin architecture works and how to customize your commerce functionalities with custom logic and endpoints.
This tutorial aims to be as inclusive as possible so that most people with a bit of web development exeperience will be able to follow along and understand what is going on. In case you are completely new to programming and are just setting out to start working on your first project it will be helpful to familiarize yourself with a couple of the technologies that Medusa is build on
- SQL & Postgresql: Medusa uses the relational database PostgreSQL as the database layer where data is persisted. To understand how different entities relate to each other in Medusa it is helpful to have a good understanding of SQL. You can learn more about SQL and relational databases with the SQL and Databases course from freeCodeCamp.
- The command line: The command line is a text interface for your computer. It is used to run commands such as starting a program, performing a task or interfacing with the files on your computer. If you have never used the command line before you can check out this tutorial to get the basics in place.
To get a further understanding of what powers Medusa you can lookup these concepts:
To get your development environment ready you need to install the following tools:
- Medusa CLI
Node.js has a bundled package manager called npm. npm helps you install "packages" which are small pieces of code that you can leverage in your Node.js applications. Medusa's core is itself a package distributed via npm and so are all of the plugins that exist around the core. You can install Node.js from here.
If you prefer using something like homebrew you can also run:
brew install node
Mac users: Make sure that you have Xcode command line tools installed; if not run
Git is a version control system that keeps track on files within a project and makes it possible to do things like going back in history if you have made mistakes or collaborate with teammates without overriding each other's work. Almost all developers use Git for version control. Medusa uses git behind the scenes when you create a new project so you'll have to install it on your computer to get started.
If you are a Mac user you will already have Git installed as part of the Xcode command line tools, but for good measure check out installation of Git on different systems below:
PostgreSQL is an open-source relational database system with more than 30 years of active development. It is robust, reliable and ensures data integrity so there's no need to worry about those when you scale your project. Medusa uses PostgreSQL as its database and you will need to install it on your computer to get going. Install PostgreSQL from here..
If you prefer to use homebrew you may install PostgreSQL by running:
brew install postgresqlbrew services start postgresqlcreatedb
Redis is an open-source in memory data structure store which is used in Medusa to emit messages in the system and cache data. Install Redis from here.
If you prefer to use homebrew you may install Redis by running:
brew install redisbrew services start redis
The final installation to do to get started with Medusa is the Medusa CLI, which is an npm package you can install globally on your computer to get instant access to commands that help you manage and run your Medusa project. As the Medusa CLI is distributed as an npm package it is very easily installed by running:
npm install -g @medusajs/medusa-cli
We like to use Yarn instead of npm; if you wish to do the same you can install the CLI with:
yarn global add @medusajs/medusa-cli
If you don't already have a text editor of choice you should find one you like - here is a couple of candidates:
It is not important which editor you use as long as you feel comfortable working with it.
You now have all required software installed on your computer and have been introduced to a bit of our tech stack. In the next part of this tutorial we will be setting up a Medusa project for the first time and start making API requests.