---
title: "Medusa hosting on Edge | Self-host headless commerce"
description: "Run Medusa on Edge: Node.js, Postgres and Redis on real VMs, product media in S3-compatible storage and a global CDN for your storefront. Zero egress fees."
url: https://edge.network/solutions/medusa
---

For Medusa

# Medusa 2 on your own VMs, Postgres next door

Medusa, Postgres and Redis on real VMs, product media in an S3-compatible bucket and your storefront cached across 988 locations. The bill doesn't grow with your order count.

[Deploy a VM](/console/access/new?product=compute)[Host the Next.js storefront](/solutions/nextjs)

The setup on this page costs $77.75 a month, with no egress line.

Why Medusa on Edge

## Medusa runs here the way it runs on your laptop

A real VM with a long-running Node process, next to a real Postgres. No platform layer to learn, nothing metered per order.

-   ### Node, Postgres and Redis
    
    Medusa server and worker on one VM, Postgres on another, joined by a free private network. Split further as you grow.
    
-   ### The S3 file provider, unchanged
    
    Point Medusa's file-s3 provider at Edge Storage. Product images and digital goods land in a bucket, not on the VM.
    
-   ### Any storefront you like
    
    Medusa is API-first. Run the Next.js starter on its own VM, or pair it with Nuxt, SvelteKit or Astro.
    
-   ### Catalogue at the edge
    
    Storefront pages, static assets and product media cache in 988 locations. Carts and checkout go straight to origin.
    
-   ### Bring your own payments
    
    Stripe, PayPal and the other payment providers work exactly as documented. Money moves between Medusa and your gateway.
    
-   ### A whole store from one prompt
    
    Ask your coding agent to deploy a Medusa store to shop.acme.com. The agent API stands up the VMs, bucket, DNS and CDN.
    

Reference architecture

## Medusa behind the storefront, data on a private network

Storefront and Medusa on separate VMs, the data tier on a private network, media in a bucket and the CDN in front of everything public.

-   [Compute](/compute)
    
    Runs the Medusa server and worker, the storefront and Postgres on separate VMs.
    
-   [Storage](/storage)
    
    Holds product imagery, uploads and downloadable goods behind the file-s3 provider.
    
-   [CDN](/cdn)
    
    Caches storefront pages, static assets and media URLs worldwide.
    
-   [Image optimisation](/docs/cdn/image-optimization)
    
    Resizes and converts product images on request, instead of at upload.
    
-   [DNS](/dns)
    
    Anycast DNS for shop., api. and media. subdomains.
    
-   [Shield](/shield)
    
    Scores cart completion and customer signup calls from the storefront.
    
-   [Assist](/assist)
    
    Answers shipping, stock and returns questions from storefront content.
    

Deploy

## A Medusa 2 store with the standard CLI

Two VMs, one config block and the standard Medusa CLI. Add the storefront VM the same way as the Next.js page describes.

1.  01
    
    ### Create the database and Medusa VMs
    
    The postgresql script installs PostgreSQL 16 with remote access. Attach both VMs to one private network, then allow 5432 from that range only.
    
    shell
    
    ```
    $ edge compute create --name medusa-db --size s-2vcpu-4gb \
        --image ubuntu-24 --region london --script postgresql \
        --script-param db_name=medusa
    
    $ edge compute create --name medusa --size s-4vcpu-8gb \
        --image ubuntu-24 --region london --script nodejs
    ```
    
2.  02
    
    ### Point the file module at Edge Storage
    
    Medusa 2 ships an S3 file provider. Path-style addressing and the Edge endpoint are the only changes from AWS.
    
    medusa-config.ts
    
    ```
    modules: [{
      resolve: "@medusajs/medusa/file",
      options: {
        providers: [{
          resolve: "@medusajs/medusa/file-s3",
          id: "s3",
          options: {
            bucket: "medusa-media",
            region: "us-east-1",
            endpoint: "https://storage.edge.network",
            file_url: "https://media.acme.com",
            access_key_id: process.env.S3_ACCESS_KEY_ID,
            secret_access_key: process.env.S3_SECRET_ACCESS_KEY,
            additional_client_config: { forcePathStyle: true },
          },
        }],
      },
    }],
    ```
    
