Next-Gen Framework-Agnostic In-App Mobile Debugger & Inspector Overlay for Web Applications
- π Comprehensive Documentation Suite
- πΈ Showcase
- π‘ Motivation & Why Use It?
- β¨ Core Capabilities
- ποΈ Technical Architecture
- π Framework Quickstart
- βοΈ Full Configuration & Props Reference
- π¨ Theme Engine & Customization
- π Monorepo Structure
- π οΈ Development Setup
- π License
Debugging mobile web applications or QA staging builds on physical smartphones, tablets, or embedded webviews is historically painful:
- β Requiring physical USB debugging cables connected to a desktop computer.
- β Configuring Safari Remote Inspector or Chrome Inspect ports over local WiFi.
- β Losing console logs when a mobile browser crashes or refreshes.
- β Inability to inspect network traffic on production staging environments without desktop proxies (Charles / Fiddler / Proxyman).
mobile-devtools eliminates these pain points entirely. It embeds a lightweight, high-performance floating badge and overlay drawer directly inside your web application. You can inspect logs, monitor network calls, browse DOM trees, edit local storage, and inspect device specs anytime, anywhere β directly on screen without external tools or cables.
- β‘ Ultra-Lightweight & Fast: Small footprint (~32.2 kB gzipped / ~135.9 kB minified) with zero runtime dependencies, ensuring zero impact on page load speed or mobile frame rates.
- π³ DOM Elements Inspector (Elements Tab): Real-time HTML DOM tree browser, node expansion, interactive element picker, box model visualization (margin, border, padding, content), computed CSS styles, and grouped style categories (Layout, Flexbox, Grid, Typography, Colors).
- π Quick Bug Exporter: Instant 1-click bug report sharing via Web Share API (
navigator.share) to WhatsApp, Telegram, Slack, AirDrop, or Email with text file download and copy fallbacks. - π Network Throttling Simulator: Simulate
Slow 3G,Fast 3G, orOfflineconnection modes directly on mobile devices with synthetic latency injection. - β‘ Cable-Free Mobile Inspection: Debug directly on physical iOS / Android devices, mobile webviews, or mobile Safari/Chrome.
- π‘οΈ Shadow DOM Style Isolation: Rendered inside a Shadow DOM container (
<mobile-devtools-root>), guaranteeing zero CSS leaks into your app's global styles and zero style pollution from Tailwind, Bootstrap, or global CSS resets. - π Console Tab: Real-time capture of
console.log,info,warn,error, anddebugwith live search, log sorting (Newest,Oldest,Errors,Frequent), JSON tree preview, and unread error badges. - π Network Tab: Live interception of
fetch,XMLHttpRequest(XHR), nativeWebSocketconnections, andEventSource(SSE) with HTTP status indicators, latency timing, request/response headers, JSON body previews, WebSocket SVG direction frames, and unified sort & status class filtering (Newest,Oldest,Slowest,Fastest,2xx Success,3xx Redirect,4xx Client Error,5xx Server Error,1xx Info,Network Error). - πΎ Storage Tab: Real-time inspector and editor for
localStorage,sessionStorage,document.cookie, andindexedDBdatabases and object stores. - π» System Info Tab: Real-time diagnostic monitor for viewport dimensions, device pixel ratio (DPR), user agent string, memory limit, and screen orientation.
- π Pluggable Custom Tabs (
customTabs): Easily extend DevTools by adding custom tabs with your own DOM rendering callbacks (render(container)). - π¨ Granular UI Style Overrides (
styles): Fine-grained inline CSS style overrides for badge, drawer, overlay, and handle (styles={{ badge: {}, drawer: {}, overlay: {} }}). - π¨ Dynamic Theme Engine: Built-in Light Mode and Dark Mode with auto-contrast luminance detection, accent color swatches, and custom background palettes.
- π§ͺ Comprehensive Test Suite: Tested with 111 Unit Tests (100% Passed) + 21 Playwright E2E Tests (100% Passed) across Desktop Chrome, Mobile Chrome, and Mobile Safari.
- π§© Framework Agnostic: Native support for React 18/19, Vue 3, Svelte 4/5, and Vanilla JS.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β mobile-devtools β
ββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββ¬βββββββββββββ΄ββββββββββββ¬ββββββββββββββββββββ
βΌ βΌ βΌ βΌ
Vanilla JS React Vue 3 Svelte
(mobile-devtools) (mobile-devtools/react) (mobile-devtools/vue) (mobile-devtools/svelte)
β β β β
βββββββββββββββββββββ΄βββββββββββββ¬ββββββββββββ΄ββββββββββββββββββββ
β
βββββββββββββββΌββββββββββββββ
β Native Shadow DOM Host β
β <mobile-devtools-root> β
βββββββββββββββ¬ββββββββββββββ
β
ββββββββββββββββββββββββββββββ΄βββββββββββββββββββ
β β
βββββββββββββΌββββββββββββββββββ βββββββββββββββββββββββββββΌβββββββββββββββ
β Core Interceptors β β UI Engine β
βββββββββββββββββββββββββββββββ€ ββββββββββββββββββββββββββββββββββββββββββ€
β β’ Console Interceptor β β β’ Floating Badge View (floating-badge) β
β β’ Fetch / XHR Interceptor β β β’ Drawer Views & Tabs (drawer) β
β β’ DOM Elements Inspector β β β’ Pluggable Custom Tabs (customTabs) β
β β’ Storage Inspector β β β’ Auto Contrast Theme Helper β
β β’ DevTools Store & State β β β’ Bug Exporter Engine β
βββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββ
npm install mobile-devtools
# or
pnpm add mobile-devtoolsImport from mobile-devtools/react:
import React from 'react';
import { MobileDevTools } from 'mobile-devtools/react';
export default function App() {
return (
<>
<YourAppRoutes />
{/* Mobile DevTools Overlay */}
<MobileDevTools
title="My App Debugger"
position="bottom-right"
enabledTabs={['console', 'elements', 'network', 'storage', 'system']}
theme={{ mode: 'dark', accentColor: '#0070f3' }}
styles=".devtools-badge { opacity: 0.9; }"
renderBadge={(container, { unreadErrors }) => {
container.innerHTML = `<span style="color:#fff;">π My Debugger ${unreadErrors ? `(${unreadErrors})` : ''}</span>`;
}}
customTabs={[
{
id: 'analytics',
title: 'Analytics',
render: (container) => {
container.innerHTML =
'<div style="padding:16px;color:#fff;">π Custom Event Log</div>';
},
},
]}
/>
</>
);
}Import from mobile-devtools/vue:
<script setup>
import { MobileDevTools } from 'mobile-devtools/vue';
const customTabs = [
{
id: 'analytics',
title: 'Analytics',
render: (container) => {
container.innerHTML = '<div style="padding:16px;color:#fff;">π Custom Event Log</div>';
},
},
];
</script>
<template>
<YourAppLayout />
<MobileDevTools
title="My App Debugger"
position="bottom-right"
:enabled-tabs="['console', 'elements', 'network', 'storage', 'system']"
:theme="{ mode: 'dark', accentColor: '#0070f3' }"
:custom-tabs="customTabs"
/>
</template>Import from mobile-devtools/svelte:
<script>
import { mobileDevTools } from 'mobile-devtools/svelte';
</script>
<div use:mobileDevTools={{
title: 'My App Debugger',
position: 'bottom-right',
shakeToToggle: true,
theme: { mode: 'dark' }
}}>
<YourAppLayout />
</div>Import from mobile-devtools/svelte:
<script>
import { useMobileDevTools } from 'mobile-devtools/svelte';
</script>
<div use:useMobileDevTools={{
title: 'My App Debugger',
position: 'bottom-right',
theme: { mode: 'dark', accentColor: '#0070f3' }
}}>
<YourAppLayout />
</div>Option A: npm Package Import
import { createMobileDevTools } from 'mobile-devtools';
// Instantiate DevTools overlay
const devtools = createMobileDevTools({
title: 'My App Debugger',
position: 'bottom-right',
enabledTabs: ['console', 'elements', 'network', 'storage', 'system'],
theme: {
mode: 'dark',
accentColor: '#0070f3',
},
styles: `.devtools-badge { opacity: 0.9; } .devtools-drawer { max-height: 85vh; }`,
customTabs: [
{
id: 'analytics',
title: 'Analytics',
render: (container) => {
container.innerHTML = '<div style="padding:16px;color:#fff;">π Custom Event Log</div>';
},
},
],
});Option B: Direct CDN / UNPKG Script Tag (Zero Build Step)
<script type="module">
import { createMobileDevTools } from 'https://unpkg.com/mobile-devtools';
// Works out-of-the-box in any static HTML page or legacy app
createMobileDevTools({
title: 'My App Debugger',
position: 'bottom-right',
theme: { mode: 'dark' },
});
</script>Below is the complete reference table for all configuration options supported by <MobileDevTools /> / createMobileDevTools():
| Option / Prop | Type | Default | Description |
|---|---|---|---|
enabled |
boolean |
true (in dev) |
Enable or disable the DevTools overlay. Automatically set to false in production builds. |
forceEnable |
boolean |
false |
Force enable DevTools overlay in production builds for QA testing & staging previews. |
showBadge |
boolean |
true |
Show or hide the floating trigger badge on screen. |
renderBadge |
(container, props) => void |
undefined |
Custom render callback function to craft inner floating badge DOM structure while retaining drag & drop gesture handling. |
defaultOpen |
boolean |
false |
Set to true to open drawer automatically on initial page mount. |
shakeToToggle |
boolean | ShakeToToggleConfig |
true |
Enable physical device shake gesture (shakeToToggle={true}) or customize options (shakeToToggle={{ enabled: true, threshold: 15 }}). |
title |
string |
'DevTools' |
Label shown on floating badge and drawer header. |
icon |
any |
undefined |
Custom icon (Emoji string like 'β‘', SVG markup string, Image URL, or Base64 data URI). |
position |
BadgePositionPreset | BadgePosition |
'bottom-right' |
Initial corner/edge preset ('bottom-right', 'bottom-left', 'top-right', 'top-left', 'bottom', 'top', 'left', 'right') or { x, y } object. |
initialTab |
DevToolsTabId |
'console' |
Default active tab when drawer opens ('console', 'elements', 'network', 'storage', 'system'). |
enabledTabs |
DevToolsTabId[] |
['console', 'elements', 'network', 'storage', 'system'] |
Filter which built-in tabs are enabled in drawer. |
customTabs |
CustomTabDefinition[] |
[] |
Pluggable consumer tabs array with custom DOM rendering callbacks (render(container)). |
autoSnapBadge |
boolean |
false |
Enable magnetic snapping of badge to nearest screen edge on drag release. |
styles |
string |
undefined |
Custom raw CSS string injected into DevTools Shadow DOM root. |
container |
HTMLElement | null |
document.body |
Target parent element for Shadow DOM container mounting. |
privacy.mask |
string[] |
undefined |
Sensitive header & body keys to mask in network inspector (e.g. ['token', 'password']). |
theme.mode |
'dark' | 'light' | 'auto' |
'dark' |
Theme mode setting ('dark', 'light', or 'auto'). |
theme.backgroundColor |
string |
undefined |
Primary drawer & floating badge background color CSS value. |
theme.cardBackgroundColor |
string |
undefined |
Floating cards & list item background color CSS value. |
theme.cardBorderColor |
string |
undefined |
Internal card outline border color CSS value. |
theme.borderColor |
string |
undefined |
Main container & divider line border color CSS value. |
theme.textColor |
string |
undefined |
Primary body text color CSS value. |
theme.textMutedColor |
string |
undefined |
Secondary / muted label text color CSS value. |
theme.accentColor |
string |
undefined |
Primary brand accent color for active tabs, toggles, and highlights. |
theme.errorColor |
string |
undefined |
Error badges & status indicator color CSS value. |
theme.warningColor |
string |
undefined |
Warning badges & status indicator color CSS value. |
theme.successColor |
string |
undefined |
Success status indicator color CSS value. |
theme.fontFamily |
string |
undefined |
Custom font family stack CSS value for all DevTools text inside Shadow DOM. |
interceptors.maxLogLimit |
number |
200 |
Maximum number of console logs retained in memory. |
interceptors.maxNetworkLimit |
number |
100 |
Maximum number of network requests retained in memory. |
interceptors.ignoreNetworkUrls |
(string | RegExp)[] |
[] |
List of URL strings or RegExps to exclude from network interception. |
interceptors.enableConsoleInterceptor |
boolean |
true |
Enable or disable console log/warn/error interception. |
interceptors.enableFetchInterceptor |
boolean |
true |
Enable or disable window.fetch API interception. |
interceptors.enableXhrInterceptor |
boolean |
true |
Enable or disable XMLHttpRequest interception. |
interceptors.enableWebSocketInterceptor |
boolean |
true |
Enable or disable WebSocket frame interception. |
interceptors.enableSSEInterceptor |
boolean |
true |
Enable or disable EventSource (SSE) stream interception. |
mobile-devtools features a built-in theme engine that automatically calculates background brightness to maintain WCAG AAA readable text contrast:
<MobileDevTools
title="Staging Debugger"
icon="π"
position="bottom-left"
theme={{
mode: 'dark',
accentColor: '#10b981',
backgroundColor: '#0c0c0e',
}}
styles={`
.devtools-badge { border-radius: 12px; }
.devtools-drawer { border-top-left-radius: 20px; border-top-right-radius: 20px; }
`}
/>mobile-devtools/
βββ apps/
β βββ web/ # React documentation & live playground app (Port 3000)
βββ examples/
β βββ react/ # React 19 test harness app (Port 3001)
β βββ vue/ # Vue 3 test harness app (Port 3002)
β βββ svelte/ # Svelte 5 test harness app (Port 3003)
β βββ vanilla/ # Vanilla JS test harness app (Port 3004)
βββ packages/
βββ mobile-devtools/ # Main unified published npm package (Core + UI + React/Vue/Svelte/Vanilla Adapters)
βββ config/
βββ eslint/ # Shared ESLint configuration (@mobile-devtools/eslint-config)
βββ typescript/ # Shared TypeScript configuration (@mobile-devtools/tsconfig)
Prerequisites: Node.js >= 24.0.0 (v24.4.1+ recommended), pnpm 9.15.0
To build and run the project locally:
# Clone repository
git clone https://github.com/dewasemadi/mobile-devtools.git
cd mobile-devtools
# Install dependencies using pnpm
pnpm install
# Launch all apps & package watchers in dev mode
pnpm dev
# Run unit test suite (65 tests)
pnpm test
# Run unit tests with V8 coverage report
pnpm test:coverage
# Run Playwright E2E tests (21 tests across Chromium & Mobile Webkit)
pnpm test:e2e
# Build production bundles
pnpm buildDistributed under the MIT License. See LICENSE for details.





