How Midway Serverless Redefines Cloud‑Native Backend Development with React‑Style Hooks

This article details the Midway Serverless framework's cloud‑native, React‑Hooks‑inspired approach to backend development, covering Alibaba's Node.js serverless landscape, the framework's architecture, new integrated development model, functional R&D features, and future open‑source plans.

Node Underground
Node Underground
Node Underground
How Midway Serverless Redefines Cloud‑Native Backend Development with React‑Style Hooks
This text is the written version of the Midway Serverless presentation shared at the Alibaba Cloud Native Microservices Conference in late August, introducing a new React‑Hooks‑style Serverless development approach.

Self‑Introduction

The speaker, a front‑end architect from Alibaba's Taobao technology division, works on Serverless adoption for front‑end business and designs the cloud‑integrated Midway Serverless framework.

Agenda

Alibaba Node.js Serverless construction status

Midway Serverless overview

Next‑generation cloud‑integrated development solution

Future roadmap

Alibaba Node.js Serverless Construction Status

In 2019, Alibaba's front‑end committee defined four technical directions: Service Building, Serverless, Intelligence, and Web IDE.

Serverless and Front‑end

Alibaba runs over 1,600 Node.js applications, most with CPU utilization below 10%. Maintaining Node.js services involves Docker, rate‑limiting, logging, and cross‑language calls, leading to high operational costs. Serverless functions improve utilization, enable pay‑per‑use, and reduce ops overhead.

From a business perspective, the middle‑platform strategy aims to combine front‑end and back‑end services for rapid delivery and lower error costs, making Serverless a key enabler for front‑end efficiency.

Serverless Achievements

After about a year of practice, Serverless has been adopted across multiple business units (e.g., Taobao, New Retail, Fliggy, ICBU, Tmall Genie). Machine‑cost reductions are ~30% for traditional services and ~87% for middle‑back‑office services, while overall productivity increased by ~48%.

The architecture proved stable with zero incidents during peak promotions.

Midway Serverless Overview

Midway Serverless serves as the foundation for all Node.js FaaS development at Alibaba.

Request Flow Example

When a request arrives, the runtime loads index.js, which executes the Midway Serverless framework, ultimately invoking user code and returning the result.

Architecture

The framework consists of three parts:

Toolchain – local trigger simulation, debugging, multi‑platform publishing.

Framework – data mocking, environment configuration, request adaptation, component extensions, IoC.

Standardization – unified YAML, front‑end call standards, runtime standards, and integration standards.

Next‑Generation Cloud‑Integrated Development Solution

Problems Encountered

Challenges included high onboarding difficulty, front‑back‑end separation, and increased development cost due to separate repositories and deployments.

Community Definition of Cloud‑Integrated Development

Two views exist: (1) architectural – cloud services and client‑side tech combined (e.g., BaaS); (2) code‑level – monorepo development where front‑end and back‑end share a repository.

Midway Serverless Cloud‑Integrated Solution

The solution unifies front‑end and back‑end in a single repository with a single dependency, offering easier development, maintenance, and deployment.

Midway Serverless Cloud‑Integrated Features

Functional R&D Solutions : Functions act as interfaces, reducing boilerplate and accelerating development.

Integrated Calls (Api not required) : Functions can be imported and called directly like regular functions.

Hooks (Using Node.js like React Hooks) : Node.js applications can use Hook‑style APIs for request context.

Progressive Development : Supports both simple and complex scenarios via IoC reuse.

Functional R&D

Current Cloud Provider API Models

Different providers (Alibaba Cloud, Tencent Cloud, AWS) require distinct request signatures, raising learning costs.

Simplest API Development

Using plain JavaScript functions, a function without parameters maps to a GET endpoint, while a function with parameters maps to a POST endpoint, aligning with native JavaScript development.

Function Metadata Mapping

Path: filename + function name

HTTP Method: presence of parameters

Request Body: function parameters

Integrated Calls

Functions are compiled via a Webpack/Babel plugin that transforms imports into HTTP requests, eliminating manual Ajax or API handling.

Hooks

Why Hooks

Traditional web services need request context (headers, method). Hooks provide a way to access this context without passing parameters.

Getting Request Context

const ctx = useContext()

The useContext Hook supplies request metadata, enabling seamless development similar to React Hooks.

Reusable Hooks

Complex logic can be extracted into custom Hooks for reuse.

Implementation and Performance

Node.js Async Hooks were considered but discarded due to instability and performance overhead. Instead, a compile‑time transformation injects this references and bind calls to pass context efficiently.

Progressive Development

The framework follows SOLID principles and leverages an IoC container (similar to Spring, Nest.js) to handle complex enterprise scenarios, integrating functional R&D with IoC via a useInject Hook.

Internal Adoption

2020.02 – Idea proposal & POC demo

2020.03 – Core features & API confirmation

2020.04 – First business rollout

2020.05‑Now – Multiple business units in production, continuous iteration

Future Outlook

Open Source

Midway Serverless is now publicly released on GitHub; users are encouraged to star the repository.

Multi‑Scenario Expansion

Beyond Alibaba's middle‑back‑office and mobile scenarios, the solution aims to support front‑end frameworks, SSR, mini‑programs, and more, inviting community contributions.

cloud-nativeserverlessNode.jshooksMidway
Node Underground
Written by

Node Underground

No language is immortal—Node.js isn’t either—but thoughtful reflection is priceless. This underground community for Node.js enthusiasts was started by Taobao’s Front‑End Team (FED) to share our original insights and viewpoints from working with Node.js. Follow us. BTW, we’re hiring.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.