VDX, a component framework that runs from plain files

VDX is a modern web application framework that aims to keep the "vanilla" experience of deploying the same files you edit directly, while having a feature set comparable to modern React and Svelte frameworks such as two-way data binding, stores, and components. There's no required build step or npm dependencies, so the code you write now should "just work" five years from now. It's batteries included, with a UI library, router, offline service worker, and optional linter/typescript support included.

This button is a VDX component on this page. Nothing compiled it.

What writing it looks like

A component is a class. Its state is a plain object: assign to it, and the parts of the page that read it update. Templates are tagged template literals, so there is nothing to compile. Edit the code below and press Run.

State that several components share goes in a store. Any component that reads it re-renders when it changes.

The tutorial has twenty chapters of examples like these, all editable in the browser.

Two complete example apps:

  • A demo shop: product catalog, filtering and a cart, using the router, a store and the UI library.
  • A task manager in TypeScript with typed components, stores and routes. TypeScript needs a compile step, so this one is source to read and build.

What you're trusting

VDX is maintained by a single party using AI assistance. There are no additional packages or delicate dependency chains to trust. There's one changelog for everything. Having been through several breaking change cycles forced on them by other libraries, the maintainer is committed to avoiding breaking changes unless something was already obviously broken.

You vendor it: copy the folder into your project and commit it. To update, replace the folder and read the release notes.

your-app/
  index.html
  app.js
  vdx/
    lib/      # framework, router, utils
    ui/       # optional: the cl-* component library
    styles/   # optional: light and dark theme
curl -LO https://github.com/iwalton3/vdx-web/releases/latest/download/vdx-full.zip
unzip vdx-full.zip -d your-app/   # smaller cuts: vdx-core.zip, vdx-framework.zip, vdx-ui.zip

If you'd rather vendor one file, dist/framework.js is the whole framework as a single module, about 32 KB gzipped (39 KB with the router and utils).

It drops into what you already have

Components are custom elements, so they work in any HTML page. A .NET app serving static files, a PHP site on cPanel, the output of a static site generator: copy the files in, add a module script, and use the tag.

  • Any web server works in hash-routing mode: Apache, nginx, IIS, GitHub Pages, python3 -m http.server. HTML5 routing needs the usual rule that serves index.html for unknown paths.
  • A page can hand a component structured data through a json-* attribute that names a <script type="application/json"> block, which a static site generator can write directly.

Below is a whole static page with one component in it, importing from the single-file bundle.

Larger examples, each a static page you can view the source of:

What's in the box

  • A UI library of 63 cl-* components: form inputs, dropdowns, data tables, dialogs, menus, tree views, tabs. Browse and edit them live.
  • A router with hash or HTML5 mode, lazy-loaded routes, and route guards that deny by default.
  • Offline support: a service worker template and a manifest tool that give versioned caches without a bundler.
  • Interactive lists: windowed scrolling for very long lists, drag to reorder with a mouse or by touch, multi-select, and long-press or right-click menus. These came out of a music player's play queue.
  • Escaping by default: values in templates are escaped for where they land, and raw HTML needs an explicit raw(). How that works.

The queue below has 10,000 tracks. Drag a row to move it (on touch, use the ⣿ handle), right-click or long-press for a menu, or press Select to move several at once.

Built with it

mrepo-webA music player with large libraries, long queues and touch gestures. Source
codemapA code graph and review tool. Source
The maintainer's personal websiteA launcher and a handful of small tools. A copy of its source lives in this repository: examples/personal.

Before and after

the maintainer's old personal website (2019)
package.json
  svelte, rollup 1, babel,
  node-sass 4, core-js
  22 dev dependencies
package-lock.json   # 7,292 lines
rollup.config.js
rollup-prod.config.js
its replacement, on VDX
index.html
app.js
home.js
api.js
components/
auth/
# imports the framework's lib/ as files
# no package.json
# no build config

The old website is a great example of web framework archeology. 5 years later, and the whole build system moved and there's a major version of half the packages. With a mile-long package-lock.json, it is easier just to start from scratch, and VDX aims to make it the last time you have to do that.

VDX doesn't claim to never break backwards compatibility, but it does it for good reason. The framework did have several extensive changes in the early (pre-v1) experimental phase, but the design is now largely settled. Working patterns will generally continue to work, while if something appears off or needs a workaround, it will get fixed.

Agents can work on it

The whole framework model is described in one file, FRAMEWORK.md, and there's no build configuration or plugin system to learn first. A coding agent can read that and the source and work on an app built with VDX.

Since the project is extensively documented, has thorough unit/e2e tests, and is already developed by agents, anyone can maintain the framework even if the maintainer steps away.

What this isn't

Not server-rendered

There is no SSR. For pages that need SEO, keep the content as static HTML and put components into it.

Not a large ecosystem

There is one maintainer and no plugin market. React and JSX libraries won't drop in.

Not style-isolated

There is no shadow DOM, so your page's CSS reaches into components. That is deliberate, since it makes components easy to inspect and theme, but it's something you have to manage.

Not for old browsers

Current desktop and mobile browsers only.

Not free of rules

A few template patterns, such as .map() inside a template or Vue-style @click, throw at runtime. A lint script catches them before then. The lint, optimizer and bundler are optional Node scripts; there is nothing to install.

Not frozen

Correct, defined behaviour of the framework doesn't break. Something that feels broken, or only works through a workaround, can change, and the release notes say what to check.