{"id":13912672,"url":"https://github.com/mlomb/redis-rank","last_synced_at":"2025-04-14T00:26:23.460Z","repository":{"id":36188170,"uuid":"222138219","full_name":"mlomb/redis-rank","owner":"mlomb","description":"Manage real-time leaderboards using Redis","archived":false,"fork":false,"pushed_at":"2023-08-18T19:44:52.000Z","size":170,"stargazers_count":53,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-03-14T19:04:46.259Z","etag":null,"topics":["ioredis","leaderboard","leaderboard-matrix","periodic-leaderboards","promises","recurring-leaderboards","redis","redis-rank","scoreboard","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlomb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-11-16T17:55:25.000Z","updated_at":"2024-03-10T13:37:43.000Z","dependencies_parsed_at":"2024-01-14T08:48:09.341Z","dependency_job_id":"2e79c413-6b81-4ab3-93e9-0f20e7defef1","html_url":"https://github.com/mlomb/redis-rank","commit_stats":{"total_commits":153,"total_committers":4,"mean_commits":38.25,"dds":"0.37254901960784315","last_synced_commit":"dc97710cd3767c7305055aeac3529eed230f0359"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlomb%2Fredis-rank","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlomb%2Fredis-rank/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlomb%2Fredis-rank/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlomb%2Fredis-rank/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlomb","download_url":"https://codeload.github.com/mlomb/redis-rank/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248800112,"owners_count":21163404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ioredis","leaderboard","leaderboard-matrix","periodic-leaderboards","promises","recurring-leaderboards","redis","redis-rank","scoreboard","typescript"],"created_at":"2024-08-07T01:01:42.926Z","updated_at":"2025-04-14T00:26:23.432Z","avatar_url":"https://github.com/mlomb.png","language":"TypeScript","funding_links":[],"categories":["typescript"],"sub_categories":[],"readme":"\n\u003ch1 align=\"center\" style=\"border-bottom: none\"\u003e📊 redis-rank\u003c/h1\u003e\n\u003ch3 align=\"center\"\u003eManage real-time leaderboards using \u003ca href=\"https://redis.io\"\u003eRedis\u003c/a\u003e\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/mlomb/redis-rank/actions\"\u003e\n    \u003cimg alt=\"Build Status\" src=\"https://img.shields.io/github/actions/workflow/status/mlomb/redis-rank/ci.yml\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/mlomb/redis-rank\"\u003e\n    \u003cimg alt=\"codecov\" src=\"https://codecov.io/gh/mlomb/redis-rank/branch/master/graph/badge.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/redis-rank\"\u003e\n    \u003cimg alt=\"codecov\" src=\"https://img.shields.io/npm/v/redis-rank\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# Features\n* **Lightweight**: minimal dependencies, only [ioredis](https://github.com/luin/ioredis) is required\n* **Performance**: guaranteed _at most_ one trip to Redis on each function call*, taking advantage of [ioredis's pipelining](https://github.com/luin/ioredis#pipelining) and [Lua scripts](https://redis.io/commands/eval)\n* **Drop-in replacement**: use any existing sorted set as a leaderboard\n* **Clear interface**: [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)-based \u0026 provides [TypeScript](https://www.typescriptlang.org) definitions\n* **Periodic leaderboards**: create recurring leaderboards: _daily_, _weekly_, _monthly_, etc or use a custom cycle\n* **Combine leaderboards**: create a matrix of leaderboards: update, filter and retrieve multiple entries in a single call\n* **Export**: export your leaderboards for long-term storage\n* **Tested**: 100% code coverage\n\n# Quick Start\n\n## ⚙️ Install\n\n⚠️ For ioredis \u003c= 4.x use `redis-rank@2.1.2`, for ioredis \u003e= 5.x use the latest version.\n\n```shell\n$ npm install redis-rank ioredis\n```\n\nRedis 2.6.12 or newer is required. The package [ioredis](https://www.npmjs.com/package/ioredis) is a peer dependency and must be installed separately.\n\n## 🔗 Import and connect\n\nES5\n```javascript\nconst Redis = require('ioredis');\nconst { Leaderboard, PeriodicLeaderboard, LeaderboardMatrix } = require('redis-rank');\n```\nES6\n```javascript\nimport { Redis } from 'ioredis';\nimport { Leaderboard, PeriodicLeaderboard, LeaderboardMatrix } from 'redis-rank';\n```\n\nYou will have to provide a [ioredis](https://github.com/luin/ioredis) connection.\nSee [here](https://github.com/luin/ioredis#connect-to-redis) for more information.\n\n```javascript\nconst client = new Redis({\n    host: \"127.0.0.1\",\n    port: 6379\n});\n```\n\nYou are ready, now read one of the examples linked below!\n\n# Examples\n\n* [Basic leaderboard usage](docs/EXAMPLES.md#basic-leaderboard-usage)\n* [Exporting a leaderboard](docs/EXAMPLES.md#exporting-a-leaderboard)\n* [Recurring leaderboards](docs/EXAMPLES.md#recurring-leaderboards)\n* [Custom cycles](docs/EXAMPLES.md#custom-cycles)\n* [Clean stale leaderboards](docs/EXAMPLES.md#clean-stale-leaderboards)\n* [Matrix of leaderboards](docs/EXAMPLES.md#matrix-of-leaderboards)\n* [Showcasing leaderboards](docs/EXAMPLES.md#showcasing-leaderboards)\n\n# API\n\n* [Types](docs/#types)\n* [Leaderboard](docs/Leaderboard.md)\n  * [Types](docs/Leaderboard.md#types)\n  * [Constructor](docs/Leaderboard.md#constructor)\n  * [Insert/update entries](docs/Leaderboard.md#insertupdate-entries)\n  * [Remove entries](docs/Leaderboard.md#remove-entries)\n  * [Find entries](docs/Leaderboard.md#find-entries)\n  * [List entries](docs/Leaderboard.md#list-entries)\n  * [Export](docs/Leaderboard.md#export)\n  * [Information](docs/Leaderboard.md#information)\n* [PeriodicLeaderboard](docs/PeriodicLeaderboard.md)\n  * [Types](docs/PeriodicLeaderboard.md#types)\n  * [Constructor](docs/PeriodicLeaderboard.md#constructor)\n  * [Keys](docs/PeriodicLeaderboard.md#keys)\n  * [Leaderboards](docs/PeriodicLeaderboard.md#leaderboards)\n* [LeaderboardMatrix](docs/LeaderboardMatrix.md)\n  * [Types](docs/LeaderboardMatrix.md#types)\n  * [Constructor](docs/LeaderboardMatrix.md#constructor)\n  * [Leaderboards](docs/LeaderboardMatrix.md#leaderboards)\n  * [Insert/update entries](docs/LeaderboardMatrix.md#insertupdate-entries)\n  * [Remove entries](docs/LeaderboardMatrix.md#remove-entries)\n  * [Find entries](docs/LeaderboardMatrix.md#find-entries)\n  * [List entries](docs/LeaderboardMatrix.md#list-entries)\n  * [Information](docs/LeaderboardMatrix.md#information)\n* [Redis keys](docs/#redis-keys)\n\n# Running tests\n\nA Redis server in localhost without password is expected. You can create one easily with Docker like so:\n\n```shell\ndocker run -p 6379:6379 -t -i --rm redis:latest\n```\n\n⚠️ Note: **The database #15 will be flushed** ⚠️\n\nRun tests:\n\n```shell\nnpm test\n```\n\nI tried with [ioredis-mock](https://www.npmjs.com/package/ioredis-mock) but I experienced some issues with Lua scripts so we have to rely on a real Redis server (which I think is better anyway).\n\n# License\n\nMIT. See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlomb%2Fredis-rank","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlomb%2Fredis-rank","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlomb%2Fredis-rank/lists"}