Linking your local project with Medusa Cloud
In this part of the tutorial you will learn how to link your local Medusa project to Medusa Cloud. Doing this will enhance you development experience as you will closely mimic how Medusa would work in a production environment. Furthermore, you will be able to easily manage orders and products in your local project directly from Medusa Cloud. Linking Medusa is easily done with the Medusa CLI which you should already be installed when you set up your development environment.
Creating a Medusa Cloud account and CLI authentication
To link your local project you must first authenticate to Medusa using your CLI. Authenticating with the CLI is done by running:
If you don't have an account yet you can easily create one as part of the CLI authentication. First, choose the method that you want to login with we support logging in with GitHub, Google or simple email/password authentication. If choosing GitHub or Google without an existing account you will be taken straight to the sign up form where you can fill in your details and create an account. If you wish to sign up with an email/password combination simply click "Log in with email" and at the bottom of the form click "Sign up". Once you have filled out the sign up form your CLI will be authenticated.
To test that you have successfully authenticated you can run:
This will print out your account details.
Linking your local project
Once you have authenticated your CLI for your Medusa Cloud account you are ready to perform local linking. To link your project first naviagate to your project root - where your
You should note that the
For local linking to work you must make sure to have your CORS settings configured correctly. This is done by adding
If you change the port that your local server is running on you will have to run
You are now able to run a local development environment that is nearly identical to a production environment. This is made possible by linking your local project using the
You are all set to start developing on your Medusa project. If you haven't already now would be a good time to add a front-end to your Medusa server. We have two starters that you can use to get going:
The final step to take from here is to deploy your Medusa project. We will cover how this is done in the next part of the tutorial (Coming soon!).