nowfound

Dev tools · May 18, 2023

SJ

Swap.js – a JavaScript micro-framework (HTML fragments over the wire)

Hi HN! I created this lib in the need of a simple and tiny framework to easily do AJAX-style navigation / replacement of fragments in the page, in a web application. For people who don't want to use client-side-rendering and complex frameworks à la React, there are nowadays a few "HTML-over-the-wire" libraries, like HTMX, Unpoly or this super-tiny one Swap.js :) One other key thing is that no external tool is needed: no bundler, no webpack, no TypeScript compiler, no minification needed. Just write HTML, JS (+ your preferred server-side language: PHP, Python, etc.) and it works. The…

In plain words

Swap.js is a lightweight JavaScript micro-framework that enables AJAX-style page updates by fetching and swapping HTML fragments from the server. It targets developers seeking an alternative to heavy client-side frameworks like React, allowing them to build dynamic web applications using HTML, plain JavaScript, and any server-side language without requiring bundlers, compilers, or build tools. The framework uses the Fetch API and MutationObserver to detect and handle DOM changes automatically.

written from the facts on this page · September 2026

From the sources

In the maker’s words, at launch

Hi HN! I created this lib in the need of a simple and tiny framework to easily do AJAX-style navigation / replacement of fragments in the page, in a web application. For people who don't want to use client-side-rendering and complex frameworks à la React, there are nowadays a few "HTML-over-the-wire" libraries, like HTMX, Unpoly or this super-tiny one Swap.js :) One other key thing is that no external tool is needed: no bundler, no webpack, no TypeScript compiler, no minification needed. Just write HTML, JS (+ your preferred server-side language: PHP, Python, etc.) and it works. The framework makes use of fetch (of course) but also MutationObserver API to be able to launch actions when parts of the DOM change. Let me know what you think!

More dev tools this month

the category →
  • Dograh592

    The open source VAPI alternative

    Dev tools · 25d ago · dograh.com

  • Meridian530

    Don't let your work go unnoticed. Get promoted!

    Dev tools · 20d ago · meridiona.com

  • x1516

    Lovable for iPhone apps go from idea to App Store

    Dev tools · 11d ago · x1.new

  • Open-source GTM skills for technical founders

    Dev tools · 29d ago · gtmcofounder.com

  • OpenTrailPaper is open-source bike computer firmware for the LilyGO T5S3 4.7" E-Paper PRO. It supports offline maps, GPX routes, FIT recording and Bluetooth sensors.

    Dev tools · 1d ago · opentrailpaper.com

  • Nuphos380

    The AI-Native DevOps Workspace.

    Dev tools · 24d ago · nuphos.ai

Launched alongside, May 2023

the whole month →
  • Sidekick1,343

    An AI-powered accessibility assistant in Stark

    AI · 2023 · getstark.co

  • BR

    In today's world, catchy headlines and articles often distract readers from the facts and relevant information. By utilizing OpenAI's language models, Boring Report processes sensationalist news articles, transforms them into the content you see, and helps readers focus on the essential details. We recently updated our iOS app experience, so any and all feedback would be appreciated. App Link: https://apps.apple.com/us/app/boring-report-news-by-ai/id644...

    AI · 2023 · boringreport.org

  • Generating powerful websites, one prompt at a time

    AI · 2023

  • Unlock a new level productivity with AI, Cloud Sync and more

    AI · 2023 · raycast.com

  • AudioPen888

    The easiest way to convert messy thoughts into clear text

    AI · 2023 · audiopen.ai

  • Launch your website in seconds, get users in minutes

    Dev tools · 2023 · page.mmntm.build