Drupal powered POS interface shown in tablet

ZKungFu is the largest directly operated Chinese food chain in China, using steam to prepare healthier food for their customers. The chain serves customers through 600 franchise locations in over 43 cities, four online 3rd party food ordering sites, and the Chinese social network WeChat.

In 2015, ZKungFu’s revenue reached 5 billion RMB (750 million USD). Operating at that scale requires advanced software for supply chain and inventory management, daily store operations, and corporate accounting. At that time the company used proprietary software for these tasks that simply wasn’t up to the challenge of delivering increasing integrability, flexibility, and scalability at a reasonable cost. Therefore, ZKungFu began that year to rebuild all of their software in house with open source technologies, including Drupal.

Why Drupal was chosen: 

Based on our broad experience with Drupal, we chose it because we knew it to be both flexible and scalable, well-suited to our approach of iterative product development and decoupled architecture. Building software for a business of this size was both extremely challenging and rewarding, especially as we achieved a successful migration from the old proprietary platform to the new Drupal based platform in less than one year!

Describe the project (goals, requirements and outcome): 

From the description above, you can see that our goal was a total transformation of ZKungFu's software platform from a struggling proprietary system into a Drupal based platform that could work at their scale.

We met our goals at a very rapid pace, and in this case study we share three lessons based on our development success:

Lesson One: Deploy Drupal based micro-services

Drupal is a comprehensive business application platform and is extensible enough to incorporate any feature you might need in a single site. However, to achieve our goals for reliability and scalability, we decided to use multiple Drupal sites to create a network of micro-service providers to support the entire business.

Compared to one big Drupal site with all the features, dividing functionalities into many smaller Drupal sites allowed our development team to work faster, because each micro-service provider needs to know less of the entire architecture to make progress. Additionally, these smaller sites are much easier to scale than one big site under high traffic.

On the other hand, thanks to Drupal, each micro-service provider can use a common set of web services, so our front-end developers don’t have the overhead they would normally encounter developing for applications with distributed data structures.


Visualizing the Drupal based micro-services powering ZKungFu online.

Specifically, we created three Drupal Commerce sites:

  • One site handles product information and branch management, including pricing rules and variations for duration, location, availability and other business conditions.
  • Another site handles payment, receiving 50% of the company's revenue (i.e. hundreds of millions of dollars annually!) from QR-Code oriented Alipay and WeChat Pay. This payment instance of Drupal Commerce also supports Cash, Credit Cards, and other smaller types of payment methods.
  • The third handles order information, tracking the changes from the moment an order is created online or from our POS machines (yes, we built their hardware and software, too!) to run through the food preparation pipeline, to payment, to delivery, to analytics, to business control, to reporting and accounting, and to supply chain planning.

Moreover, besides the Drupal sites we built for Content and Commerce strategies, we also used Drupal to build Marketing, CRM, and ERP capabilities to support customer acquisition, loyalty programs, resources planning, and forecasting. In summary, at the core of this project, we built a swarm of Drupal sites offering micro-services.

Lesson Two: Offline-First and Reliability second

The bloodline of this type of business is its steady flow of orders and payments. This data needs to be precisely managed and monitored at device level, store level, and cloud level. Therefore, we built the POS software with redundancy at these 3 levels, making offline support a mandatory requirement at the device and store levels.


The menu and shopping cart in the self-service POS application.

Assuming stable connectivity is still a luxury in the field of operation. In the system we built, devices like the cash register POS, self-service POS machine, and kitchen control panels can still create or handle orders when they lose their Internet connection.

After the internet connection is restored, multi-level synchronization takes place naturally and quietly in the background. We used CouchDB, PouchDB, Raspberry Pi, Node.js and Electron to build the data infrastructure that guarantees critical order and payment data will always reach Drupal as soon as possible.

Lesson Three: Software Development Process & Style in China

When it comes to engineering style, the Chinese still have a lot to do to catch up to the global best practices on strategic planning and rigorous thinking. However, two traits tend to set a Chinese development team apart: they usually create products targeting a large customer base, and they have a large pool of fresh and young talent. These two traits offer the company’s leadership a new direction to innovate product development - lightning fast product iteration driven by empirical evidence.

Throughout this project, we have been releasing new versions of various parts of the product on a daily basis for months. We were able to rotate groups of customers, support staff, and our developers around the clock to achieve continuous product innovation 24/7. Additionally, thanks to Drupal, which offers a powerful framework with well-known best practices, we could streamline talent on-boarding, training, and retention processes by encouraging the adoption of Drupal’s best practices.

Closing Thoughts

In conclusion, we have empowered a large restaurant chain to run its core business on open source and Drupal. We have really raised the bar with this project by building it to support an immense scale - over one billion dollars in transactions per year.

Special thanks to Heikwan Zheng (SparkPad) and Ryan Szrama for contribution to this case study and to Bojan Zivanovic and Matt Glaman for feedback during the writing process.

You can view the Chinese translation of this case study here (此案例学习中文翻译) .

Modules/Themes/Distributions
Key modules/theme/distribution used: 
Why these modules/theme/distribution were chosen: 

Drupal Commerce paired with JSON API provided us with the strong foundation we needed to build an enterprise scale transaction server for ZKungFu.

WeChat Pay and Alipay support is essential to doing business in China as they are our market leaders for digital payment.

Community contributions: 
  • Commerce WeChat Pay
  • Commerce Alipay (D8 port)
  • Points (Userpoints D8 port)
  • Many patches contribution to Drupal 8 core, Drupal Commerce 2.x, JSONAPI and a few other modules.
Project team: 

Heikwan Zheng, CTO of Sparkpad
Yueqing Zhang, CEO of Sparkpad
Mengjie Wang, CIO of ZKungFu
Ken Lin, Project Manager
Michael Shen, Architect
Ben Zhao, Product Manager

A swarm of Drupal micro-services
Self-service POS machine: menu and cart
Self-service POS machine: Complete order with Alipay QR-Code
POS tablet in store

Comments

Peter Majmesku’s picture

Thanks for the case study. The site isn't online yet at http://www.zkungfu.cn/, right?