Skip to content
Tutorials Center
My learning

Topics

Medusa (Headless Commerce) Tutorial

Learn Medusa (Headless Commerce) step by step: 33 lessons in 12 chapters with examples, quizzes, diagrams and projects.

Start learning →

of lessons completed

Getting Started

  1. 1 What Is Medusa? Learn what Medusa is, how headless commerce differs from a monolithic shop, what Medusa 2 ships in the box and when to choose it, with a runnable mini API.
  2. 2 Create a Medusa Project Create a Medusa 2 project step by step: requirements, create-medusa-app, the folder layout, medusa-config.ts, CLI commands and environment variables.
  3. 3 Architecture: Modules, Workflows and the Container Understand the layers of Medusa 2: API routes, workflows, modules and the data layer, how the dependency-injection container works, and how a request flows.

Commerce Modules and the Data Model

  1. 4 The Commerce Modules Tour the Medusa 2 commerce modules: Product, Pricing, Inventory, Cart, Order, Customer, Payment, Fulfillment, Tax, Promotion, Region and how they compose.
  2. 5 Products, Variants and Options Model products in Medusa 2: options, variants, SKUs, handles, collections, categories, tags and metadata, plus the admin and store views of a product.
  3. 6 Prices, Currencies and Regions Understand Medusa 2 pricing: price sets, currency and region prices, rules, price lists, tax-inclusive pricing and calculated prices, with a runnable resolver.
  4. 7 Inventory, Stock Locations and Sales Channels Understand how Medusa tracks stock: inventory items, levels, reservations, stock locations, sales channels, manage_inventory and backorders, with runnable stand-ins.

The APIs

  1. 8 The Store API Learn the Medusa Store API: publishable keys, regions, product queries with fields, carts, shipping and payment sessions, completing a cart, customers and the JS SDK.
  2. 9 The Admin API and Authentication Learn how the Medusa Admin API authenticates users with JWTs, cookie sessions and secret API keys, how actor types work, and how to paginate and select fields.
  3. 10 Query: Fields, Filters and Pagination Read data across Medusa modules with query.graph: entity names, fields, filters, pagination, linked data, query.index, and a runnable cross-module join stand-in.

Customizing the Backend

  1. 11 Custom API Routes and Middleware Add your own Medusa endpoints with file-based routes, params, Zod validation, defineMiddlewares, authenticate, MedusaError and CORS, plus runnable router stand-ins.
  2. 12 Custom Modules and Data Models Build a custom Medusa module: define data models with model.define, generate a CRUD service with MedusaService, register the module, run migrations and resolve it.
  3. 13 Module Links Connect your custom data to Products and Customers without breaking module isolation: defineLink, list links, extra columns, link.create and querying through links.

Workflows

  1. 14 Workflows and Steps Learn how Medusa workflows chain steps with createStep, createWorkflow, transform and WorkflowResponse, and why they replace chains of service calls.
  2. 15 Compensation, Rollback and Long-Running Workflows How Medusa workflows undo work with compensation functions, why steps must be idempotent, how async steps and retries work, and which workflow engine to use.
  3. 16 Hooks and Built-in Workflows Use Medusa's core workflows such as createProductsWorkflow and completeCartWorkflow, extend them with hooks and validate hooks, and know when to wrap instead.

Events and Background Work

  1. 17 Events and Subscribers React to things that happen in Medusa with events and subscribers: event names, payloads, emitting from workflows, Redis vs local bus, and idempotent handlers.
  2. 18 Scheduled Jobs Run recurring tasks in Medusa with scheduled jobs: the jobs folder, cron schedules, numberOfExecutions, what belongs in a job, and worker mode in production.

Payments, Shipping and Integrations

  1. 19 Payment Providers Learn how Medusa handles payments: payment collections and sessions, the Stripe provider, writing a custom provider, webhooks with signatures, capture and refund.
  2. 20 Fulfillment, Shipping and Tax Providers Learn Medusa shipping and tax: fulfillment sets, service zones, shipping profiles and options, calculated rates, custom fulfillment providers, tax regions and rates.
  3. 21 Notifications, Email and File Providers Send order emails and store files in Medusa: the notification module, channels, SendGrid, subscriber-driven emails, the S3 file provider and templates.

Admin Customization

  1. 22 Admin Dashboard Extensions Customize the Medusa Admin with React: widgets in injection zones, custom UI routes, settings pages, the @medusajs/ui components, data fetching with the JS SDK.

Storefront

  1. 23 The Next.js Starter Storefront Tour the Medusa Next.js starter storefront: JS SDK setup, publishable key, server components and caching, region and cart cookies, product pages and checkout steps.
  2. 24 Building the Checkout Flow Build a Medusa checkout step by step: address, shipping method, payment session, complete cart, error states, guest vs customer checkout and idempotent submit.

Testing, Security and Production

  1. 25 Testing Modules, Workflows and APIs Learn how to test a Medusa 2 backend: integration tests for HTTP routes, module integration tests, workflow tests, fixtures and step compensation checks.
  2. 26 Security and Performance Harden and speed up a Medusa 2 backend: secrets, CORS, publishable keys, rate limiting, field selection, indexes, Redis cache, pooling and N+1 avoidance.
  3. 27 Deploying Medusa Deploy a Medusa 2 backend: server and worker modes, the admin build, Postgres, Redis and S3, Docker, migrations in the release step and health checks.

Projects

  1. 28 Project: A Product Reviews Module Build a product reviews feature for Medusa 2: a custom module, a link to Product, a workflow, store and admin routes, and a moderation flow.
  2. 29 Project: A Loyalty Points Program Build loyalty points in Medusa 2: a points module with a ledger, an order-placed subscriber, a workflow with compensation, checkout redemption and a balance route.
  3. 30 Project: Syncing Products with an External System Sync products between Medusa 2 and an external ERP: a scheduled job, subscribers, idempotent upserts, inbound webhooks, retries and a dead-letter queue.

Practice and Review

  1. 31 Practice: Exercises with Solutions Ten Medusa exercises with worked solutions: model design, price resolution, workflow rollback, route validation, idempotent events, variants, stock, links, retries and cron.
  2. 32 Medusa Interview Questions Prepare for Medusa interviews: architecture, modules vs plugins, workflows, links, Medusa 1 vs 2, events, scaling and security, with short answers and runnable stand-ins.
  3. 33 Medusa Cheat Sheet A quick Medusa 2 reference: CLI commands, folder conventions, medusa-config options, route, subscriber, job, workflow, module and link skeletons, API endpoints and env vars.