3.  03
    
    ### Migrate, build and start
    
    Redis lives on the Medusa VM and listens on localhost. The production server runs from .medusa/server under PM2.
    
    shell
    
    ```
    $ apt install -y redis-server
    $ echo "DATABASE_URL=postgres://<user>:<pw>@10.185.0.2/medusa" >> .env
    $ echo "REDIS_URL=redis://localhost:6379" >> .env
    
    $ npx medusa db:migrate && npx medusa build
    $ cp .env .medusa/server/.env.production
    $ cd .medusa/server && npm install
    $ NODE_ENV=production pm2 start npm --name medusa -- start
    ```
    
4.  04
    
    ### Front the storefront and media with the CDN
    
    Product images then resize from the URL: media.acme.com/tee.jpg?width=800&format=auto.
    
    shell
    
    ```
    $ edge cdn create --name acme-store
    $ edge cdn domains add cdn-a1b2c3 --domain shop.acme.com \
        --origin https://<storefront-ip>
    $ edge cdn domains add cdn-a1b2c3 --domain media.acme.com \
        --origin-type storage --storage-bucket medusa-media --jit-image
    ```
    

Prefer to hand it off? [Give the job to your AI agent](/solutions/agentic-development) or [have our engineers do it](/solutions/expert-services).

What it costs

## A full Medusa stack, priced line by line

Three VMs, a CDN deployment and a bucket. Nothing on the invoice grows with orders, API calls or admin seats.

-   No per-order, per-request or per-seat fees
-   Private network traffic between VMs is free
-   Payment providers bill you directly

[See compute pricing](/compute/pricing)

Estimated monthly bill on Edge

Medusa 2 store with a Next.js storefront, ~100k visits a month

USD

-   Medusa VM$38.47Performance: 4 vCPU, 8 GiB for server, worker and Redis
-   Database VM$19.24Standard: 2 vCPU, 4 GiB for PostgreSQL 16
-   Storefront VM$19.24Standard: 2 vCPU, 4 GiB for the Next.js starter
-   CDN$0.502.5M requests: first 500k free, then 2M × $0.25 per million
-   Storage$0.3025 GB of product media: first 5 GB free, then 20 GB × $0.015
-   Egress$0.00

Total$77.75

FAQ

## Medusa 2, storefronts and scaling

Something else? [Ask an engineer](/contact).

Medusa 1.x or 2.x?

2.x is the current, modular release and the one to pick for anything new. Existing 1.x stores run too; they use the medusa-file-s3 plugin rather than the file-s3 module provider. The hosting pattern is the same.

How does this compare to Medusa Cloud?

Same open-source software, but you control the host. You get root access, a bill that doesn't move with traffic, and the storefront, API and database on one private network.

Which storefront framework should I use?

Whichever your team knows. Medusa's starter is Next.js, but the Store API works with anything. We have pages for Next.js, Nuxt, SvelteKit and Astro.

How do I scale beyond this?

Run the Medusa worker on its own VM, add storefront VMs behind the CDN, and give Redis a dedicated VM. Everything talks over the private network, so nothing else changes.

Can the CDN cache the Store API?

Public, read-only product and collection routes can be cached with short TTLs. Cart, checkout, customer and admin routes should always go to origin. Most teams cache in the storefront and let the CDN handle pages and media.

Drop-in services

## Protect the cart, answer before support does

-   [
    
    Edge ShieldBot protection`POST /siteverify → score: 94`
    
    Score cart completion and customer signup in your storefront's server code before the request reaches Medusa.
    
    Free forever, with unlimited widgets. No puzzles for visitors.Explore
    
    ](/shield)
-   [
    
    Edge AssistAI answers`<script src="…/assist.js">`
    
    Shipping, stock and returns questions, answered from your storefront content before support hears about them.
    
    Free tier: 250 answered questions a monthExplore
    
    ](/assist)

Related stacks

## Commerce peers, and the Postgres underneath

[All 38 stacks](/solutions/stacks)

-   [MagentoEnterprise PHP commerce without Adobe pricing](/solutions/magento)
-   [SaleorPython and GraphQL headless commerce](/solutions/saleor)
-   [Shopify HydrogenSelf-host your Shopify storefront](/solutions/hydrogen)
-   [PostgreSQLSelf-hosted Postgres on dedicated NVMe](/solutions/postgresql)

## Put your Medusa store on VMs you control

Start free. Bring an existing Medusa store or scaffold a new one with create-medusa-app.

[Deploy a VM](/console/access/new?product=compute)[Book a call with an engineer](/contact)

Billed hourly from a prepaid balance. Egress is free on every product.
