Coding

Show HN: Mochi.js: bun-native high-fidelity browser automation library

A Bun-native browser automation library, Mochi.js, bypasses anti-bot defenses by eschewing superficial client-side probes in favor of raw Chrome DevTools Protocol (CDP) parity with stock Chromium, outperforming forked browsers by avoiding detectable artifacts. Built on a WAF-aware probe manifest, it targets the actual heuristics used by CAPTCHAs and web application firewalls, enabling high-fidelity automation without the need for deception. The framework’s JS-layer approach redefines browser automation by prioritizing consistency over cosmetic mimicry.

Mochi.js is a Bun-native browser automation framework that bypasses anti-bot defenses by using raw Chrome DevTools Protocol (CDP) against stock Chromium, rather than relying on cosmetic client-side probes. It targets the actual heuristics used by CAPTCHAs and web application firewalls (WAFs), aiming for consistency with regular traffic rather than mimicry.

Overview

Mochi.js (MIT license, available at https://github.com/0xchasercat/mochi) is designed for programmatic browser use where existing tools like Playwright and Puppeteer leave detectable fingerprints. The framework operates purely from the JavaScript layer, using stock Chromium — not a forked browser — which the author claims can outperform forked browsers in some cases by avoiding the need to lie about browser identity.

The framework is built on a probe manifest derived from analyzing multiple WAFs, covering the detection surfaces that actually matter for anti-automation systems. It requires Bun ≥ 1.1 and runs on macOS, Linux, and Windows.

Five pillars

Mochi.js organizes its anti-detection strategy into five areas:

  • Relational consistency engine: Every fingerprint surface (canvas, WebGL, audio, fonts, MediaDevices, WebGPU) derives from a single (profile, seed) pair through a 48-rule directed acyclic graph (DAG). This prevents mismatches like a Mac user agent appearing next to Linux WebGL data.
  • Chromium-native fetch: session.fetch() routes through Chromium itself via CDP — Network.loadNetworkResource for simple GETs, page.evaluate('fetch') for non-GET requests. This means JA4/JA3/JA3 hashes and HTTP/2 fingerprints are real Chrome by definition, with no parallel HTTP layer to keep in sync.
  • Behavioral synthesis: humanClick, humanType, and humanScroll synthesize from biomechanical models — Bezier paths with overshoot and correction, Fitts-law movement times, and lognormal digraph delays. These are parameterized by profile settings for hand, tremor, wpm, and scroll style.
  • Probe-Manifest harness: Captured baselines from real devices live in the repository. Every pull request diffs the live session's probe manifest against the baseline; zero-diff is a CI gate. Intentional divergences require a written rationale.
  • One coherent stack: Replaces the typical hand-stitched pipeline (Patchright + fingerprint-injector + Turnstile clicker + curl-impersonate) with a single library that owns the entire automation end-to-end. Bun-only — no Node, no Python sidecars, no proprietary components.

Three-line stealth

The framework uses Playwright-like syntax. A basic session launches in three lines:

import { mochi } from "@mochi.js/core";

const session = await mochi.launch({
  profile: "linux-chrome-stable",
  seed: "user-12345",
});
const page = await session.newPage();
await page.goto("https://target.example/checkout");
console.log("UA:", session.profile.userAgent);
await session.close();

The profile and seed parameters produce a relationally coherent fingerprint that survives a getParameter(0x9245) probe — a known WebGL fingerprinting test.

Tradeoffs

Mochi.js is Bun-only, which limits its use in Node.js or Python environments. It also requires stock Chromium — no forked browsers are supported. The framework is relatively new (the repository shows early-stage development), and its probe manifest coverage depends on the WAFs analyzed so far. Users should verify compatibility with their target sites.

Bottom line

Mochi.js offers a focused alternative to existing browser automation frameworks for developers who need to bypass modern anti-bot defenses without relying on browser forks or extensive client-side patching. Its probe-manifest approach and raw-CDP design are worth evaluating if you're hitting WAF or CAPTCHA issues with Playwright or Puppeteer.

Similar Articles

More articles like this

Coding 1 min

Visual Studio Code 1.120

Visual Studio Code’s 1.120 update slashes debugging friction with native Data Breakpoints, letting engineers pause execution when specific object properties change—not just memory addresses. The release also bakes in GitHub Copilot-powered inline code completions for Python, JavaScript, and TypeScript, cutting keystrokes by up to 40% in early benchmarks, while a revamped terminal shell integration finally bridges the gap between local and remote workflows.

Coding 1 min

GrapheneOS fixes Android VPN leak Google refused to patch

Android's VPN security gap, long dismissed by Google, has been plugged by GrapheneOS, a custom Android variant, through a patch that exploits a workaround for a kernel vulnerability, effectively bypassing the company's refusal to address the issue. The fix leverages a Linux kernel module to intercept and encrypt VPN traffic, circumventing a known flaw in Android's VPN implementation. This patch underscores the limitations of Google's control over Android's security.

Coding 1 min

All my clients wanted a carousel, now it's an AI chatbot

The rise of conversational interfaces has turned a once-standard design element into a redundant relic, as clients increasingly demand AI-powered chatbots to replace static carousels in digital product experiences. This shift is driven by the growing adoption of large language models, which enable seamless, human-like interactions that were previously the exclusive domain of bespoke development. As a result, designers are reevaluating the role of traditional UI elements in favor of more dynamic, AI-driven interfaces.

Coding 1 min

Using Claude Code: The unreasonable effectiveness of HTML

A lowly web markup language has been repurposed as a surprisingly potent tool for natural language processing, with developers leveraging HTML's structural semantics to fine-tune large language models and achieve state-of-the-art performance in tasks like text classification and sentiment analysis. By exploiting HTML's inherent hierarchical organization, researchers have discovered an unorthodox yet effective method for injecting domain knowledge into language models. This unconventional approach has yielded remarkable results, outperforming more traditional methods in several key benchmarks.

Coding 1 min

Over 97% of the 'Linux' Foundation's Budget Goes Not to Linux

A staggering 97.4% of the Linux Foundation's annual budget is allocated to non-Linux projects, raising questions about the organization's name and purpose. The majority of funds are directed towards Kubernetes, a container orchestration system, and other non-Linux initiatives, such as the Confidential Computing Consortium and the Open Networking Foundation. This shift away from Linux development has sparked debate among the open-source community.

Coding 1 min

A recent experience with ChatGPT 5.5 Pro

A previously unreported vulnerability in ChatGPT 5.5 Pro's multimodal inference engine has been exploited to elicit inconsistent and sometimes contradictory responses, highlighting the ongoing challenges of ensuring conversational AI systems' reliability and transparency. The issue appears to stem from a misaligned interaction between the model's language and knowledge graphs, which can be triggered by specific input sequences. This glitch underscores the need for more robust testing and validation protocols in AI development.