Skip to content

Instantly share code, notes, and snippets.

@gterzian
Last active July 11, 2025 16:08
Show Gist options
  • Save gterzian/c97c6532911c712f7f7a4778a7f896b6 to your computer and use it in GitHub Desktop.
Save gterzian/c97c6532911c712f7f7a4778a7f896b6 to your computer and use it in GitHub Desktop.

How to install and run an mini-app in Servo: Proof of Concept

Storage

  • Embedder use the filesystem as a cache for assets
  • Manifests also stored on the filesystem, but loaded in memory on start-up.

Registration

  • Mini-app registered with the embedder: store manifest and assets.
  • Emebedder registers mini-apps with a new message to Servo.
  • Registering a mini-app means:
    • registering a networking override when the user navigates to the mini-app url.
  • When handling the navigation override:
    • the embedder uses the manifest to load resources from the filesystem, and
    • makes them available to script as fetch responses.
    • For simplicity: just write the content of all assets to an HTML file(containing no links) and load it in one go?
  • This implies an un-registration mechanism.

Running

  • The mini-app runs on a window event loop, like any other web app.

Notes

  • what about non-standard architectural features of current mini-app frameworks?
    • Running a business logic worker JS thread outside of Servo? I think this could be done with a normal web worker, but the above design would allow the embedder, as part of the network interception hook, to start such a thread outside of Servo. Outside of the scope for a POC(would require more mechanisms to communicate with the window event-loop).
    • JS bridge to OS: use web standards instead?
    • Supporting non-standard mark-up is outside of the scope of a POC. Also, it seems that Web standards could be used instead.
  • In general, implementing mini-apps in Servo should prefer Web standards approach, see the MiniApp APIs Gap Analysis.

Resources

@gterzian
Copy link
Author

Notes from meeting:

  • You can in theory design a mini-app framework that would web standards(and extend them, like here).
  • Backwards compatibility with existing mini-apps is a problem.

@ysbcc
Copy link

ysbcc commented Jul 11, 2025

Is there a JS bridge web standards?

@ysbcc
Copy link

ysbcc commented Jul 11, 2025

What's the purpose of this POC? Is it to create a miniapp platform or to build a web experience that's better in terms of performance? If you're aiming to develop miniapp, fully following the current WeChat miniapp format would be the best approach, allowing compatibility with existing miniapp code (this is also how other major apps in China are doing it). But the workings of these miniapp are very transparent, so it seems there's no need to do a POC?

@gterzian
Copy link
Author

Is there a JS bridge web standards?

There is not one standard, but a lot of different ones, for example: https://w3c.github.io/web-nfc/

@gterzian
Copy link
Author

What's the purpose of this POC?

That's a good question. My attempt at an answer would be: "to apply mini-app patterns to the web platform to build a better web experience".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment