/paracord

NodeJS Discord API framework built to scale

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Paracord

Table of Contents


About

A highly-scalable NodeJS framework built to interact with Discord's API.

Paracord addresses an important problem that large bot owners will inevitably encounter, how to avoid the exponential costs of vertically scaling infrastructure in the cloud while maintaining high reliability and availability. Paracord solves this by utilizing clients and servers running grpc to support limited interprocess communication between shards on remote hosts. Bots of all sizes can use this framework to get started and seamlessly transition to multi-shard and eventually multi-host configurations with the addition of just a few lines of code.

NOT YET READY FOR PRODUCTION. If you choose to use the modules in this library, understand that nothing here is set in stone and breaking changes may occur without warning.


Features

  • Native horizontal scaling
  • Internal sharding
  • Fast and efficient inter-host communication with grpc
  • Leverages pm2 for additional shard separation and log management
  • Modularized REST and Gateway clients
  • Optional remote rate limit handling
  • Limited abstractions, work closer to the API

Getting started

Requirements

Paracord requires NodeJS 10.17+.

If you plan to use the Shard Launcher, a global installation of pm2 is required. This is not true for internal sharding. To install pm2 globally, run the following command:

npm install pm2 -g

Installing

Getting started with any of the clients is as simple as installing the package into your project and importing the client you want.

npm install paracord

Optional Dependencies

Optional dependencies should be installed with the package. However, if you choose to not install them then here is what to know.

For sharding, the pm2 npm package will need to be installed to your project:

npm install pm2

If you plan to use the rpc services, you will need to install the grpc packages in the command below:

npm install grpc@1.24.2 @grpc/grpc-js@0.6.15 @grpc/proto-loader@0.5.3

Examples

Importing a client into your project is easy.

// This is an example. You can find more in the examples directory of this repo.
const { Paracord } = require("paracord");

The available clients are Paracord, Api, Gateway, ShardLauncher, and Server. In a generalized bot scenario, you will be using the Paracord client.

Examples with each client can be found in docs/examples.


Missing Features

At the moment, Paracord is missing some functionality that is common in Discord frameworks. they are listed here:

  • Voice handling
  • Connection compression

Contributing

Right now there is no formal process for contributing. If you wish to start making contributions, please reach out to me, Lando#7777, first. You can find me in the Paracord Discord.


Licensing

The code in this project is licensed under the Apache 2.0 license.


Links