Overview of Medusa Development Course: Goals and Components

By Viktor Holik

Overview of Medusa Development Course

Welcome to our Medusa Development Course! In this series, you'll learn how to get your development environment ready and take your first steps in building a Medusa-powered e-commerce application. We'll walk you through everything step by step, helping you master Medusa’s modular architecture and build the key features you need.

This course was made by Viktor Holik, our Software Engineer and Medusa Expert.

In the first part, we cover the course overview, break down the project we’ll be building, and introduce the core components that form the backbone of a Medusa platform.

Course Overview

You can find the transcription of the guide below.

Hello everyone, welcome to this course. In this video, I just want to introduce myself and tell about the goals of this course.

So hello once again, my name is Victor. I'm a software engineer in Rigby, and over the past year and a half I've been developing expertise in commerce, building marketplaces, POS system, and various type of e-commerce.

My main goal for this course is to share the knowledge with you, so you can build your own platforms using Medusa.js.

So how does the course looks like?

While we cover some theory, this course is primarily practical and hands-on, so you can open up your code editor and start coding.

The best way to watch this course is actually to learning by building, alongside lessons, and testing things out see how they work in real-world scenarios.

So that's it for now. See you in the next one!

What We Are Going to Build

You can find the transcription of the guide below.

Hey everyone, before we actually dive into this course, I want to give you a quick overview of what we will build.

We have two main goals for this course.

The first one is to create a supplier’s page in the Medusa admin panel where we can manage suppliers, like editing them and deleting them.

The second goal is to assign each product to specific suppliers.

Yeah, hope to see you in the next one!

Overview of Components

You can find the transcription of the guide below.

Hey everyone, in this short video, I want to introduce you to the core components of Medusa and give you a short description and a use case of when to use each one.

So the first one is API Routes. An API Route is a REST endpoint. It exposes the commerce features to external applications, such as storefronts, admin dashboards, or, for example, a third-party system like Stripe Webhooks. Medusa already has some admin and store API Routes out of the box, and you can actually use them. The use case of API Roads is when you want to expose custom functionality to be used by storefronts, the admin dashboards, or some external applications.

The second one is Dependency Injection. The Medusa container dependency injection container holds all the resources registered in the applications, such as, for example, services, repositories, or entities. In your customization, you can use the container to resolve these resources and use functionalities in them, like logger. The use case for this is when you want to access and reuse services like products, customer services, or order services across different parts of your application.

The next one is Entity. Entities in Medusa are classes that correspond to tables in the database. For example, the order entity, product entity, or product variant. The use case for entities is when you want to define a new table in the database and, for example, establish a relationship between tables like orders, products, or customers.

The next one is Repository. A repository is a layer that handles direct access to the database. It abstracts the details of interacting with the database, like creating a query to the database via an ORM (in Medusa’s case, we use TypeORM), and provides a structured way to perform CRUD operations like create, read, update, and delete on specific entities. The use case for a repository is when you want to keep data access logic separate from business logic, making the codebase cleaner. Another use is when you want to reuse database queries like reading and updating, so you shouldn't do this over and over again. Repositories already have built-in methods out of the box like list, retrieve, and multiple filters, and others. You should use a repository to interact with entities and work with the underlying database while abstracting away the complexities.

Services in Medusa are a collection of helper methods designed for use throughout your commerce application. Typically, they represent specific entity or functionality within Medusa. For example, the product service, order service, or cart service, which might have a method to calculate the cart total. The use case for services is when you want to keep the business logic separated from your controllers, which makes the code cleaner. Also, services are used to centralize logic that needs to be reused across different parts of your application. For example, you can use services not only in the API Routes but also in subscribers.

The next one is Loaders. A loader is a script that runs when the Medusa backend starts. Medusa uses loaders to initialize, for example, the database connection, load plugins from Medusa config, and also to register resources in the dependency container. The use case for loaders is when you want to run some custom logic when Medusa initializes, such as adding default data or setting up configurations.

Subscribers are used in Medusa to inform different parts of the e-commerce ecosystem that an event has occurred. For example, when an order is placed, the order.placed event is triggered, which informs notification services like SendGrid to send emails. The use case for subscribers is when you want to trigger actions when specific events occur in the system, like sending an email or creating some kind of notification. Subscribers also allow you to handle event-based actions separately from the core logic. However, don't use a subscriber when you want to, for example, create validation logic in services, because subscribers are asynchronous and they run apart from the services.

In short

That’s the end of our introduction to the Medusa Development Course.

We’ve gone over what we’ll be building and the main components you’ll be using in the course.

In the next lessons, you’ll get hands-on practice and learn how to use Medusa’s modular system to create strong, customized e-commerce solutions.

We hope you found Viktor's tutorial insightful and helpful.

Learn how to create a customizable commerce solutions

Check out our Medusa Development Course on YouTube

Other blog posts

Admin Development | Medusa Development Course

Welcome to our Medusa Development Course! Build the user interface for managing suppliers and updating product suppliers in Medusa’s admin panel.

Subscribers | Medusa Development Course

Welcome to our Medusa Development Course! Create and customize subscribers to respond to key events, like sending an email when an order is placed.

Tell us about your project

Got a project in mind? Let's make it happen!

By clicking “Send Message” you grant us, i.e., Rigby, consent for email marketing of our services as part of the communication regarding your project. You may withdraw your consent, for example via hello@rigbyjs.com.
More information
placeholder

Grzegorz Tomaka

Co-CEO & Co-founder

LinkedIn icon
placeholder

Jakub Zbaski

Co-CEO & Co-founder

LinkedIn icon