The developer experience
Now that I have covered mini apps per se, I want to focus on the developer experience for the various super app platforms. Mini app development on all platforms happens in IDEs that are provided for free by the super app platforms. While there are more, I want to focus on the four most popular ones, and a fifth for Quick App for comparison.
Mini app IDEs
Like the super apps, the majority of the IDEs are available only in Chinese. You actually want to make sure that you install the Chinese version and not a sometimes available English (or overseas) version, since it might not be up-to-date. If you are a macOS developer, be aware that not all IDEs are signed, which means macOS refuses to run the installer. You can, at your own risk, bypass this as outlined by Apple help.
Mini app starter projects
To get started quickly with mini app development, all super app providers offer demo apps that can be downloaded and tested immediately, and that are sometimes also integrated in the "New Project" wizards of the various IDEs.
Development flow
After launching the IDE and loading or creating a (demo) mini app, the first step is always to log in. Usually you just need to scan a QR code with the super app (where you are already logged in) that is generated by the IDE. Very rarely do you have to enter a password. Once you are logged in, the IDE knows your identity and lets you start programming, debugging, testing, and submitting your app for review. In the following, you can see screenshots of the five IDEs mentioned in the paragraph above.
![WeChat DevTools application window showing simulator, code editor, and debugger.](/static/articles/mini-apps/mini-app-devtools/image/wechat-devtools-applicati-e7bdd4cc5967b.png)
![Alipay DevTools application window showing code editor, simulator, and debugger.](/static/articles/mini-apps/mini-app-devtools/image/alipay-devtools-applicati-6f47f9ec8e0f1.png)
![Baidu DevTools application window showing simulator, code editor, and debugger.](/static/articles/mini-apps/mini-app-devtools/image/baidu-devtools-applicatio-f4c5cc799b3e1.png)
![ByteDance DevTools application window showing simulator, code editor, and debugger.](/static/articles/mini-apps/mini-app-devtools/image/bytedance-devtools-applic-1f60b6ef6e2c7.png)
![Quick App DevTools application window showing code editor, simulator, and debugger.](/static/articles/mini-apps/mini-app-devtools/image/quick-app-devtools-applic-5d28bf9a61062.png)
As you can see, the fundamental components of all IDEs are very similar. You always have a code
editor based on the Monaco Editor, the same project
that also powers VS Code. In all IDEs, there is a debugger
based on the Chrome DevTools frontend with
some modifications, more on those later (see Debugger). The IDEs per se are
implemented either as NW.js or as Electron apps,
the simulators in the IDEs are realized as an
NW.js <webview>
tag oder
Electron <webview>
tag, which in turn are based on
a Chromium <webview>
tag. If you are interested in
the IDE internals, you can oftentimes simply inspect them with Chrome DevTools with the keyboard
shortcut Control+Alt+I (or
Command+Option+I on Mac).
![Chrome DevTools used to inspect Baidu's DevTools showing the simulator's webview tag in the Chrome DevTools' Elements panel.](/static/articles/mini-apps/mini-app-devtools/image/chrome-devtools-used-ins-107c9e255b2fa.png)
<webview>
tag.
Simulator and real device testing and debugging
The simulator is comparable with what you might know from Chrome DevTools' device mode. You can simulate different Android and iOS devices, change the scale and device orientation, but also simulate various network states, memory pressure, a barcode reading event, unexpected termination, and dark mode.
While the built-in simulator suffices to get a rough feeling for how the app behaves, on-device
testing, like with regular web apps, is irreplaceable. Testing an in-development mini app is just a
QR code scan away. For example, in ByteDance DevTools, scanning a QR code dynamically generated by the IDE
with a real device leads to a cloud-hosted version of the mini app that can then immediately be
tested on the device. The way this works for ByteDance is that the URL behind the QR code
(example) redirects to a hosted page
(example),
that contains links with special URI schemes like, for example, snssdk1128://
, to preview the mini
app on the various ByteDance super apps like Douyin or Toutiao
(here is an example).
Other super app providers do not go through an intermediate page, but open the preview directly.
![ByteDance DevTools showing a QR code that the user can scan with the Douyin app to see the current mini app on their device.](/static/articles/mini-apps/mini-app-devtools/image/bytedance-devtools-showin-5971d90f52171.png)
![Intermediate landing page for previewing a ByteDance mini app in various of the company's super apps, opened on a regular desktop browser for reverse-engineering the process.](/static/articles/mini-apps/mini-app-devtools/image/intermediate-landing-page-406369c8a848.png)
An even more compelling feature is cloud-based preview remote debugging. After simply scanning a special likewise IDE-generated QR code, the mini app opens on the physical device, with a Chrome DevTools window running on the computer for remote debugging.
![A mobile phone running a mini app with parts of the UI highlighted by the ByteDance DevTools debugger running on a laptop inspecting it.](/static/articles/mini-apps/mini-app-devtools/image/a-mobile-phone-running-m-042b833648b9.png)
Debugger
Elements debugging
The mini app debugging experience is very familiar to anyone who has ever worked with Chrome DevTools. There are some important differences, though, that make the workflow tailored to mini apps. Instead of the Chrome DevTools' Elements panel, mini app IDEs have a customized panel that is tailored to their particular dialect of HTML. For example, in the case of WeChat, the panel is called Wxml, which stands for WeiXin Markup Language. In Baidu DevTools, it's called Swan Element. ByteDance DevTools calls it Bxml. Alipay names it AXML, and Quick App references the panel simply as UX. I will dive into these markup languages later.
![Inspecting an image with WeChat DevTools' 'Wxml' panel. It shows that the tag in use is an `image` tag.](/static/articles/mini-apps/mini-app-devtools/image/inspecting-image-wechat-d732811586a65.png)
<image>
element with WeChat DevTools.
Custom elements under the hood
Inspecting the WebView on a real device via about://inspect/#devices
reveals that WeChat DevTools was deliberately hiding the truth. Where WeChat DevTools showed an
<image>
, the actual thing I am looking at is a custom element called <wx-image>
with a <div>
as its only child. It is interesting to note that this custom element does not use
Shadow DOM. More on
these components later.
![Inspecting a WeChat mini app running on a real device with Chrome DevTools. Where WeChat DevTools reported I am looking at an `image` tag, Chrome DevTools reveals I am actually dealing with a `wx-image` custom element.](/static/articles/mini-apps/mini-app-devtools/image/inspecting-wechat-mini-a-54fc65cc5ce63.png)
<image>
element with WeChat DevTools reveals that it is actually a <wx-image>
custom element.
CSS debugging
Another difference is the new length unit rpx
for responsive pixel in the various dialects of CSS
(more on this unit later). WeChat DevTools uses device-independent CSS length units to
make developing for different device sizes more intuitive.
![Inspecting a view with a specified top and bottom padding of `200rpx` in WeChat DevTools.](/static/articles/mini-apps/mini-app-devtools/image/inspecting-view-a-speci-d17a746cb7bfb.png)
200rpx 0
) of a view with WeChat DevTools.
Performance auditing
Performance is front and center for mini apps, so it is no surprise that WeChat DevTools and some other DevTools have an integrated Lighthouse-inspired auditing tool. The focus areas of the audits are Total, Performance, Experience, and Best Practice. The view of the IDE can be customized. In the screenshot below I have temporarily hidden the code editor to have more screen real estate for the audit tool.
![Running a performance audit with the built-in audit tool. The scores show Total, Performance, Experience, and Best Practice, each 100 out of 100 points.](/static/articles/mini-apps/mini-app-devtools/image/running-performance-audi-fa75ebecfd4e2.png)
API mocking
Rather than requiring the developer to set up a separate service, mocking API responses is directly part of WeChat DevTools. Via an easy-to-use interface the developer can set up API endpoints and the desired mock responses.
![Setting up a mock response for an API endpoint in WeChat DevTools.](/static/articles/mini-apps/mini-app-devtools/image/setting-a-mock-response-b73d071a1206d.png)
Acknowledgements
This article was reviewed by Joe Medley, Kayce Basques, Milica Mihajlija, Alan Kent, and Keith Gu.