Even with the 2,000+ apps in the Shopify ecosystem, sometimes hunting the right one down it feels like finding something good on cable: all those channels and yet nothing to watch.
We certainly have our favorite apps, but when we can’t find what we need Shopify offers the great bonus of built-in APIs, so that much of the cloud platform can be extended. Custom apps are a powerful solution.
Here are our seven tips for developing custom Shopify apps that work:
Tip 1: Start by asking yourself if you really need a custom app
Custom apps are powerful, and you can build lots of custom functionality with them. But they do come with overhead because you need to maintain a custom integration layer. Before starting work on a custom app, be honest about the long-term support cost of a custom app and compare that to the cost of a non-optimal workflow using public apps. It’s really important to dispassionately evaluate each option to figure out the best approach.
Remember, a good technologist asks if something can be done; a great one asks if something should be.
Tip 2: Pick a great platform
In Shopify, you have the freedom to develop custom apps in any language; custom apps are really just discrete middleware layers. In order to reduce the long-term cost of your custom app, make sure you pick a hosting platform that does not require maintenance, like having to install operating system patches or configure firewalls.
Platforms like AWS Lambda or Heroku are ideal and platforms like Linode or AWS EC2 that provide virtual servers are not. At TAG, we love Heroku for hosting Shopify apps because it auto-deploys and can handle worker threads restarting to prevent outages.
The platform you choose must also auto-scale.
Why is auto-scaling so crucial? One of Shopify’s great strengths is that Shopify scales automagically based on demand. Meanwhile, Magento scales manually in a process that involves too much hope and shrug emojis for comfort. To be clear, 🤷 = 👎.
If you build a custom app that doesn’t scale based on demand, you are skipping one of Shopify’s superpowers.
Tip 3: Postman is your friend
Shopify has robust APIs, and your Shopify custom app is an API-first middleware layer. My God, it’s full of APIs! As such, having a tool to help you test APIs using mock services is hugely helpful in development. Postman is one such service.
Postman has a pre-built collection for Shopify endpoints, which means you can start building your Shopify app even without a Shopify instance ready for your development.
Tip 4: Use a programming language you’re familiar with
As independent middleware, Shopify apps can be written in any programming language or framework. Don’t worry about all the fancy pre-built packages Shopify offers for app development. Pick a well-supported programming language that you know well and is suited to solve the algorithmic program you are facing. Do that, and you and the client will be much happier over the long term.
Tip 5: Use a queue system
The primary method a Shopify instance uses to communicate with a custom app is a webhook. A webhook is very simple: Shopify can be configured to ping a custom URL when a certain event occurs. That’s it.
Your first inclination might be to have your custom app directly respond to the Shopify webhook, but this is a fragile design. If your app is down for even a brief second — and it will be at some point — your app will completely miss the important event notification. A better design is to have the webhook ping a queue system. A queue system will capture the event and continually annoy your Shopify custom app until it handles the request.
There are many queue systems available, and most will work great for your needs. At TAG, we love RabbitMQ.
Tip 6: Test your webhooks locally
If you can’t, you will waste a lot of time dealing with either constant code pushes or a server. It will take some time to set up, but you will more than make up for it later.
Use something like ngrok to test your webhooks locally.
Tip 7: Log all the things
Log absolutely everything except credit card numbers, and make sure that your logs are detailed and precise. Shopify sites involve money and directly impact the revenue of the organizations that run them, so rapid, confident troubleshooting at the individual request level is absolutely crucial.
Every great engineering manager knows that an engineer can only fix what they can reproduce. If a customer experiences an issue on the live site, your engineering team will be unable to identify the cause of the issue (and thus fix it) without detailed log information. If you don’t log enough data, you are setting your engineering team up to fail.