Medusa 2.0 is finally here

Medusa 2.0 is finally here

Yes, it did take a bit longer than expected, and yes the preview version is not without shortcomings. But nonetheless, it is here now, and after more evenings than I can count on one hand I finally managed to have a fully functional medusajs 2.0 running on Railway. As alway, in this article you will find a 1-click deploy template, so with zero effort you can get your very own medusajs 2.0 preview instance, at its current state.

To skip reading and go straight to the deploy template, use the wheel thingy on your mouse, until you see a purple button.

Video instrucitons

What to expect from the "preview" version

It is important to understand that the medusa development team, refers to the current version as "preview". So it is a beta version that is incomplete, both in terms of features, stability and documentation.

This is not meant to be negative feedback! Just my honest experience so far.

My experience with the preview version so far has been like climbing a very steep hill. The documentation is lacking, as are what seem to me to be obvious key features. I am sure the documentation will be rock solid in the future, but it is unclear to me which features will be developed along the way and which features they will leave for you to implement yourself. Let me give you an example: once you spin up the admin dashboard and want to add a new admin user, you can do so by navigating to the user page and typing in the email address of the admin user you want to invite. There's a "send invite" button that you would think would send an invitation, but even after installing the email plugin SendGrid and testing that it works, I was still not receiving any invitation emails in my inbox. It seems like this is something you have to develop yourself.

So, I dipped my toe into that and found that I had to use the event system to subscribe to the user.invite.created event and then send a message by using the notification service and providing a template ID. Unfortunately, the invite event doesn't contain the invite token, so you also have to fetch that somehow. I wanted to try to look up the invite in the database to get the token so I could manually construct the invite link and include it in the email, but it wasn't clear to me how to look up the invite. I did find some examples for looking up orders, but they used a service for that, which the equivalent for invites did not exist (yet?), so I would have to create a module myself to expose functions that would look up invites. At this point, I was gritting my teeth a bit because it felt like a domino effect of things I needed to build just to get this email to send—not knowing whether this feature will be developed by the team in the future or not.

Unfortunately, I can't find a roadmap with a list of features that they are working on, so this is still a bit of a mystery to me. For now, I have decided not to develop the invite email logic, hoping it will be shipped in a future update. While scratching my head, I asked quite a few times in the community Discord, but the help there is as scarce as the documentation.

The reason why I am emphasizing this, is so you don't get some false idea about what this deploy template comes with.

So what is new in medusajs 2.0?

You get a reworked admin dashboard that looks and feels somewhat nicer. Additionally, the product variant creation process has been simplified a little, so you don't have to repeat as much configuration as you did before when adding products with multiple variants (such as size and color combinations). The software architecture has also been reworked to accommodate customization even more, which is going to make life easier for those of you who intend to build features into your e-commerce project — which, at the end of the day is what Medusa strives to be: a customizable e-commerce stack. However, if you are just aiming for a simple webshop, there isn't much new to offer—at least not for now. Still, I would recommend using this template (Medusa 2.0) for your simple webshop, as this is the new major version that will be maintained with updates and new features going forward.

The medusajs 2.0 one-click deploy template

As this is now the 4th Railway deploy template I am working on, I have gained some experience, which has resulted in this template being the best so far. Here are some improvements:

  • No setup needed. Storefront, redis, Postgres database, medusa 2.0 backend automatically configured and connected.
  • Internal media storage, no need to sign up with Cloudinary and provide api keys and what not.
  • Health checks for deploys. Green checkmark now means that your app is 100% ready and running, you don't need to wait another ½-1 minute.
  • Automatic admin user creation with unique strong random password.

Other key features:

  • Payment with Stripe, plugin preinstalled (api key needed)
  • Emailing with Sendgrid, plugin preinstalled (api key needed)
Deploy on Railway v2.0.8 - updated 13. Sep. 2024

OBS: Hobby plan (5$/month) is required to run this template in the cloud💸- but if you don't want to pay, and just want to run it locally watch this video

Disclaimer

I have decided to introduce a little piece of analytics in this template. This is turned on by default, but not required, and can be turned off by deleting environment variable on the backend service by the key: TEMPLATE_REPORTER_URL. Normally I can see in the Railway dashboard, how many people have used my deploy template, and how many live projects there are - but I recently discovered that those numbers are incorrect, and therefore I was quite devastated when I found out that one of my templates, that I was investing a lot of time in, barely was used by anyone. For that reason, I have decided to take user engagement analytics into own hands, and I really hope that you will participate and leave the feature on, to help me get a better idea where my time is best spent. When left on, I will be pinged with your railway project id when you launch the template - no personal information is tracked.

Also... I welcome questions from people, and I'm happy to help as much as I can. However, it can be time-consuming. Not so long ago, I had a bad experience with someone who cloned my Git repository, made changes, and attempted to deploy it on Railway. When this didn't work out for them, they reached out to me, pretending there was a problem with my deployment template and asked for help in debugging their error messages. At some point, I realized what was happening and told them to use the template if they wanted it to work out of the box. If they wanted something different, they would need to spend their own time making that work.

This is another reason why I'd like to track project IDs when my template is used, so I can verify that someone asking for help is actually a template user. So, if you reach out with a question, I might ask for your project ID—something for something 😉

Succuessfully deployed, what's next?

Congratulations! You've successfully deployed the seed of your project - a somewhat generic, yet fully functional Medusa.js 2.0 stack. While it is not personalized yet, it's a robust foundation for you to build on. Now comes the fun part: growing, shaping, and maintaining your project to align with your vision, whether it's for a hobby project or a business venture.

In the deployment video, I demonstrated a simple customization to get you started. However, to help you take your project to the next level, I am actively maintining a list of invaluable resources.

Self help

How to Run your Medusajs 2.0 boilerplate locally
Requirements Until now, everything has been done in your browser, but that is about to change. To make changes to your medusa project, you will need some web development tools. If you already have these tools, please scroll past this step. If you have never heard of any of these
How to add Stripe payment module to medusajs 2.0
Video Instructions Links Stripe module medusa 2.0 documentation: https://docs.medusajs.com/v2/resources/commerce-modules/payment/payment-provider/stripeGitHub repo config example: https://github.com/rpuls/medusajs-2.0-for-railway-boilerplate/blob/master/backend/medusa-config.jsVideo demonstarti…

... more coming soon!

Ask for help