npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nextjs-mobile-dev-console

v1.1.4

Published

A mobile-friendly debugging console for Next.js applications that logs to terminal and files when browser dev tools aren't accessible

Readme

NextJS-Mobile-Dev-Console

Version: 1.1.4

Table of Contents


Why This Exists

My laptop died, and getting a new one wasn’t in my choice, so picked up my Samsung S25, connected it with the screen (used Samsung DeX), logged myself inside GitHub Codespaces, and started coding. Saw DevTools and Inspect aren’t supported in mobile phone browsers, therefore built this package so I can simply see the logs inside the terminal or files. As simply seeing logs can help me debug and code. :)

This package itself is a proof, that the setup is reliable and works.

Installation

npm install nextjs-mobile-dev-console

Or with yarn:

yarn add nextjs-mobile-dev-console

Or with pnpm:

pnpm add nextjs-mobile-dev-console

Quick Start

Use anywhere in your app

import { debug } from "nextjs-mobile-dev-console";

debug.terminal("Hello from Next.js!");
debug.file("User logged in:", userData);
import { useDebug } from "nextjs-mobile-dev-console"; // use hook only at rendering phase

function Component() {
  const log = useDebug();
  
  // Safe during render - logs after mount
  log.terminal("Component rendered");
  log.file("Props:", props);
  
  return <div>Hello</div>;
}

Tested On:

Next.js 14.2.6 and 15.x, might not work with other libraries\frameworks and versions.


Usage

Raw Functions (debug.terminal / debug.file)

Use these everywhere except during the component rendering phase:

import { debug } from "nextjs-mobile-dev-console";

// Event handlers
onClick={() => debug.terminal("Button clicked")}

// useEffect
useEffect(() => {
  debug.terminal("Component mounted");
  debug.file("User data:", userData);
}, []);

// API calls
async function fetchData() {
  debug.terminal("Fetching data...");
  const data = await fetch("/api/data");
  debug.file("Response:", data);
}

// Server actions
export async function handleSubmit(formData) {
  debug.terminal("Form submitted");
  debug.file("Form data:", formData);
}

// NOT during render
function Component() {
  debug.terminal("Rendering..."); // This will cause hydration errors!
  return <div>Hello</div>;
}

Hook (useDebug)

Use the hook only for rendering phase logging to avoid hydration errors:

import { useDebug } from "nextjs-mobile-dev-console";

function Component() {
  const log = useDebug();
  
  // Safe during render - logs after mount
  log.terminal("Component rendered");
  log.file("Props:", props);
  
  return <div>Hello</div>;
}

See more examples, best practices, and troubleshooting →

Configuration

Option 1: Use initDebug() (Recommended)

Initialize once at app startup to customize behavior:

// app/layout.js or pages/_app.js
import { initDebug } from "nextjs-mobile-dev-console";

initDebug({
  allowDuplicates: false,        // false = prevent duplicate logs (default: false)
  cacheExpiryMs: 5000,           // How long to remember logs in ms (default: 3000)
  debounceDelayMs: 1500,         // Batch delay before processing in ms (default: 1000)
  allowHmrDuplicates: true,      // Allow duplicates on HMR remounts (default: false)
  logFilePath: "./custom/path/logs.json",  // Custom log file path (default: ./debug-logs/logs.json)
  timezone: "Asia/Kolkata"   // Timezone for timestamps (default: system timezone)
});

All options are optional - omit any to use defaults.

Option 2: Environment Variables

Set LOG_FILE_PATH in your .env file:

# .env.local
LOG_FILE_PATH=./custom/path/logs.json

Common Timezones

By default, timestamps use your server's timezone. If your server is in a different timezone than you, specify it in initDebug():

initDebug({
  timezone: "Asia/Kolkata"      // India
  // timezone: "America/New_York"  // US Eastern
  // timezone: "America/Los_Angeles"  // US Pacific
  // timezone: "Europe/London"     // UK
  // timezone: "Asia/Tokyo"        // Japan
  // timezone: "Australia/Sydney"  // Australia
});

Full list of timezones →


Output: Logs appear in terminal with [BROWSER]: prefix and are saved to debug-logs/logs.json with timestamps and IDs.