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

@akaanakbaik/pterodactyl-gateway

v1.0.3

Published

Full-featured TypeScript SDK untuk Pterodactyl Panel. Fokus pada kemudahan integrasi untuk developer membangun dashboard, bot, dan sistem otomasi panel yang kompleks.

Readme

Akadev Pterodactyl Gateway

NPM Version License Node Version NPM Downloads

SDK TypeScript & JavaScript Modern untuk Pterodactyl Panel dengan fitur Auto-Deployment, WebSocket Auto-Reconnect, Ekspor Backup Otomatis ke Email, dan Fluent Schedule Builder.

npm · GitHub


1. Inisialisasi & Diagnostik

Memulai koneksi ke Pterodactyl Panel menggunakan domain, Application API Key (PTLA) untuk tindakan admin, dan Client API Key (PTLC) untuk tindakan pengguna.

import { createPtero } from "@akaanakbaik/pterodactyl-gateway";

const ptero = createPtero({
  domain: "panel.example.com",
  ptla: "ptla_your_application_key",
  ptlc: "ptlc_your_client_key",
  debug: true
});

Cek Koneksi (Laten & Mode)

const conn = await ptero.connect();
console.log(conn.ok, conn.mode, conn.latency);

Analisis Doctor (Pengecekan Izin API)

const report = await ptero.doctor();
console.log(report.ok, report.checks);

2. Manajemen Pengguna (User Management)

Melakukan operasi CRUD penuh pada akun admin/pengguna panel.

Buat User Baru (Smart Get or Create)

const user = await ptero.smart.users.getOrCreate({
  username: "customer_akadev",
  email: "[email protected]",
  password: "auto",
  administrator: false
});
console.log(user.id, user.username, user.email);

Buat User Baru (Raw)

const newUser = await ptero.application.users.create({
  username: "user_baru",
  email: "[email protected]",
  password: "PasswordRahasia123!",
  root_admin: false,
  first_name: "User",
  last_name: "Baru"
});
console.log(newUser);

Ambil Daftar User (Pagination)

const list = await ptero.application.users.list(1);
console.log(list.data);

Detail User Spesifik

const userDetail = await ptero.application.users.get(1);
console.log(userDetail.attributes.username);

Cari User Berdasarkan Email

const foundUser = await ptero.application.users.find("[email protected]");
console.log(foundUser);

Update Data User

const updated = await ptero.application.users.update(1, {
  username: "user_diupdate",
  email: "[email protected]",
  first_name: "Nama",
  last_name: "Baru"
});
console.log(updated);

Hapus User

await ptero.application.users.delete(1);

3. Manajemen Lokasi & Node

Melihat lokasi wilayah dan mengelola node/alokasi port server Pterodactyl.

List & Detail Lokasi

const locations = await ptero.application.locations.list();
console.log(locations.data);

const location = await ptero.application.locations.get(1);
console.log(location);

List & Detail Node

const nodes = await ptero.application.nodes.list();
console.log(nodes.data);

const node = await ptero.application.nodes.get(1);
console.log(node.attributes.name);

const nodeConfig = await ptero.application.nodes.config(1);
console.log(nodeConfig);

Manajemen Alokasi Port Node

const allocations = await ptero.application.nodes.allocations.list(1);
console.log(allocations.data);

await ptero.application.nodes.allocations.create(1, {
  ip: "192.168.1.100",
  ports: ["25565", "25566"]
});

await ptero.application.nodes.allocations.delete(1, 100);

4. Manajemen Nest & Egg

Membaca struktur Nest (kategori) dan Egg (konfigurasi startup server).

List & Detail Nest

const nests = await ptero.application.nests.list();
console.log(nests.data);

const nest = await ptero.application.nests.get(5);
console.log(nest.attributes.name);

const nestByName = await ptero.application.nests.find("nodejs");
console.log(nestByName.id);

List & Detail Egg

const eggs = await ptero.application.nests.eggs.list(5);
console.log(eggs.data);

const egg = await ptero.application.nests.eggs.get(5, 15);
console.log(egg.attributes.name);

const eggByName = await ptero.application.nests.eggs.find(5, "Egg Bot Wa");
console.log(eggByName.id);

