We have been working on several Shopify based eCommerce implementations in the last year. The Shopify platform makes it quick and easy to get started with an eCommerce website. However the core platform is limited in scope and features, relying on an App Store to fill in the gaps. Apps are a key way to customize the Shopify experience and solve feature gaps. As primarily a Java team we are interested in if you can build a Shopify App using Java Spring Boot.
For even a very small simple eCommerce site you can easily end up needing 10-20 3rd party Apps. Some are free, some have monthly costs. Shopify’s rationale for this approach may be as simple as:
1) they can get other companies (the 3rd party app developers) to build and maintain many of the features you need for a comprehensive eCommerce platform without cost to Shopify, AND
2) they make a percentage on all the monthly costs the App developers can charge the clients.
Shopify Apps can be public, after an intense validation process by Shopify, on their App Store. Or they can be a private custom app that you or your clients can use directly. There are MANY reasons you may want to build a Shopify App; as a revenue generating product in the App Store, or to solve a feature gap for a specific client’s needs.
What Language To Use?
Shopify provides libraries to help you build apps that handle the API integration, and the OAuth app install flow. Unfortunately they only do this in two flavors: Ruby and Python. We have nothing against those languages, and use both in various places for our own internal tooling and client solutions. However, our background is heavily invested in enterprise grade Java based eCommerce platforms and solutions. We still like and prefer Java for complex application and web applications, due to the performance of the JVM, the available security features, type safety, and our 20+ years each of Java architecture and development experience.
So, could we build a Shopify App using Ruby? Absolutely. However, if you asked “Given the performance, scalability, testability, stability, and security requirements of a high traffic eCommerce site, would you feel more confident building that solution using Java or Ruby?” we would pick Java.
We must be close to the only ones however, since there are not a lot of discussions about using Java for Shopify Apps in the last few years. But, that won’t slow us down!
Key Components to a Shopify App
There are several critical pieces to a Shopify App –
- OAuth Install Flow – This is how your App gets installed to a Shopify Store. They use an OAuth based flow, however there are unique customizations so you can’t just use a standard OAuth library
- Shopify REST API Client – While the REST API is being replaced with the newer GraphQL based API, there is not yet feature parity between the two APIs, and there are some actions where you would still want to use the REST API. So this is still important.
- Shopify GraphQL API Client – This is the newer API, and offers some advantages with the GraphQL approach: depending on what you are trying to do you can reduce the number of calls you have to make dramatically, and get just the data you want back in the payload.
- App Admin UI – This is the front end of your Shopify App for the store owner to configure your app or view data, etc… This should be written with the Shopify App Bridge framework. There are two flavors: Embedded – where your app UI is presented within the Shopify Admin, and Standalone – where the Store admin ends up on your site with your app driving the full browser window. Embedded is generally recommended as it provides a more seamless UI experience for the Store Admin. However in some cases a standalone approach may be beneficial. If you need the extra screen real estate to present lots of data, or have a complex UI.
What Resources Are There For Building Shopify Apps Using Java Spring Boot
There are a couple relevant projects on GitHub we need to mention.
ChannelApe’s Shopify REST API client – https://github.com/ChannelApe/shopify-sdk
This project is a little stale, with the last update being 8 months ago, however it’s pretty solid overall. We found that many of the model objects were out of date against the current Shopify REST API version. The default setup also fails if Shopify returns any unexpected properties, and Shopify absolutely returns properties that are NOT in the API documentation.
Natf17 has two relevant projects for handling the OAuth flow for App installation: the old/deprecated project – https://github.com/natf17/shopify-spring-boot-embedded-app, and it’s newer replacement – https://github.com/natf17/shopify-embedded-app
While this looks promising at first glance, the project has been abandoned for 2+ years. And as far as we can tell never actually worked (there appear to be critical things missing from the OAuth flow). The code is also very un-Spring like, and is not at all how we would write something. It also fails to take advantage of the new-ish Spring Security OAuth framework. We would recommend ignoring these projects entirely!
We have not found any Java Shopify GraphQL clients or Java based Admin App Bridge UI frameworks or examples. If you know of any, let us know and we will update this article.
So, Can You Build A Shopify App Using Java Spring Boot?
So does that mean you can’t build a Shopify App using Java Spring Boot? No, not at all.
It just means you have to build a lot from scratch. Instead of just building the App we are working on, we’ve decided to build a Java Spring Boot based Shopify App framework. The framework will provide support and easy examples for all critical pieces of the App. Currently we have the OAuth install flow working nicely, and have a REST API client built and tested. Next up is the GraphQL API client, and then the Admin UI with examples for embedded and standalone admins.
Once we have the complete scope of the framework working and tested, we will be publishing it on GitHub for anyone to use, similarly to our free Open Source Spring Boot Security User Framework.
Watch our site for updates if you are interested in building a Shopify App using Java Spring Boot!