Shopify and the Journey Back to Clean Code
Shopify is betting on code simplicity like never before. And who would have thought that artificial intelligence would be the ally in this journey back to the roots? The e-commerce giant is launching a new theme for its stores, promising code that anyone with a minimum knowledge of HTML can understand. The idea is to make it easier for both humans and machines.
Still unnamed, this new theme is being presented in developer forums as the likely successor to Horizon, Shopify's current theme that is heavy on JSON. The new code is predominantly HTML, utilizing Shopify's own Liquid language, which is much easier to read. When merchants look at the template directory, they will find plain text files instead of long chains of incomprehensible JSON. This theme has 93% fewer lines of code than Horizon.
AI as the Engine of Transformation
The restructuring of Shopify's code is being driven by its increasingly popular artificial intelligence services. Ben Sehl, Shopify's product director, highlighted that AI models already understand HTML efficiently. The Liquid language integrates seamlessly with HTML, making the code more accessible for both humans and machines.
A decade ago, Sehl was a merchant tinkering with Shopify's basic templates using a third-party kit. Over time, Shopify enriched the template system, allowing users to become true designers. But this flexibility brought complexity. The template instructions were converted to JSON, complicating life for developers.
The Impact of AI on Developers
Recently, Shopify introduced an AI assistant called Shopify Sidekick, which has given users even more control over the design of their pages. Now, 20% of Shopify merchants use Sidekick to edit their themes, resulting in 25 million edits this year. This forced Shopify to simplify the code so that AI could work better.
AI agents, just like humans, prefer easy-to-read code with explicit contracts. Therefore, Shopify reorganized the architecture of its themes with these qualities as fundamental principles. The code became not only more friendly for AIs but also for humans.
The Revolution of Readable Code
For the new base theme, the Liquid language gained a new syntax and parser, allowing for more complex instructions to be executed on the back-end. What the user sees are composed and typed blocks that fit easily with standard HTML. Each user-designed theme receives a special directory with instructions and examples of how to generate additional artifacts.
The key to the new theme is a new composed block tag, which contains nested parameters describing page components. This allows developers to feed these blocks with values, settings, and other instructions. Developers familiar with React will recognize the similarity to React props, but without the need to create a virtual DOM.
AI experts are realizing that the best "food" for AIs is not dense, symbolic code. Just like humans, language models prefer text that is easier to understand. One developer found that SQL was easier to process than the domain-specific languages of 17 different tools. Perhaps Shopify's efforts to please AI will not result in sloppy code, but rather in a movement towards more readable code.
In the end, what Shopify is doing is not just a technical change. It is a change in mindset. And who knows, this may inspire other companies to follow the same path. After all, clean code is good for both humans and machines.





Comments (0)
Comments are moderated and if they violate our Terms and Conditions of use, the comment will be deleted. Persistence in violation will result in a ban of your account.