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

maxun-sdk

v0.0.15

Published

Maxun Node SDK for web scraping and data extraction

Readme

Maxun Node.js SDK

The Maxun Node.js SDK turns websites and documents into structured data from your JavaScript or TypeScript code. You create robots (saved, reusable jobs) and run them whenever you need fresh data.

import { Maxun } from 'maxun-sdk';

const maxun = new Maxun({ apiKey: 'your-api-key' });

const robot = await maxun.scrape('Maxun home', 'https://maxun.dev', { formats: ['markdown'] });
const result = await robot.run();

console.log(result.markdown);

Installation

npm install maxun-sdk

Requirements

  • Node.js 18 or later
  • A Maxun Cloud account or a self-hosted Maxun instance
  • An API key from the Maxun Dashboard

Configuration

Pass your API key directly:

import { Maxun } from 'maxun-sdk';

const maxun = new Maxun({ apiKey: 'your-api-key' });

Or set it in the environment and create new Maxun() with no arguments:

MAXUN_API_KEY=your-api-key
MAXUN_TEAM_ID=your-team-uuid                      # optional, Maxun Cloud teams
MAXUN_BASE_URL=http://localhost:8080/api/sdk/     # only for self-hosted Maxun
import 'dotenv/config';   // only needed if your variables are in a .env file
import { Maxun } from 'maxun-sdk';

const maxun = new Maxun();

The SDK connects to Maxun Cloud by default. For a self-hosted instance, set MAXUN_BASE_URL or pass baseUrl:

const maxun = new Maxun({ apiKey: 'your-api-key', baseUrl: 'http://localhost:8080/api/sdk/' });

Everything starts from maxun

Each call takes the robot name first, then what to work on (a URL, a search query or a file), then an optional options object. It returns a Robot saved on your account.

| Call | What the robot does | Read the result from | |---|---|---| | maxun.scrape(name, url) | Turns a page into Markdown, HTML, text, links, a summary or screenshots | result.markdown, result.html, ... | | maxun.extract(name, url, { prompt }) | Extracts structured data, described in plain English or with selectors | result.listData, result.textData | | maxun.crawl(name, url) | Visits many pages of a website | result.crawlData | | maxun.search(name, query) | Searches the web and optionally scrapes the results | result.searchData | | maxun.documents.extract(name, file, prompt) | Extracts data from a PDF, DOCX, XLSX, CSV, JPG or PNG | result.documentData | | maxun.documents.parse(name, file) | Converts a document to Markdown, HTML, links or a summary | result.markdown, ... | | maxun.robots | Lists, finds and deletes robots of any type | |

The name is required. It is how the robot appears in the Maxun dashboard. Unknown options throw an error instead of being silently ignored.

TypeScript

The SDK is written in TypeScript and ships its own types. Options, results and errors are all typed:

import { Maxun, Robot, RunResult } from 'maxun-sdk';

const maxun = new Maxun();
const robot: Robot = await maxun.scrape('Example', 'https://example.com');
const result: RunResult = await robot.run();

Errors

Every API error is a MaxunError with statusCode and details. More specific errors:

| Error | When | |---|---| | AuthenticationError | The API key is missing or invalid | | NotFoundError | The robot or run does not exist | | ConflictError | A robot with that name already exists with different settings | | ValidationError | Maxun rejected the input | | RunFailedError | A run failed or was aborted |

import { ConflictError, MaxunError } from 'maxun-sdk';

let robot;
try {
  robot = await maxun.scrape('Pricing page', 'https://example.com/pricing');
} catch (error) {
  if (error instanceof ConflictError) {
    robot = await maxun.robots.find('Pricing page');
  } else if (error instanceof MaxunError) {
    console.error(error.statusCode, error.message);
  } else {
    throw error;
  }
}

What's next