Medusa won the Golden Kitty Award for Best Ecommerce Product ✨  Learn More

Medusa Logo
  • Developers
  • Blog
  • Pricing
  • Community
  • About
  • Careers
  • Get Started
  • Developers
  • Blog
  • Pricing
  • Community
  • About
  • Careers
  • Get Started
Tutorial

Javascript ecommerce setup hosted with Qovery

Tutorial on how to create a javascript ecommerce setup which is deployed on Qovery

javascript ecommerce

Share

Oliver Juhl
Oliver JuhlOct. 6, 2021• 2 min.

This is a guide for deploying a Medusa project to Qovery. Qovery is a Continuous Deployment Platform, that provides you with the developer experience of Heroku on top of your cloud provider (e.g. AWS, DigitalOcean).

It is assumed, that you are currently running a local instance of Medusa. If not, check out our Quickstart or use npx create-medusa-app to set up your application in a matter of minutes. For the latter, see this guide for a small walkthrough.

1. Qovery Console

Create an account on Qovery on their free community plan and jump into the console.

2. Setup

Create a project and an environment.

3. Add your Medusa app

Add a new app to your Qovery environment and connect the Git repository that holds your Medusa project. In your application settings, set the port to 9000 unless something else is specified in your setup.

If you used our npx starter, your repository will most likely hold all components; storefront, admin and backend. Ensure that Root application path in Qovery is pointing to your Medusa project (/backend).

4. Add a database

Navigate to your environment overview and add the databases required by Medusa.

  • Add Postgres database version 10, 11 or 12
  • Add Redis database version 5 or 6

5. Configure Medusa

Our Medusa project needs a bit of configuration to fit the needs of Qovery.

Update medusa-config.js

First, add the Postgres and Redis database url to your medusa-config.js. In Qovery, click on your Medusa app in the environment overview. Navigate to environment variables in the sidebar on the left. Among the secret variables you should find your database urls. They should look something like this:

QOVERY_REDIS_123456789_DATABASE_URL
QOVERY_POSTGRESQL_123456789_DATABASE_URL

Add these to your medusa-config.js.

const DATABASE_URL = process.env.QOVERY_POSTGRESQL_123456789_DATABASE_URL
const REDIS_URL= process.env.QOVERY_REDIS_123456789_DATABASE_URL

Furthermore, update module.exports to include the following:

module.exports = {
  projectConfig: {
    redis_url: REDIS_URL,
    database_url: DATABASE_URL,
    database_type: "postgres",
    store_cors: STORE_CORS,
    admin_cors: ADMIN_CORS,
    database_extra: { }
  },
  plugins,
};

IMPORTANT: We are using the Qovery community plan, that does not allow SSL connections for the database, so this is disabled.

In a production environment, you would need the following in the config: database_extra: { ssl: { rejectUnauthorized: false } }

Add some extra variables

We need to add a couple of more environment variables in Qovery. Add the following variables in your Console with an application scope:

JTW_SECRET=something_secret_jwt
COOKIE_SECRET=something_secret_cookie

Make sure to use actual secrets in a production environment.

Update package.json

Update scripts to the following:

"scripts": {
    "serve": "medusa start",
    "start": "medusa migrations run && medusa start",
    "prepare": "npm run build",
    "build": "babel src -d dist --extensions \".ts,.js\""
  },

6. Deploy Medusa

Finally, deploy your Redis and Postgres followed by your Medusa application.

Deploy databases

In your environment overview in Qovery, deploy your databases one after the other. Only when these are deployed, proceed to next step.

Push changes to your repository

To initialise your first build Qovery, simply commit and push your changes.

git add .
git commit -m "chore: Qovery setup"
git push origin main

6. Try it out!

In Qovery, click on your Medusa app in the environment overview. In the top right you are able to open up your application. Navigate to /health to ensure, that the app is running.

What's next?

You now have an application running on Qovery. This can be scaled and configured to fit your business needs. As mentioned, we used the community plan, so this should be upgraded when moving to production.

Furthermore, you can deploy Medusa Admin for your application, such that you can start managing your store from an interface.

  • Deploy Admin on Netlify
  • Deploy Admin on Gatsby Cloud (Coming soon)

Explore our Github or join our community

Share

Medusa Newsletter

Stay up to date

In our Newsletter you get the most important Medusa news directly in your inbox

Up Next

Deploy a Medusa Server on AWS with Microtica

A Step-by-Step Tutorial on How to Deploy a Medusa Server on AWS

Learn how to deploy Medusa on AWS with Microtica

Person photo
Marija NaumovskaJan. 16, 2023• 3 min.

You may also like

Use ChatGPT to Automate Product Description Writing

Use ChatGPT to Automate Product Description Writing

Never think about product descriptions. Automate product description creation with ChatGPT and Medusa

Person photo
Ashutosh KrishnaJan. 19, 2023• 7 min.
Roadmap update - Jan 2023

Roadmap update - Jan 2023

Keep reading to learn about what’s in store for future versions of Medusa.

Oliver Juhl
Oliver JuhlJan. 17, 2023• 4 min.
Inspired by Git: How we Designed our Order-Editing Feature

Inspired by Git: How we Designed our Order-Editing Feature

This article covers how we adopted principles from the Git version control system and GitHub in our Order Editing API design.

Oliver Juhl
Oliver JuhlJan. 25, 2023• 4 min.
Order Edits and Payment Collections are now available

Order Edits and Payment Collections are now available

Learn more about Medusa’s new order-editing feature and how it works

Person photo
Sebastian RindomJan. 25, 2023• 2 min.
Ecommerce APIs: What they are and how they work

Ecommerce APIs: What they are and how they work

This article first discusses the basics of ecommerce APIs and an in-depth evaluation of an open source ecommerce API-first solution —Medusa.

Person photo
Esther ChristopherJan. 23, 2023• 7 min.
Use ChatGPT to Automate Product Description Writing

Use ChatGPT to Automate Product Description Writing

Never think about product descriptions. Automate product description creation with ChatGPT and Medusa

Person photo
Ashutosh KrishnaJan. 19, 2023• 7 min.
Roadmap update - Jan 2023

Roadmap update - Jan 2023

Keep reading to learn about what’s in store for future versions of Medusa.

Oliver Juhl
Oliver JuhlJan. 17, 2023• 4 min.
Inspired by Git: How we Designed our Order-Editing Feature

Inspired by Git: How we Designed our Order-Editing Feature

This article covers how we adopted principles from the Git version control system and GitHub in our Order Editing API design.

Oliver Juhl
Oliver JuhlJan. 25, 2023• 4 min.
Order Edits and Payment Collections are now available

Order Edits and Payment Collections are now available

Learn more about Medusa’s new order-editing feature and how it works

Person photo
Sebastian RindomJan. 25, 2023• 2 min.
Medusa Logo

Product

Medusa for B2BIntegrationsGet StartedCareers
We're hiring

Developers

DocsAPI ReferencesCommunityDiscussions

Medusa

BlogPricingAboutContact Us

Newsletter

Get a summary of what we’ve shipped during the last month, behind the scenes updates, and team picks. Unsubscribe any time.

© 2023 MedusaJS, Inc.