Reflux is a powerful, universal request/response middleware engine designed for any BareMux compatible web proxy. It features a dynamic plugin system that allows you to load and execute custom JavaScript code on specific websites.
- Dynamic Plugin System: Load and execute custom plugins on specific sites or globally
- Request/Response Middleware: Intercept and modify HTTP requests and responses
- WebSocket Support: Middleware support for WebSocket connections
- Site-Specific Targeting: Run plugins only on specified domains with pattern matching
- Real-time Control: Add, remove, and manage plugins dynamically
- Dual Mode: Works as standalone transport OR as Enigma module
npm install @nightnetwork/refluxReflux can be used in three ways:
Use Reflux as a direct BareMux transport:
import { BareMuxConnection } from "@mercuryworkshop/bare-mux"; const connection = new BareMuxConnection("/baremux/worker.js"); await connection.setTransport("/reflux/index.mjs", [{ base: "/epoxy/index.mjs", wisp: "wss://example.com/wisp/" }]);Use Reflux as an Enigma module alongside other modules:
import { BareMuxConnection } from "@mercuryworkshop/bare-mux"; const connection = new BareMuxConnection("/baremux/worker.js"); await connection.setTransport("/enigma/index.mjs", { base: "/epoxy/index.mjs", wisp: "wss://example.com/wisp/", modules: [ "/reflux/module.mjs", "/oxygen-module/index.mjs" ] });Import from the path export for bare-mux compatibility:
import { BareMuxConnection } from "@mercuryworkshop/bare-mux"; const connection = new BareMuxConnection("/baremux/worker.js"); await connection.setTransport("/reflux/lib/index.cjs", [{ base: "/epoxy/index.mjs", wisp: "wss://example.com/wisp/" }]);The Reflux API allows you to manage plugins from your application code:
import { RefluxAPI } from "@nightnetwork/reflux/api"; const api = new RefluxAPI(); await api.addPlugin({ name: "my-plugin", sites: ["example.com"], function: ` /* @browser */ console.log('Plugin running on:', url); /* @/browser */ ` }); await api.enablePlugin("my-plugin");import { RefluxAPI } from "@nightnetwork/reflux"; const api = new RefluxAPI();// Add a plugin await api.addPlugin({ name: string, sites: string[] | ['*'], // ['*'] for all sites function: string // JavaScript code to execute }); // Remove a plugin await api.removePlugin(name: string); // Enable/disable plugins await api.enablePlugin(name: string); await api.disablePlugin(name: string); // List all plugins const plugins = await api.listPlugins(); // Returns: Array<{ name, sites, enabled, function }> // Get enabled plugins only const enabled = await api.getEnabledPlugins(); // Returns: string[] // Update plugin sites await api.updatePluginSites(name: string, sites: string[]);// Main transport import RefluxTransport from "@nightnetwork/reflux"; import RefluxTransport from "@nightnetwork/reflux/transport"; // API (recommended) import { RefluxAPI } from "@nightnetwork/reflux/api"; // Legacy path export import RefluxTransport from "@nightnetwork/reflux/path"; // Enigma module import createRefluxModule from "@nightnetwork/reflux/module";- Getting Started - Setup and first plugin
- HTML Modification - Modify website content
- WebSocket Middleware - Intercept WebSocket traffic
- Request/Response Middleware - HTTP interception
- Plugin System - Plugin architecture deep dive
- API Reference - Complete API docs
- Examples - Working code examples
- HTML Modification: Inject scripts, modify content, add custom UI
- Request Interception: Modify headers, URLs, request bodies
- Response Transformation: Transform API responses, filter content
- WebSocket Monitoring: Log and modify WebSocket messages
- Ad Blocking: Remove unwanted elements and content
- Custom Analytics: Track user behavior and page performance
- Security Enhancements: Add CSP headers, sanitize content
- Dark Mode: Apply custom themes to any website
βββββββββββββββββββ β Application β ββββββββββ¬βββββββββ β βΌ βββββββββββββββββββ β BareMux β ββββββββββ¬βββββββββ β βΌ βββββββββββββββββββ β Reflux β βββ Plugin System β Transport β ββββββββββ¬βββββββββ β βΌ βββββββββββββββββββ β Base Transport β β (Epoxy/Libcurl) β βββββββββββββββββββ βββββββββββββββββββ β Application β ββββββββββ¬βββββββββ β βΌ βββββββββββββββββββ β BareMux β ββββββββββ¬βββββββββ β βΌ βββββββββββββββββββββββββββββββββββ β Enigma β β βββββββββββββββββββββββββββ β β β Reflux Module β β βββ Plugin System β β + Other Modules β β β βββββββββββββββββββββββββββ β ββββββββββ¬βββββββββββββββββββββββββ β βΌ βββββββββββββββββββ β Base Transport β β (Epoxy/Libcurl) β βββββββββββββββββββ β Middleware β ββββββββββ¬βββββββββ β βΌ βββββββββββββββββββ β Base Transport β β (Epoxy/Libcurl) β βββββββββββββββββββ
## Development This repository uses Bun, but any package manager will work. ```bash # Install Bun curl -fsSl https://bun.sh/install | bash # Linux/macOS powershell -c "irm bun.sh/install.ps1 | iex" # Windows # Clone the repository git clone https://github.com/Obsidian-Dev-Labs/Reflux.git cd Reflux # Install dependencies bun install # Run the demo bun demo See LICENSE file for details.
Contributions are welcome! Please read the documentation before submitting pull requests.