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 🙏

© 2025 – Pkg Stats / Ryan Hefner

confluence.js

v2.1.0

Published

confluence.js is a powerful Node.JS/Browser module that allows you to interact with the Confluence API very easily

Readme

JavaScript/TypeScript library for Node.js and browsers to interact with Atlassian Confluence API

About

Confluence.js is a powerful Node.js and browser-compatible module that provides seamless interaction with:

Designed for developer experience and performance, it offers full API coverage and stays updated with new Confluence features.

Table of Contents

Getting Started

Installation

Requires Node.js 20.0.0 or newer

# npm
npm install confluence.js

# yarn
yarn add confluence.js

# pnpm
pnpm add confluence.js

Quick Example

Create a Confluence space in 3 steps:

import { ConfluenceClient } from 'confluence.js';

const client = new ConfluenceClient({
  host: 'https://your-domain.atlassian.net',
  authentication: {
    basic: {
      email: '[email protected]',
      apiToken: 'YOUR_API_TOKEN', // Create one: https://id.atlassian.com/manage-profile/security/api-tokens
    },
  },
});

async function createSpace() {
  const space = await client.space.createSpace({
    name: 'Project Galaxy',
    key: 'GALAXY',
  });
  console.log(`Space created: ${space.key}`);
}

createSpace();

Documentation

Full API reference and guides available at: https://mrrefactoring.github.io/confluence.js/

Usage

Authentication

Basic Authentication

  1. Create an API token: Atlassian Account Settings
  2. Configure the client:
const client = new ConfluenceClient({
  host: 'https://your-domain.atlassian.net',
  authentication: {
    basic: {
      email: '[email protected]',
      apiToken: 'YOUR_API_TOKEN',
    },
  },
});

OAuth 2.0

Implement OAuth 2.0 flow using Atlassian's documentation:

const client = new ConfluenceClient({
  host: 'https://your-domain.atlassian.net',
  authentication: {
    oauth2: {
      accessToken: 'YOUR_ACCESS_TOKEN',
    },
  },
});

JWT

For server-to-server integration:

const client = new ConfluenceClient({
  host: 'https://your-domain.atlassian.net',
  authentication: {
    jwt: {
      issuer: 'your-client-id',
      secret: 'your-secret-key',
      expiryTimeSeconds: 180,
    },
  },
});

First Request

Create a page in an existing space:

const page = await client.content.createContent({
  title: 'Project Overview',
  type: 'page',
  space: { key: 'GALAXY' },
  body: {
    storage: {
      value: '<p>Welcome to our project documentation</p>',
      representation: 'storage',
    },
  },
});

console.log(`Page created: ${page.title}`);

API Structure

Access endpoints using client.<group>.<method> pattern:

// Get space details
const space = await client.space.getSpace({ spaceKey: 'GALAXY' });

// Search content
const results = await client.search.search({ cql: 'title~"Project"' });

Custom API Prefix

For custom API endpoints:

const client = new ConfluenceClient({
  host: 'https://custom-domain.com',
  apiPrefix: '/confluence-api', // Default: '/wiki/rest/api'
});

Tree Shaking

Optimize bundle size by importing only needed modules:

// custom-client.ts
import { BaseClient } from 'confluence.js';
import { Content } from 'confluence.js/api/content';
import { Space } from 'confluence.js/api/space';

export class CustomClient extends BaseClient {
  content = new Content(this);
  space = new Space(this);
}

// Usage
const client = new CustomClient({ /* config */ });
await client.space.getSpace({ spaceKey: 'GALAXY' });

Other Products

Explore our other Atlassian integration libraries:

License

MIT License © MrRefactoring See LICENSE for details.