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

game-server-status

v0.0.4

Published

Check the status of game servers (Minecraft, FiveM)

Downloads

18

Readme

Game Server Status Checker

A powerful and efficient Node.js package to check the online status of popular game servers like Minecraft, FiveM, CS:GO, and Rust. This package provides easy-to-use functions to monitor the health of your game servers, cache the results for faster performance, and handle multiple servers at once.

Features

  • Support for multiple games: Monitor servers for Minecraft Java, FiveM, CS:GO, and Rust.
  • Caching: Automatically caches server status for 5 minutes to reduce the number of requests.
  • Customizable options: You can select specific data to return (e.g., number of players) and define return types.
  • Force update: Option to force a fresh status check and bypass cache.
  • Interval monitoring: Check server status on a cyclical basis at a set interval.

Installation

To install the package, use npm:

npm install game-server-status

Usage

1. Check a Single Server Status

To check the status of a single server, use the getServerStatus function. Provide the game, IP address, and port.

const { getServerStatus } = require('game-server-status');

(async () => {
    const serverStatus = await getServerStatus('minecraft', '127.0.0.1', 25565);
    console.log(serverStatus);
})();

This function will return a structured object with the server status, players online, server name, version, and ping.

2. Check Multiple Servers

You can also check the status of multiple servers at once using checkMultipleServers.

const { checkMultipleServers } = require('game-server-status-checker');

const servers = [
    { game: 'minecraft', ip: '127.0.0.1', port: 25565 },
    { game: 'fivem', ip: '127.0.0.1', port: 30120 },
    { game: 'csgo', ip: '127.0.0.1', port: 27015 },
];

(async () => {
    const results = await checkMultipleServers(servers);
    console.log(results);
})();

This will return an array of server statuses for all the specified servers.

3. Cyclical Server Status Check

If you want to continuously monitor a server, you can use pingServerCyclically.

const { pingServerCyclically } = require('game-server-status-checker');

pingServerCyclically('minecraft', '127.0.0.1', 25565, 60000, (status) => {
    console.log('Server status:', status);
});

This will check the server status every 60 seconds and call the provided callback with the status.

Options

  • force: If set to true, the cache will be bypassed, and the server status will be fetched anew.
  • select: An array of keys to filter the response and return only selected data.
  • returnType: A specific field to return, such as the number of players or ping.

Example with options:

const status = await getServerStatus('minecraft', '127.0.0.1', 25565, {
    force: true, 
    select: ['players', 'ping'],
});
console.log(status);

Supported Games

  • Minecraft Java
  • FiveM
  • CS:GO
  • Rust

Caching

By default, the status of each server is cached for 5 minutes. If the same request is made within that time frame, the cached result is returned. To force a fresh request, set force: true.

Debugging

If you want to enable debug logging, set the DEBUG environment variable to true before running the script:

DEBUG=true node yourscript.js

Example Response

For a Minecraft Java server, the response may look like this:

{
    "online": true,
    "message": "Server is online",
    "game": "Minecraft Java",
    "players": "12/20",
    "ping": 50,
    "serverName": "Minecraft Server",
    "version": "1.16.4"
}

For a FiveM server:

{
    "online": true,
    "data": { ... },
    "game": "FiveM",
    "players": 24,
    "maxPlayers": 32,
    "version": "1.0.0",
    "serverName": "FiveM Server",
    "ping": 40
}

License

This project is licensed under the MIT License.

Contributions

<<<<<<< HEAD Contributions are welcome! If you find any bugs or want to suggest a feature, feel free to open an issue or submit a pull request.

Contributions are welcome! If you find any bugs or want to suggest a feature, feel free to open an issue or submit a pull request.

0bd3d9f84910b024b69284b2be485988f41d0e6b