How Midway Serverless Redefines Cloud‑Native Development with React‑Style Hooks
This article introduces Midway Serverless, a new cloud‑native Node.js framework that brings React‑like Hooks to serverless development, explains Alibaba's Serverless landscape, details the framework’s toolchain, architecture and standards, showcases its functional R&D, API‑free calls, progressive development features, and shares performance results and future plans.
Outline
Alibaba Node.js Serverless construction status
Midway Serverless introduction
Next‑generation cloud‑integrated development solution
Future roadmap
Alibaba Node.js Serverless Construction Status
In 2019 the Alibaba front‑end committee identified four technical directions: building services, Serverless, intelligence, and Web IDE. Over 1,600 Node.js applications run with low CPU utilization (most <10%, many <5%). Maintaining Node.js services incurs high costs due to Docker, rate‑limiting, logging, and cross‑language calls.
Serverless addresses these issues by improving server utilization, enabling pay‑per‑use, and reducing operational overhead. From a business perspective, Alibaba’s middle‑platform strategy encourages front‑end teams to compose services quickly, accelerating delivery and lowering trial‑and‑error costs.
Thus Serverless is used to empower front‑end development and achieve cost‑effective cloud‑native solutions.
Midway Serverless Achievements
After about a year of practice, Serverless was deployed in multiple business units (e.g., Taobao, New Retail, Fliggy, ICBU, Tmall Genie) and helped reduce machine costs by ~30% for traditional services and ~87% for back‑office services. Human‑efficiency improved by ~48%, and the architecture proved zero‑fault during peak promotions.
Midway Serverless Framework Overview
The framework consists of three parts:
Toolchain – local trigger simulation, debugging, unified publishing across platforms.
Framework – data mocking, environment configuration, request adaptation, component extensions, IoC.
Standardization – unified YML, front‑end call standards, runtime standards, and integration standards.
Next‑Generation Cloud‑Integrated Development Solution
Challenges encountered:
High learning curve for Serverless.
Front‑back separation when functions are developed in separate repositories.
Increased R&D cost due to split releases and repeated integration.
The proposed solution merges front‑end and back‑end into a single repository, sharing dependencies, simplifying development, maintenance, and deployment.
Midway Serverless Cloud‑Integrated Features
Functional R&D Solutions : Functions act as interfaces, reducing boilerplate and accelerating development.
API‑Not‑Required Calls : Functions can be imported and invoked like regular JavaScript functions, eliminating manual Ajax/API calls.
Hooks (Node.js like React Hooks) : Provides a familiar Hook API for server‑side development.
Progressive Development : Supports both simple and complex scenarios through IoC reuse.
Function‑Based Interface Development
Using plain JavaScript functions, a function without parameters becomes a GET endpoint, while a function with parameters becomes a POST endpoint, aligning API development with normal function syntax.
Get interface call
Post interface call
One‑Click Integrated Calls
The framework compiles function imports into HTTP requests using a Webpack/Babel plugin, removing the need for manual API composition.
Hooks Implementation
Traditional Node.js lacks request‑context access in functions. Midway introduces a
useContext()Hook to retrieve the context without passing parameters, mirroring React Hooks semantics.
<code>const ctx = useContext()</code>Hooks also enable reusable logic extraction and improve developer ergonomics.
Performance Considerations
Node.js Async Hooks were evaluated but discarded due to instability and severe performance overhead, as shown in benchmark diagrams.
Async Hooks cause significant performance loss
Midway instead uses a compile‑time transformation that binds
thisto the request context, achieving acceptable overhead.
Enterprise Node.js Practices
Midway follows SOLID principles, especially Dependency Inversion, and adopts IoC patterns similar to Spring, Nest.js, and TypeORM. The
useInjectHook allows functions to leverage the IoC container seamlessly.
Internal Adoption Timeline
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
Midway Serverless is now open‑source on GitHub. The team plans to extend the solution to front‑end frameworks, SSR, mini‑programs, and other scenarios, inviting community contributions.
Taobao Frontend Technology
The frontend landscape is constantly evolving, with rapid innovations across familiar languages. Like us, your understanding of the frontend is continually refreshed. Join us on Taobao, a vibrant, all‑encompassing platform, to uncover limitless potential.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.