What’s New in Midway 3.0? A Deep Dive into the Latest Backend Framework Features
In January 2022, Midway released version 3.0, introducing multi‑version documentation, a clarified technology stack for standard, serverless, and integrated projects, a redesigned API syntax with zero‑API calls, new routing, full‑stack tooling, Prisma ORM support, and a lightweight request SDK, while also thanking open‑source contributors and outlining upcoming plans.
In January 2022, the Midway team livestreamed the Winter Direct Meeting and officially released Midway 3.0, an integrated version of the framework.
1. 3.0 Version Release
Midway 3.0 was launched on 2022‑01‑20, with new features detailed in the preview video.
2. Multi‑Version Documentation
The website now supports switching between documentation versions, defaulting to 3.0.
3. Clarified Technology Stack
Midway 3.0 defines three stacks:
Standard projects using Class + IoC for traditional Node.js web development.
Serverless projects supporting Alibaba Cloud, Tencent Cloud, and KNative.
Integrated projects that fuse front‑end and back‑end development with functional programming.
4. Appreciation for Open‑Source Contributors
The team thanked contributors who submitted PRs and offered gifts for PRs submitted in 2021.
5. Upcoming Plans
Provide Egg templates.
Integrate OpenTelemetry after the new year.
Synchronize internal Alibaba versions.
Integrated 3.0 Details
Current Status
The integrated solution originated in February 2020 and has been used by over 2,800 applications.
New Syntax
Midway 3.0 redesigns the API syntax, retaining the “function‑as‑API” and “zero‑API call” concepts while adding full functionality.
An API definition now includes: Api(): define the API function.
The new syntax also supports zero‑API calls, allowing front‑end functions to be invoked directly.
Operators
Operators extend API capabilities and support three functions:
Declaration (e.g., Query/Params/Header).
Definition (e.g., Middleware).
Execution (e.g., Validate/HttpCode/Redirect).
Complex examples can be expressed concisely using operator composition.
1. Request & Response
Built‑in operators like Query / Params / Headers declare input types, and the SDK converts them into proper request structures. Response operators are also provided.
2. Middleware
The Middleware operator allows custom middleware definitions.
3. Validate & ValidateHttp
Validation uses Zod; Validate(...schemas) validates inputs at runtime while preserving TypeScript static safety.
Prisma ORM
Prisma generates a type‑safe ORM client from a schema, enabling both compile‑time and runtime safety.
New Routing
Midway 3.0 simplifies routing into two strategies: default route generation from function/file names, or explicit path specification with dynamic parameters.
New Full‑Stack Suite
Version 3.0 introduces a unified dev/start/build configuration, reducing learning and cognitive overhead.
New Request SDK
The @midwayjs/rpc client replaces the previous Axios‑based client, shrinking size by 64% (5.6 KB → 2 KB) and supporting both browser and Node.js environments with configurable middleware.
Frontend Builder
Based on unplugin, Midway provides Vite/Webpack plugins for one‑line front‑end integration.
Preview
The integrated 3.0 preview is publicly available; documentation and trial can be accessed at midwayjs.org .
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
