DEV Community

Alex Spinov
Alex Spinov

Posted on

Medusa Has a Free API You've Never Heard Of

Medusa is an open-source headless commerce engine. Think Shopify, but you own the code and it's free. It provides a complete e-commerce API — products, carts, orders, payments, shipping — all customizable.

What Makes Medusa Special?

  • Open source — MIT licensed, self-hosted
  • Complete e-commerce API — everything Shopify has, but free
  • Modular — use only what you need
  • Plugin ecosystem — Stripe, PayPal, S3, Algolia, and more
  • Admin panel — included out of the box

The Hidden API: Commerce Modules

import Medusa from '@medusajs/js-sdk';

const medusa = new Medusa({ baseUrl: 'http://localhost:9000' });

// Products API
const { products } = await medusa.store.product.list({
  limit: 20,
  category_id: ['cat_electronics'],
  order: '-created_at'
});

// Cart API
const { cart } = await medusa.store.cart.create({});
await medusa.store.cart.addLineItem(cart.id, {
  variant_id: 'variant_01',
  quantity: 2
});

// Apply discount
await medusa.store.cart.update(cart.id, {
  discounts: [{ code: 'WELCOME10' }]
});

// Complete checkout
const { order } = await medusa.store.cart.complete(cart.id);
Enter fullscreen mode Exit fullscreen mode

Admin API — Full Control

// Manage products
const { product } = await medusa.admin.product.create({
  title: 'Premium Widget',
  description: 'High-quality widget',
  status: 'published',
  variants: [{
    title: 'Default',
    prices: [{ amount: 2999, currency_code: 'usd' }],
    manage_inventory: true,
    inventory_quantity: 100
  }]
});

// Orders management
const { orders } = await medusa.admin.order.list({
  status: ['pending'],
  created_at: { gte: '2026-01-01' }
});

// Fulfill order
await medusa.admin.order.createFulfillment(orderId, {
  items: [{ item_id: lineItemId, quantity: 1 }],
  provider_id: 'manual'
});
Enter fullscreen mode Exit fullscreen mode

Custom API Routes

import { MedusaRequest, MedusaResponse } from '@medusajs/medusa';

export async function GET(req: MedusaRequest, res: MedusaResponse) {
  const productService = req.scope.resolve('productService');
  const featured = await productService.list(
    { tags: { value: ['featured'] } },
    { relations: ['variants', 'images'] }
  );
  res.json({ products: featured });
}
Enter fullscreen mode Exit fullscreen mode

Quick Start

npx create-medusa-app@latest
cd my-medusa-store && npx medusa develop
# API: localhost:9000 | Admin: localhost:7001
Enter fullscreen mode Exit fullscreen mode

Why Teams Choose Medusa

An e-commerce developer shared: "We migrated from Shopify ($300/mo) to self-hosted Medusa. Same features, zero monthly cost. Our checkout conversion increased 15% because we could customize every step of the funnel."


Building e-commerce? Email spinov001@gmail.com or check my developer tools.

Shopify or headless? What's your e-commerce stack?

Top comments (0)