Medusa Server
Medusa is an open-source composable commerce engine built with Node.js. Medusa enables developers to build scalable and sophisticated commerce setups with low effort and great developer experience.
Infrastructure ownership
The Medusa infrastructure will be provisioned on your own AWS account.
You retain full control over your infrastructure and data while getting all the benefits of infrastructure automation.
One-click Deploy
Click Deploy with Microtica below and follow the template steps to deploy your Medusa Server application on your AWS account.
What will be provisioned on AWS
Since Microtica deploys on your cloud account, you would expect nothing less than complete transparency of what resources are going to be provisioned.
Using the Medusa Server template, you will create two components in the environment:
- VPC — VPC, subnets and networking
- Medusa - Container infrastructure based on Fargate, application load balancer, persistent storage, S3 bucket, Postgres database, and Redis (in production mode).
Deploy your existing Medusa Server
By default, the template creates a new Medusa Server repo on your Git account with all required setups and no changes required from your side.
But if you already have a Medusa server repo that you want to deploy then you need to perform a couple of changes in your source code.
1. Install the S3 plugin
The first thing you need to do, if you want to use S3 as media storage (recommended), is to install the Medusa S3 plugin.
The template automatically creates an S3 bucket so you just need to install the module and set the proper configuration (step 2).
2. Update Medusa config
Second, update your Medusa config (medusa-config.js) by adding the S3 plugin configuration in the plugins section.
Then, update the project configuration. We are using a custom environment variable called PRODUCTION to determine if the server will use managed databases (RDS Postgres and Redis) or local databases (SQLite and "fake" Redis).
Built-in environment variables
Below is a list of built-in environment variables provided in the Medusa Server runtime. You can access them with process.env.<VARIABLE NAME>
Name | Description | Required |
S3_URL | The URL to your bucket. It’s in the form https://<BUCKET_NAME>.s3.<REGION>.amazonaws.com | Yes |
S3_BUCKET | The name of the bucket created automatically by the template. | Yes |
S3_REGION | The region code of your bucket. For example us-east-1. | Yes |
DATABASE_URL | The connection string to the Postgres database instance (if PRODUCTION=true) | No |
REDIS_URL | The connection string to the Redis instance (if PRODUCTION=true) | No |
COOKIE_SECRET | Auto-generated strong cookie secret (128 characters long). | Yes |
JWT_SECRET | Auto-generated strong JWT secret (128 characters long). | Yes |
PRODUCTION | The application mode. If set to true the template will provision managed RDS Postgres and Redis instance, if set to false the application will use the local SQLite and "fake" Redis databases. | Yes |
Custom environment variables
Use custom variables to specify the ADMIN_CORS, STORE_CORS, Stripe configuration, etc. The custom variables can be added after the template deployment is completed.
To provide custom environment variables in the Medusa Server runtime, go to your Environment, select the Medusa resource from the list and go to the Resource Settings tab.
Add the custom environment variables in the EnvironmentVariables resource property in the following format: KEY=value,KEY=value.
Click on Save and Deploy button.
Estimated AWS cost
The estimated cost of the AWS cloud depends on the configuration of the Medusa infrastructure. Below is the cost estimation breakdown based on different configurations assuming the resources are running all the time:
- Development mode (SQLite + "fake" Redis) with one app container (0.25 vCPU and 0.5GB memory) the costs is around $30/month
- Production mode (Postgres + Redis) with one app container (0.25 vCPU and 0.5GB memory) the cost would be approximately $70/month
- each additional container with the default config is $14/month