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

@jkt48/core

v7.7.7

Published

Official JKT48 Connect API client for Node.js and browsers

Readme

JKT48 Connect API Client

Official JavaScript client for JKT48 Connect API. Works in Node.js and browsers (including React).

Installation

npm install @jkt48/core

Quick Start

Node.js / CommonJS

const JKT48Client = require('@jkt48/core');

const client = new JKT48Client({
  apiKey: 'YOUR_API_KEY'
});

// Get all members
const members = await client.members.getMembers();
console.log(members);

ES6 Modules

import JKT48Client from '@jkt48/core';

const client = new JKT48Client({
  apiKey: 'YOUR_API_KEY'
});

React

import { useState, useEffect } from 'react';
import JKT48Client from '@jkt48/core';

function App() {
  const [members, setMembers] = useState([]);
  
  useEffect(() => {
    const client = new JKT48Client({
      apiKey: 'YOUR_API_KEY'
    });
    
    client.members.getMembers()
      .then(data => setMembers(data))
      .catch(error => console.error(error));
  }, []);

  return (
    <div>
      {members.map(member => (
        <div key={member.id}>{member.name}</div>
      ))}
    </div>
  );
}

Configuration

Basic Configuration

const client = new JKT48Client({
  apiKey: 'YOUR_API_KEY'
});

With Priority Token

const client = new JKT48Client({
  apiKey: 'YOUR_API_KEY',
  priorityToken: 'P-ABCD1234'
});

With Admin Credentials

const client = new JKT48Client({
  apiKey: 'YOUR_API_KEY',
  adminCredentials: {
    username: 'admin',
    password: 'password'
  }
});

API Reference

Members

// Get all members
await client.members.getMembers();

// Get member detail
await client.members.getMemberDetail('Shani');

// Get birthdays
await client.members.getBirthdays();

Live Streams

// Get all current live streams
await client.live.getLive();

// Get YouTube live streams
await client.live.getYoutubeLive();

// Get IDN live streams
await client.live.getIdnLive();

// Get Showroom live streams
await client.live.getShowroomLive();

// Get recent streams
await client.live.getRecent();

// Get recent stream detail
await client.live.getRecentDetail('live123');

// Get replay streams
await client.live.getReplay();

// Get chat stream
await client.live.getChatStream('username', 'slug');

// Get Showroom chat stream
await client.live.getChatStreamShowroom('roomId');

Events

// Get all events
await client.events.getEvents();

// Get theater schedule
await client.events.getTheater();

// Get theater detail
await client.events.getTheaterDetail('theater123');

// Get video call schedules
await client.events.getVideoCall('sesi1', '2024-01-01', 'Shani');

// Get today's video call schedules
await client.events.getVideoCallToday();

Media

// Get YouTube videos
await client.media.getYoutube();

// Get news articles
await client.media.getNews();

// Get news detail
await client.media.getNewsDetail('news123');

Admin (Requires Admin Credentials)

// Get all API keys
await client.admin.getKeys();

// Get API key detail
await client.admin.getKeyDetail('key123');

// Create new API key
await client.admin.createKey('owner', '[email protected]', 'premium');

// Update API key
await client.admin.updateKey('key123', true, 'premium');

// Delete API key
await client.admin.deleteKey('key123');

// Add limit to API key
await client.admin.addLimit('key123', 1000);

// Add expiry days to API key
await client.admin.addExpiry('key123', 30);

// Get admin statistics
await client.admin.getStats();

Changelog

// Get all changelogs
await client.changelog.getChangelogs();

// Get changelog detail
await client.changelog.getChangelogDetail('changelog123');

// Create new changelog
await client.changelog.createChangelog({ title: 'Update', content: 'New features' });

// Update changelog
await client.changelog.updateChangelog('changelog123', { title: 'Updated' });

// Delete changelog
await client.changelog.deleteChangelog('changelog123');

Grow A Garden

// Get stock information
await client.garden.getStock();

// Get weather information
await client.garden.getWeather();

// Get restock timer
await client.garden.getRestockTimer();

// Get all garden data
await client.garden.getAll();

Utility Methods

// Check API status
await client.check();

// Update API key dynamically
client.setApiKey('NEW_API_KEY');

// Update priority token dynamically
client.setPriorityToken('P-NEWTOKEN');

// Update admin credentials dynamically
client.setAdminCredentials({
  username: 'newadmin',
  password: 'newpassword'
});

React Hooks Example

Create a custom hook for easier usage in React:

import { useState, useEffect } from 'react';
import JKT48Client from '@jkt48/core';

const client = new JKT48Client({
  apiKey: process.env.REACT_APP_JKT48_API_KEY
});

export function useJKT48Members() {
  const [members, setMembers] = useState([]);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState(null);

  useEffect(() => {
    client.members.getMembers()
      .then(data => {
        setMembers(data);
        setLoading(false);
      })
      .catch(err => {
        setError(err.message);
        setLoading(false);
      });
  }, []);

  return { members, loading, error };
}

// Usage in component
function MembersList() {
  const { members, loading, error } = useJKT48Members();

  if (loading) return <div>Loading...</div>;
  if (error) return <div>Error: {error}</div>;

  return (
    <div>
      {members.map(member => (
        <div key={member.id}>{member.name}</div>
      ))}
    </div>
  );
}

Error Handling

try {
  const members = await client.members.getMembers();
  console.log(members);
} catch (error) {
  console.error('API Error:', error.message);
}

Priority Token Usage

Priority tokens give your requests higher priority. You can add them in three ways:

  1. In client initialization (recommended):
const client = new JKT48Client({
  apiKey: 'YOUR_API_KEY',
  priorityToken: 'P-ABCD1234'
});
  1. Update dynamically:
client.setPriorityToken('P-ABCD1234');

The library automatically adds the priority token to:

  • Request headers as x-priority-token
  • Query parameters as priority_token
  • Request body as priority_token

License

MIT

Official API Documentation

https://docs.jkt48connect.com