{"id":21672552,"url":"https://github.com/redis-developer/basic-redis-rate-limiting-demo-nodejs","last_synced_at":"2025-08-10T11:10:13.822Z","repository":{"id":49536937,"uuid":"323489441","full_name":"redis-developer/basic-redis-rate-limiting-demo-nodejs","owner":"redis-developer","description":"This is a basic Redis Rate Limiting demo written in NodeJS","archived":false,"fork":false,"pushed_at":"2023-06-27T07:44:48.000Z","size":1826,"stargazers_count":11,"open_issues_count":1,"forks_count":9,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-12T03:52:59.354Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/redis-developer.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-22T01:31:08.000Z","updated_at":"2025-01-24T04:53:31.000Z","dependencies_parsed_at":"2025-04-12T03:53:00.250Z","dependency_job_id":"1a917503-8cd8-4946-befa-55891a966a70","html_url":"https://github.com/redis-developer/basic-redis-rate-limiting-demo-nodejs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/redis-developer/basic-redis-rate-limiting-demo-nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-rate-limiting-demo-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-rate-limiting-demo-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-rate-limiting-demo-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-rate-limiting-demo-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redis-developer","download_url":"https://codeload.github.com/redis-developer/basic-redis-rate-limiting-demo-nodejs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-rate-limiting-demo-nodejs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269713884,"owners_count":24463244,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-25T13:30:02.064Z","updated_at":"2025-08-10T11:10:13.760Z","avatar_url":"https://github.com/redis-developer.png","language":"JavaScript","readme":"# Tutorial: Rate Limiting app in NodeJS \n\n## Technical Stack\n\n- Frontend: Next.js\n- Backend - NodeJS, ExpressJS, Redis\n\n## How it works\n\nThis app has been build using `exoress-rate-limit` and `rate-limit-redis` library which will block connections from a client after surpassing certain amount of requests (default: 10) per time (default: 10 sec)\n\nThe application will return after each request the following headers. That will let the user know how many requests they have remaining before the run over the limit.\n\n```\nX-RateLimit-Limit: 10\nX-RateLimit-Remaining: 9\n```\n\nOn the 10th run server should return an HTTP status code of **429 Too Many Requests**\n\n### Available commands\n\n```\n\"PEXPIRE\", \"MULTI\", \"DEL\", \"PTTL\", \"EXEC\", \"DECR\", \"INCR\"\n```\n\n## Hot to run it locally?\n\n### Prerequisites\n\n-   Node - v12.19.0\n-   NPM - v6.14.8\n-   Docker - v19.03.13 (optional)\n\n### Local installation\n\n```\ngit clone https://github.com/redis-developer/basic-redis-rate-limiting-demo-nodejs/\n\n# copy file and set proper data inside\ncp .env.example .env\n\n# install dependencies\nnpm install\n\n# run docker compose or install redis manually\ndocker network create global\ndocker-compose up -d --build\n\nnpm run dev\n\n```\n\n### Env variables:\n\n-   PORT - port that server is listening on.\n-   REDIS_HOST - host for redis instance. Can be with `redis://` or without.\n-   REDIS_PORT - port for redis instance.\n-   REDIS_PASSWORD - password for redis. Running redis by docker-compose, there's no password. Running by https://redislabs.com/try-free/ you have to pass this variable.\n-   REDIS_ENDPOINT_URI - redis port and host encoded in redis uri take precedence over other environment variables. Can be with `redis://` or without.\n-   COMPOSE_PROJECT_NAME - only for docker-compose to set project name.\n\n## Deployment\n\nTo make deploys work, you need to create free account in https://redislabs.com/try-free/ and get Redis' instance informations - REDIS_ENDPOINT_URI and REDIS_PASSWORD. You must pass them as environmental variables (in .env file or by server config, like `Heroku Config Variables`).\n\n### Google Cloud Run\n\n[![Run on Google\nCloud](https://deploy.cloud.run/button.svg)](https://deploy.cloud.run/?git_repo=https://github.com/redis-developer/basic-redis-rate-limiting-demo-nodejs.git)\n\n### Heroku\n\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)\n\n### Vercel\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/redis-developer/basic-redis-rate-limiting-demo-nodejs\u0026env=REDIS_ENDPOINT_URI,REDIS_PASSWORD)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fbasic-redis-rate-limiting-demo-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredis-developer%2Fbasic-redis-rate-limiting-demo-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fbasic-redis-rate-limiting-demo-nodejs/lists"}