mxpak: A Fast Widget Package Manager for Mendix with Global Caching and Hard Links - Mendix Forum

mxpak: A Fast Widget Package Manager for Mendix with Global Caching and Hard Links

0

Hey everyone,


I've been working on a CLI tool called mxpak that manages .mpk widget packages for Mendix projects. The core idea is simple: download each widget once, cache it globally, and use hard links to share it across all your projects with zero extra disk cost.


If you've worked on multiple Mendix projects, you know the pain. The same 50+ widgets sitting in every project's widgets/ folder, each one downloaded separately. With 5 projects you end up with 5 identical copies of everything on disk. mxpak fixes this.



HOW IT WORKS


When you run "mxp install" for the first time, mxpak downloads .mpk files from the Marketplace and stores them in a global cache at ~/.mxpak/store/, indexed by SHA-256 hash. From that point on, any project that needs the same widget just gets a hard link pointing to the cached file. No network request, no file copy, no additional disk usage. It's a single filesystem operation that completes instantly.


If the cache and project happen to be on different drives (where hard links don't work), mxpak falls back to a regular file copy automatically. You don't have to think about it.



WHAT YOU GET


- "mxp install" resolves and installs all widgets from your config file. A lock file pins exact versions and hashes so your whole team gets identical builds.


- "mxp marketplace" opens an interactive terminal browser for the Mendix Marketplace. You can search, pick versions, and download without leaving your terminal.


- "mxp add / remove / update" lets you manage widgets declaratively.


- "mxp audit" checks SHA-256 integrity of every .mpk in your project.


- "mxp cache clean" frees up the global cache when you need space.



NUMBERS


Say you have 5 projects, each with about 55 MB of widgets.


Without mxpak: 275 MB on disk, and you download everything 5 times.

With mxpak: 55 MB total on disk. Every install after the first one finishes in under a second.



CONFIGURATION


Your project gets a simple config like this:


[tools.mendraw]

mode = "mpk"

widgets_dir = "widgets"


[tools.mendraw.widgets.Badge]

version = "3.2.2"

id = 50325


[tools.mendraw.widgets."com.mendix.widget.web.Datagrid"]

version = "2.22.3"

id = 116540



BACKSTORY


This project came out of glendix and mendraw, which are my experiments in building bidirectional compatibility between Mendix and Gleam (a functional language on the Erlang VM). While working on tooling to bridge the two ecosystems, I kept running into the problem of managing .mpk files programmatically. There was no CLI tool that could talk to the Marketplace and handle local caching properly, so I ended up building one. mxpak itself is written in Gleam, which gives it solid concurrency and fault tolerance from the Erlang runtime.


It's still early (v0.1.0) and there's a lot more I want to add. If you have feedback or ideas, I'd love to hear them.


https://github.com/GG-O-BP/mxpak

Posted
0 comments