TopGit
GitHub Repo Review

Mpx: DiDi's Cross-Platform Framework for Mini-Programs

didi/mpx
MTopGit review image for didi/mpx
Review by Topgit.dev for didi/mpx, with GitHub repository stats and README context.
Quick verdict

Mpx is DiDi's own cross-platform framework for compiling one codebase to WeChat, Alipay, Baidu, and other mini-programs, plus Web and React Native for iOS, Android, and Harmony. Reach for it if you're building for China's mini-program ecosystem and want Vue-like single-file components instead of hand-wiring three native files per screen; skip it if you're not targeting that platform family, since the docs and community run Chinese-first.

Stars
โ˜… 3.9k
Forks
โ‘‚ 395
Contributors
๐Ÿ‘ฅ 125
Language
JavaScript
License
Apache-2.0
Topic
Frontend
Updated
Oct 2026

What is Mpx?

Mpx is an open-source, cross-platform framework built and maintained by DiDi that compiles a single Vue-like codebase down to WeChat, Alipay, Baidu, ByteDance, QQ, and JD mini-programs, plus a Web build and React Native apps for iOS, Android, and Harmony. Instead of porting a web framework into the mini-program runtime, it extends each platform's own native template syntax with web-style ergonomics, per the README's stated design.

Core Features and Capabilities

  • โœ“Reactive data through direct property assignment, plus watch and computed properties.
  • โœ“Composition API support alongside the standard options-style API.
  • โœ“Enhanced template syntax: dynamic components, style/class binding, inline event handler functions, two-way binding, and refs.
  • โœ“A small runtime โ€” the README states it's 14KB after compression and gzip โ€” paired with build-time bundle-size optimization.
  • โœ“A webpack5-based compiler with persistent caching, native mini-program compatibility, and npm-based subpackage output support.
  • โœ“Single-file component (SFC) authoring, similar in shape to Vue's SFC format.
  • โœ“State management following the Vuex spec, with multi-instance store support and a separate Pinia-style store package.
  • โœ“Cross-platform compilation: one codebase to WeChat, Alipay, Baidu, ByteDance, QQ, and JD mini-programs, a quick-app/Web target, and React Native (iOS/Android/Harmony).
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history โ†—

Getting Started with Mpx

Install the CLI globally with `npm i -g @mpxjs/cli`, scaffold a project with `mpx create mpx-project`, then `cd mpx-project && npm i`. Run `npm run serve` for development or `npm run build` for a production build, then open the matching platform folder inside the generated `dist/` directory with your mini-program IDE (WeChat DevTools, etc.) to preview it. For a React Native target, pick an RN-enabled template when running `mpx create`, then use platform-specific scripts such as `npm run serve:ios`/`serve:android`/`serve:harmony` for development and `npm run build:ios`/`build:android`/`build:harmony` for production โ€” the README notes the exact script names depend on what the scaffold generates. RN output typically lands in `dist/react-native/` or wherever your RN container project's own convention points.

Developing with Mpx: Code Examples

The README's example is a single-file Mpx component: a `<template>` block using WeChat-style directives (`wx:style`, `wx:for`/`wx:key`, `wx:class`, `bindtap`, `wx:model` for two-way binding, `wx:ref`, and a dynamic `<component is>`), a `<script>` block that calls `createPage` from `@mpxjs/core` with `data`, `computed`, `watch`, event handlers, and an `onReady` lifecycle hook, and a `<style lang="stylus">` block. The same file checks `__mpx_mode__` to branch behavior per target platform (`wx`, `ali`, `harmony`). For React Native targets specifically, Mpx uses per-platform conditional-compilation files โ€” `.ios.mpx`, `.android.mpx`, `.harmony.mpx` โ€” and the README notes that if an `android` or `harmony` file is missing, the build falls back to that file's `.ios` version.

Why Choose Mpx for Cross-Platform Development?

  • โœ“Single-file components with a Vue-like API (data, computed, watch, methods, lifecycle hooks) instead of hand-wiring three separate native mini-program files.
  • โœ“A genuinely small runtime โ€” 14KB compressed and gzipped, per the README โ€” plus webpack5-based build-size optimization for the compiled output.
  • โœ“Stays close to each platform's native APIs and component model instead of emulating a browser DOM inside the mini-program runtime, per the README's own 'enhancement' design rationale, so existing native component libraries and tooling keep working.
  • โœ“One React Native output path covers iOS, Android, and Harmony from the same Mpx source and compile config, with per-platform differences handled through conditional-compilation files.
  • โœ“Apache-2.0 license.
  • โœ“TypeScript support built on ThisType for type inference inside SFCs, plus documented unit-test and E2E-test tooling.

Potential Considerations for Mpx

  • โ–ณDocumentation, the official site, and the primary support channels (WeChat and QQ groups) run Chinese-first per the README โ€” no English documentation is referenced in the facts available here.
  • โ–ณThe React Native build scripts shown in the README are described as indicative, since 'the exact script names depend on what the scaffold generates,' so the precise CLI surface for RN builds isn't fully pinned down in the docs.
  • โ–ณHarmony support only exists inside the React Native output path โ€” the README is explicit that it isn't a separate mini-program output target, so it's a variant of RN rather than an independent platform.
  • โ–ณDay-to-day production details โ€” deployment, CI, release cadence โ€” aren't documented in the README beyond the quick-start commands.
  • โ–ณThe community and third-party ecosystem around Mpx is much smaller than what surrounds Vue or React Native themselves.
View on GitHub โ†—Homepage โ†—

Real-World Mpx Applications

  • โ€ขBuilding one codebase that ships to multiple mini-program platforms (WeChat, Alipay, Baidu, ByteDance, QQ, JD) without hand-porting templates per platform.
  • โ€ขExtending that same codebase into a Web build and React Native apps for iOS, Android, and Harmony, matching the output targets the README lists.
  • โ€ขMigrating an existing native mini-program incrementally, since the README documents progressive adoption and native-component support that let native code and Mpx code sit side by side.
  • โ€ขReusing an existing mini-program component library, analytics SDK, or other native tooling inside an Mpx project, since the README says Mpx stays compatible with native mini-program technical specs.
  • โ€ขBuilding internal mini-programs across multiple teams at a larger org, since the README documents cross-team development through packages and logic reuse through mixins.

Mpx Alternatives for Multi-Platform Development

Taro โ€” ByteDance's cross-platform framework that compiles React or Vue code to multiple mini-program platforms plus H5 and React Native, the closest category match to Mpx.uni-app โ€” DCloud's Vue-based framework for shipping one codebase to mini-programs, H5, and native apps, another common pick for the same job. โ†—WePY โ€” an earlier Vue-like WeChat mini-program framework, narrower in scope than Mpx since it doesn't cover multi-platform or React Native output.Chameleon (CML) โ€” a cross-platform mini-program and app framework with its own template syntax, an option if you don't want Mpx's Vue-leaning API.

Frequently Asked Questions About Mpx

What platforms does Mpx support?

Mpx compiles one codebase to WeChat, Alipay, Baidu, ByteDance/Toutiao, QQ, and JD mini-programs, to a quick-app/Web target, and to React Native apps for iOS, Android, and Harmony, per the README's output-platform table.

Is Mpx framework free to use?

Mpx is released under the Apache-2.0 license and is free, open-source software, according to its GitHub repository.

Does Mpx support TypeScript?

Mpx supports TypeScript, using ThisType-based type inference inside single-file components, according to the README.

How does Mpx achieve high performance?

Mpx keeps its compressed, gzipped runtime around 14KB and pairs it with webpack5-based build-size optimization and template-driven dependency tracking, per the README's design notes, rather than emulating a full browser DOM inside the mini-program runtime.

Can Mpx projects integrate with native mini-program components?

Mpx documents progressive adoption and native-component support, so native mini-program components and Mpx components can be mixed within the same project.

What is the Mpx development experience like compared to Vue?

Mpx's README describes its API as Vue-like โ€” data reactivity, computed properties, watch, and single-file components โ€” while still compiling down to each mini-program platform's native template and API surface instead of a browser DOM.

The problem it solves

Teams building for WeChat, Alipay, Baidu, and the other mini-program platforms usually end up either hand-maintaining near-duplicate template code per platform, or reaching for a web MVVM framework that gets translated down into the mini-program runtime โ€” an extra abstraction layer Mpx's own README argues against. Mpx's README frames its design choice as the opposite: build on each platform's native mini-program syntax first, then layer on Vue-like reactivity and a compiler that emits that same enhanced source to Web and React Native (iOS/Android/Harmony) too.

Who should try it โ€” and who should skip

Try Mpx if you're already building WeChat, Alipay, Baidu, ByteDance, QQ, or JD mini-programs and want single-file, Vue-like components instead of three separate native files per screen โ€” especially if you also need a Web or React Native (iOS/Android/Harmony) build from the same source. Skip it if you're not building for the mini-program ecosystem at all: the payoff is tied to that platform family, and the documentation and community support run Chinese-first.

Related repositories

Source & attribution

Facts and quotes sourced from the didi/mpx GitHub repository and its README.

GitHub data ยท last synced Aug 12, 2026Reviewed by Henry
โ† Back to TopGit

Curious whether mpx is right for you?

Let ChatGPT, Claude, or Perplexity look into it โ€” click below and see what AI actually says about mpx.

GitHub