5. Manajemen Server (Administrasi & Deployment)

Mendeploy server baru secara otomatis, mengubah spesifikasi, pemilik, dan nest/egg.

Smart Server Preview (Uji Payload Sebelum Deploy)

const preview = await ptero.smart.servers.preview({
  name: "Server Uji Coba",
  description: "Server test deploy",
  email: "[email protected]",
  autoCreateUser: true,
  nodeId: 1,
  nestId: 5,
  eggId: 15,
  preset: "mini"
});
console.log(preview.payload, preview.allocation);

Deploy Server Baru

const server = await ptero.smart.servers.create({
  name: "Server Game Akadev",
  description: "Dibuat otomatis oleh SDK",
  email: "[email protected]",
  autoCreateUser: true,
  nodeId: 1,
  nestId: 5,
  eggId: 15,
  preset: "standard",
  startOnCompletion: true
});
console.log(server.id, server.identifier);

Ambil Detail Lengkap Server Admin

const details = await ptero.getServerDetails(18);
console.log(details.name, details.nodeName, details.userEmail);

Update Spesifikasi / Limits Server

await ptero.smart.servers.updateSpecs(18, {
  memory: "4GB",
  disk: "10GB",
  cpu: "200%",
  databases: 2,
  backups: 2,
  allocations: 1
});

Pindahkan Kepemilikan Server

await ptero.smart.servers.changeOwnership(18, {
  userId: 2
});

Ubah Nest & Egg Server

await ptero.smart.servers.changeNestEgg(18, {
  nestId: 5,
  eggId: 15,
  dockerImage: "ghcr.io/parkervcp/yolks:nodejs_22",
  startup: "npm start"
});

Kontrol Status Server (Admin)

await ptero.application.servers.suspend(18);
await ptero.application.servers.unsuspend(18);
await ptero.application.servers.reinstall(18);

Hapus Server (Permanen & Paksa)

await ptero.application.servers.delete(18, true);

Operasi Batch (Multi Server)

await ptero.batchServerOperation([18, 19, 20], "suspend");
await ptero.batchServerOperation([18, 19, 20], "unsuspend");
await ptero.batchServerOperation([18, 19, 20], "delete", { force: true });

6. Kontrol Client Server

Interaksi pengguna akhir dengan server (Client API).

const server = ptero.server("ca7b58fd");

Sinyal Power Server

await server.power("start");
await server.power("stop");
await server.power("restart");
await server.power("kill");

Kirim Perintah ke Konsol

await server.command("say Halo Dunia!");

Ambil Penggunaan Resource Live

const res = await server.resources();
console.log(res.attributes.state, res.attributes.resources.cpu_absolute);

7. Pengelola File Server (Client File Manager)

Mengelola file dan direktori di dalam kontainer server game/bot.

Tulis & Baca File

await server.files.write("/index.js", "console.log('Akadev Gateway');");

const data = await server.files.read("/index.js");
console.log(data);

List File & Folder

const list = await server.files.list("/");
console.log(list.data);

Buat Folder Baru

await server.files.mkdir("/", "dist");

Ganti Nama / Pindahkan File

await server.files.rename("/", [
  { from: "index.js", to: "main.js" }
]);

Kompres & Dekompres

await server.files.compress("/", ["main.js", "dist"]);
await server.files.decompress("/", "main.js.tar.gz");

Hapus File / Folder

await server.files.delete("/", ["main.js", "dist", "main.js.tar.gz"]);

Operasi File JSON Praktis

await server.files.json.write("/config.json", { port: 3000, debug: false });

const config = await server.files.json.read("/config.json");
console.log(config);

8. Pengelola Port & Jaringan Server

Mengelola alokasi alamat port pada server.

List Port Terpilih

const net = await server.network.list();
console.log(net.data);

Alokasikan Port Tambahan

await server.network.assign();

Set Note / Catatan Port

await server.network.setNote(21, "Port untuk bot whatsapp");

Set Port Utama (Primary Allocation)

await server.network.setPrimary(21);

Hapus Alokasi Port Tambahan

await server.network.delete(21);

