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

@vijayhardaha/next-indexnow

v1.0.0

Published

CLI tool to submit Next.js sitemaps to the IndexNow API for faster search engine indexing

Readme

@vijayhardaha/next-indexnow

CLI tool to validate a Next.js project and submit sitemap URLs to the IndexNow API for faster search engine indexing.

Problem: You have a Next.js site with a generated sitemap, but search engines take time to discover and index your new or updated pages.

Solution: next-indexnow validates your project environment, reads the sitemap XML, extracts all URLs, and submits them to the IndexNow API in batches — instantly notifying search engines about your content changes.

Install

npm install @vijayhardaha/next-indexnow
# or
bun add @vijayhardaha/next-indexnow

Usage

# Run from your Next.js project root — auto-detects settings from next-sitemap.config
npx next-indexnow

# Override the site URL
npx next-indexnow --site-url https://example.com

# Provide IndexNow API key
npx next-indexnow --key my-api-key

# Use a custom sitemap path
npx next-indexnow --sitemap ./public/sitemap.xml

# Preview URLs without submitting
npx next-indexnow --dry-run

The tool reads your sitemap, parses the URLs, and submits them to https://api.indexnow.org/indexnow in chunks.

CLI Output

██╗███╗   ██╗██████╗ ███████╗██╗  ██╗███╗   ██╗ ██████╗ ██╗    ██╗
██║████╗  ██║██╔══██╗██╔════╝╚██╗██╔╝████╗  ██║██╔═══██╗██║    ██║
██║██╔██╗ ██║██║  ██║█████╗   ╚███╔╝ ██╔██╗ ██║██║   ██║██║ █╗ ██║
██║██║╚██╗██║██║  ██║██╔══╝   ██╔██╗ ██║╚██╗██║██║   ██║██║███╗██║
██║██║ ╚████║██████╔╝███████╗██╔╝ ██╗██║ ╚████║╚██████╔╝╚███╔███╔╝
╚═╝╚═╝  ╚═══╝╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═══╝ ╚═════╝  ╚══╝╚══╝

=====================================================================
next-indexnow: v0.0.1
=====================================================================

✔ Next.js config found
✔ Build directory exists (.next)
✔ Sitemap config found: ./next-sitemap.config.js
✔ Site URL resolved: example.com
✔ API key resolved: using built-in default key
✔ Key verification file: 91c8...txt created
✔ Sitemap loaded: 10 URLs found

=====================================================================
✔ Submission Completed 🎉
=====================================================================

✔ URLs found: 10
✔ URLs submitted: 10
✔ URLs failed: 0
✔ Duration: 1.23s

All 10 urls submitted to IndexNow successfully! 🥳

Options

| Option | Description | | ----------------------- | --------------------------------------------------------------------------------- | | --site-url <url> | Site URL (e.g. https://example.com). Overrides config value | | --key <key> | IndexNow API key. Falls back to INDEXNOW_KEY env variable or a built-in default | | --sitemap <path> | Path to the sitemap XML file | | --chunk-size <number> | URLs per submission batch (default: 100) | | -d, --dry-run | Preview URLs without submitting to the IndexNow API | | -h, --help | Show help | | --version | Show version |

How It Works

  1. Validates your Next.js project (next.config.* must exist)
  2. Checks the .next build directory exists and is not empty
  3. Reads next-sitemap.config.* to extract siteUrl and outDir
  4. Resolves the API key from CLI option, INDEXNOW_KEY env variable, or a built-in default key
  5. Creates the IndexNow verification file at public/<key>.txt
  6. Parses all <loc> URLs from the sitemap XML
  7. Submits URLs in batches (default 100) to the IndexNow API
  8. Reports results with per-chunk success/failure details

Environment Variables

| Variable | Description | | -------------- | ------------------------------------------------------------ | | INDEXNOW_KEY | IndexNow API key (optional — falls back to built-in default) |

Programmatic API

import { run } from "@vijayhardaha/next-indexnow";

const result = await run({
  siteUrl: "https://example.com",
  key: "my-api-key",
  dryRun: true // preview only
});

console.log(`Found ${result.urlsFound} URLs`);

NextIndexnowOptions

| Option | Type | Default | Description | | ----------- | --------- | ---------------- | --------------------------- | | siteUrl | string | — | Site URL (overrides config) | | key | string | built-in default | IndexNow API key | | sitemap | string | — | Custom sitemap path | | chunkSize | number | 100 | URLs per submission batch | | dryRun | boolean | false | Preview without submitting |

NextIndexnowResult

interface NextIndexnowResult {
  urlsFound: number; // Total URLs extracted from sitemap
  urlsSubmitted: number; // Successfully submitted URLs
  urlsFailed: number; // URLs that failed to submit
  chunks: SubmissionResult[];
  durationMs: number;
}

Configuration

The tool reads your next-sitemap.config.* file to extract siteUrl and outDir. It supports both inline string literals and variable references:

// next-sitemap.config.js — variable reference style
const siteDomain = "https://example.com";

/** @type {import('next-sitemap').IConfig} */
const config = { siteUrl: siteDomain, outDir: "./public" };

module.exports = config;

CLI --site-url option always takes precedence over the config file value.

License

MIT © Vijay Hardaha