{"id":15608987,"url":"https://github.com/sirius248/scratch_rate_limitter","last_synced_at":"2026-04-24T22:36:42.371Z","repository":{"id":148483187,"uuid":"102924116","full_name":"sirius248/scratch_rate_limitter","owner":"sirius248","description":null,"archived":false,"fork":false,"pushed_at":"2017-09-09T05:07:21.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-14T02:52:06.534Z","etag":null,"topics":["ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"https://scratch-rate-limitter.herokuapp.com/home/index","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sirius248.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-09-09T03:33:02.000Z","updated_at":"2023-03-04T05:57:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"f255932e-17d2-49cb-bcad-27b41019ab9e","html_url":"https://github.com/sirius248/scratch_rate_limitter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sirius248/scratch_rate_limitter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirius248%2Fscratch_rate_limitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirius248%2Fscratch_rate_limitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirius248%2Fscratch_rate_limitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirius248%2Fscratch_rate_limitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sirius248","download_url":"https://codeload.github.com/sirius248/scratch_rate_limitter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirius248%2Fscratch_rate_limitter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259919461,"owners_count":22932073,"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":["ruby","ruby-on-rails"],"created_at":"2024-10-03T05:40:42.876Z","updated_at":"2025-11-11T21:14:07.638Z","avatar_url":"https://github.com/sirius248.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rails throttling example\n\n[![Code Climate](https://codeclimate.com/github/kimquy/scratch_rate_limitter/badges/gpa.svg)](https://codeclimate.com/github/kimquy/scratch_rate_limitter)\n\n[![Build Status](https://travis-ci.org/kimquy/scratch_rate_limitter.svg?branch=master)](https://travis-ci.org/kimquy/scratch_rate_limitter)\n\n# Intro\n\nAll the main implemnetation are in the following files:\n\n```bash\napp/middleware/rack/throttling.rb\nconfig/initializers/throttling_config.rb\nlib/simple_throttler.rb\n```\n\n# Usage of SimpleThrottler\n\nAdd `throttling_config.rb` into the `initializers`\n\nExample:\n\n```ruby\nSimpleThrottler.configure do\n  throttle \"/home/index\", limit: 5, period: 1.hours\n  throttle \"/testing\", limit: 20, period: 2.hours\n  throttle \"/awesome\", limit: 100, period: 3.hours\nend\n```\n\n# Improvement\n\nAt the moment the `SimpleThrottler` is super simple. The throttling algorithm only base on the IP address. And the storage only support `ActiveSupport::Cache::MemoryStore`\n\n# Manual Testing\n\n* Make a single request from command line with Curl\n\nSimply copy the code below into command line. Curl is required.\n\n```bash\ncurl https://scratch-rate-limitter.herokuapp.com/home/index\n```\n\n* Make multiple request from command line with Curl\n\n```bash\nfor i in {1..5}; do curl https://scratch-rate-limitter.herokuapp.com/home/index; done\n```\n\n# Unit test\n\n```ruby\nbundle exec rspec\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsirius248%2Fscratch_rate_limitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsirius248%2Fscratch_rate_limitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsirius248%2Fscratch_rate_limitter/lists"}