9. Pengelola Database Server

Mengelola database MySQL server.

List Database Server

const dbs = await server.databases.list();
console.log(dbs.data);

Buat Database Baru

const db = await server.databases.create("game_db");
console.log(db.attributes.id, db.attributes.relationships.password);

Ganti Password Database

await server.databases.rotatePassword("db_id_xxx");

Hapus Database

await server.databases.delete("db_id_xxx");

10. Pengelola Backup Server

Membuat dan memulihkan file pencadangan.

List Backup Server

const backups = await server.backups.list();
console.log(backups.data);

Buat Backup Baru (Dengan Auto-Filter Opsional)

const backup = await server.backups.create("backup_clean", "node_modules\nvendor\ntmp");
console.log(backup.attributes.uuid);

Detail Backup

const backupDetail = await server.backups.get("backup_uuid_xxx");
console.log(backupDetail.attributes.bytes);

Dapatkan Link Download Backup

const downloadLink = await server.backups.download("backup_uuid_xxx");
console.log(downloadLink.attributes.url);

Hapus Backup

await server.backups.delete("backup_uuid_xxx");

11. WebSocket Real-time Stream

Mendengarkan event status server, log konsol, dan penggunaan memori/CPU secara real-time. Dilengkapi mekanisme auto-reconnect dan auto token-refresh jika sambungan terputus.

const ws = server.websocket.create();

ws.onConsole((log) => {
  console.log("Console:", log);
});

ws.onStats((stats) => {
  console.log("RAM:", stats.memory_bytes, "CPU:", stats.cpu_absolute);
});

ws.onStatus((status) => {
  console.log("Status:", status);
});

await ws.connect();

12. Fluent Schedule Builder

Membuat jadwal tugas terjadwal (Cron Job) bawaan panel menggunakan struktur builder terantai.

const schedule = server.createScheduleBuilder()
  .setName("Pembersihan Mingguan")
  .setCron("0 0 * * 0")
  .setOnlyWhenOnline(true)
  .addTask("command", "say Server membersihkan data cache...", 0, true)
  .addTask("command", "npm run clean", 10, false)
  .addTask("backup", "", 30, false);

await schedule.save();

13. SMTP Email & Auto Backup Exporter (.zip)

Mengirim email pemberitahuan ke pelanggan dan melakukan pencadangan zip otomatis secara eksternal. Secara otomatis membaca konfigurasi SMTP Host, Port, Username, Password, dan Pengirim dari file /var/www/pterodactyl/.env di server panel Anda.

Kirim Email Tertarget ke Pengguna

await ptero.email.sendToUser(1, {
  subject: "Pengumuman Pembayaran Server",
  html: "<h2>Halo</h2><p>Server Anda akan segera jatuh tempo dalam 3 hari.</p>",
  attachments: [
    {
      filename: "invoice.pdf",
      path: "/tmp/invoice.pdf"
    }
  ]
});

Kirim Email Broadcast Massal ke Seluruh Pengguna

await ptero.email.broadcast({
  subject: "Pemeliharaan Node Server Indonesia",
  html: "<h3>Pemberitahuan Sistem</h3><p>Node ID 1 akan dimatikan sementara untuk pemeliharaan RAM.</p>"
});

Auto Backup Exporter via Email (.zip)

Secara otomatis membuat backup di panel dengan menyaring folder-folder berat (node_modules, vendor, cache, tmp, temp, .git), mengunduh file hasil backup, mengompres ulangnya ke ekstensi .zip, mengirimkannya langsung ke email pemilik server, dan menghapus sisa file backup di panel.

await ptero.exportAndEmailBackup(18);

Backup Massal Pengguna

await ptero.backupAndEmailUserServers(1);

Keamanan & Penggunaan Terbuka

  • Simpan kredensial Anda di environment variables (PTERO_DOMAIN, PTERO_PTLA, PTERO_PTLC).
  • Gunakan PteroGateway.fromEnv() untuk pemanggilan otomatis dari konfigurasi environment variables.
  • SDK ini dipastikan bebas dari baris komentar di seluruh source kodenya.

Dibuat dengan ❤️ oleh akaanakbaik