{"id":15010118,"url":"https://github.com/chrisalmeida/blackout","last_synced_at":"2026-03-14T20:36:16.978Z","repository":{"id":57479830,"uuid":"151293999","full_name":"chrisalmeida/blackout","owner":"chrisalmeida","description":"A very thin wrapper around Erlang's mnesia, used to provide distributed rate limiting, with little to no configuration and a simple API for developer happiness.","archived":false,"fork":false,"pushed_at":"2023-07-14T05:15:45.000Z","size":6,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-04-26T15:05:10.534Z","etag":null,"topics":["distributed","distributed-systems","elixir","elixir-lang","elixir-library","elixir-programming-language","mnesia","rate-limit","rate-limiter","rate-limiting"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/chrisalmeida.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}},"created_at":"2018-10-02T17:20:06.000Z","updated_at":"2023-12-22T18:50:09.000Z","dependencies_parsed_at":"2024-09-24T19:30:49.143Z","dependency_job_id":"857832ce-f59a-4957-964b-010d498916d4","html_url":"https://github.com/chrisalmeida/blackout","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"d1a4dedb311ac0f66a3d56098dfb8e33b6586798"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisalmeida%2Fblackout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisalmeida%2Fblackout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisalmeida%2Fblackout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisalmeida%2Fblackout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisalmeida","download_url":"https://codeload.github.com/chrisalmeida/blackout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248124848,"owners_count":21051757,"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":["distributed","distributed-systems","elixir","elixir-lang","elixir-library","elixir-programming-language","mnesia","rate-limit","rate-limiter","rate-limiting"],"created_at":"2024-09-24T19:30:22.608Z","updated_at":"2026-03-14T20:36:11.938Z","avatar_url":"https://github.com/chrisalmeida.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blackout\n\nA very thin wrapper around Erlang's mnesia used to provide distributed rate limiting, with little to no configuration and a simple API for developer happiness.\n\n## Installation\n\n[Blackout HexDocs](https://hexdocs.pm/blackout)\n\n### Stand-Alone Applications\n\nInstall by adding `blackout` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:blackout, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n### Umbrella Applications\n\nAdd `blackout` to each umbrella application's `mix.exs` the same as above.\n\n## Usage\n\n### Connect Nodes\n\n- **Node 1:** iex --name n1@x.x.x.x --cookie secret -S mix\n- **Node 2:** iex --name n2@x.x.x.x --cookie secret -S mix\n\n### Join Cluster\n\n```Elixir\ndefmodule SomeModule.Application do\n  @moduledoc false\n\n  use Application\n\n  def start(_type, _args) do\n    children = [\n      {SomeModule.Worker, []}\n    ]\n\n    # Your nodes should be connected by this point\n    connected_nodes = Node.list() ++ [Node.self()]\n    schema = :my_schema_name\n\n    {:ok, _} = Blackout.join_cluster(schema, connected_nodes)\n\n    opts = [strategy: :one_for_one, name: SomeModule.Supervisor]\n    Supervisor.start_link(children, opts)\n  end\nend\n```\n\n### Check Rate Limit\n\n```Elixir\niex(n1@x.x.x.x)1\u003e schema = :my_schema_name\n:my_schema_name\n\niex(n1@x.x.x.x)2\u003e bucket_name = \"route_requests\"\n\"route_requests\"\n\niex(n1@x.x.x.x)3\u003e allowed_count = 2\n2\n\niex(n1@x.x.x.x)4\u003e bucket_expiration = 10_000\n10_000\n\niex(n1@x.x.x.x)5\u003e Blackout.check_bucket(schema, bucket_name, allowed_count, bucket_expiration)\n{:atomic, {:ok, 10_000}}\n```\n\n### Delete Bucket\n\n```Elixir\niex(n1@x.x.x.x)1\u003e schema = :my_schema_name\n:my_schema_name\n\niex(n1@x.x.x.x)2\u003e bucket_name = \"route_requests\"\n\"route_requests\"\n\niex(n1@x.x.x.x)3\u003e Blackout.delete_bucket(schema, bucket_name)\n{:atomic, :ok}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisalmeida%2Fblackout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisalmeida%2Fblackout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisalmeida%2Fblackout/lists"}