BlogsShopifyTax Engine Componentization

Tax Engine Componentization

Tax Engine Componentization

2
posts
2019–2023

This feature thread tracks the development and enhancement of Shopify's tax engine. Initial efforts focused on addressing the complexity and distributed nature of tax calculations within the codebase. The primary strategy involved componentizing the tax logic into a distinct, well-defined module with a clear interface and schema for requests and responses. This involved extensive code analysis, refactoring, and the establishment of explicit architectural boundaries. The release process was carefully managed. This post details the development of the Tax Insights feature, which involved significant data modeling work, including modifying existing data models and creating four new ones. It explains the architecture for processing and storing tax-related data, utilizing Google Cloud Storage, Spark jobs, and Google Cloud Bigtable. The post also covers the process of understanding complex tax laws, prototyping data models with SQL, implementing logic, productionizing jobs with Spark, and publishing insights to merchants.

2023

The Complex Data Models Behind Shopify's Tax Insights Feature - Shopify

2/8/2023

This post details the development of the Tax Insights feature, which involved significant data modeling work, including modifying existing data models and creating four new ones. It explains the architecture for processing and storing tax-related data, utilizing Google Cloud Storage, Spark jobs, and Google Cloud Bigtable. The post also covers the process of understanding complex tax laws, prototyping data models with SQL, implementing logic, productionizing jobs with Spark, and publishing insights to merchants.

2019

Componentizing Shopify’s Tax Engine - Shopify

7/5/2019

This post details the process of componentizing Shopify's tax engine. It describes the challenges of a complex, distributed tax logic, the strategy of creating a distinct component with defined interfaces (TaxesRequestSchema, TaxesResponseSchema), the methods used to understand and isolate existing tax logic (regex, scripts, bug fixing), the implementation of GitHub bot triggers for boundary enforcement, the update of testing suites (unit, integration, end-to-end), and a detailed release strategy involving an experimental code path for comparison and a phased rollout. The outcome is a more sustainable and extensible tax engine with reduced cognitive load for developers.