ralphi - logo


Pure Node.js simple rate limiting server to prevent bruteforce attacks

This project is maintained by yonjah

Ralphi Client

Client for ralphi pure Node.js rate limiting server

npm version Build Status codecov Known Vulnerabilities License

Ralphi is a simple rate limiting server intended to prevent bruteforce attacks on logins and other sensitive assets.

For more info about Ralphi other components see ralphi

Client Installation

$ npm install -s ralphi-client


const host = 'localhost';
const port = 8910;
const RalphiClient = require('ralphi-client');
const client = new RalphiClient({port, host});

async function handler (req, res) { //in your handler code
    const limit = await client.take('login', req.ip);
    if (limit.conformant) {
        //allow access
        return `Request was done. You have ${limit.remaining} more requests until ${new Date(limit.ttl * 1000)}`;
    } else {
        //reject access
        throw new Error(`You have made too many requests. You can send ${limit.size} requests after ${new Date(limit.ttl * 1000)}`);

Config options


Ralphi Client is using a Promise API all methods return Promises