{"id":17964801,"url":"https://github.com/peterkrauz/pistis","last_synced_at":"2026-01-24T08:30:46.356Z","repository":{"id":39167682,"uuid":"498110426","full_name":"peterkrauz/pistis","owner":"peterkrauz","description":"Transparent, easily-configurable, strongly-consistent distributed state-machine replicas.","archived":false,"fork":false,"pushed_at":"2022-07-18T19:56:05.000Z","size":74,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-31T03:36:25.988Z","etag":null,"topics":["distributed-systems","elixir","erlang","fault-tolerance","raft","state-machine-replication"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peterkrauz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-30T22:13:28.000Z","updated_at":"2024-05-18T04:12:33.000Z","dependencies_parsed_at":"2022-07-20T00:02:07.874Z","dependency_job_id":null,"html_url":"https://github.com/peterkrauz/pistis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/peterkrauz/pistis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterkrauz%2Fpistis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterkrauz%2Fpistis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterkrauz%2Fpistis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterkrauz%2Fpistis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterkrauz","download_url":"https://codeload.github.com/peterkrauz/pistis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterkrauz%2Fpistis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28720690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T08:27:05.734Z","status":"ssl_error","status_checked_at":"2026-01-24T08:27:01.197Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["distributed-systems","elixir","erlang","fault-tolerance","raft","state-machine-replication"],"created_at":"2024-10-29T12:08:45.500Z","updated_at":"2026-01-24T08:30:46.341Z","avatar_url":"https://github.com/peterkrauz.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pistis\n\nAn Elixir library to reduce the boilerplate work one would have in order to implement a distributed cluster of strongly-consistent BEAM instances.\n\nPistis ensures deterministic commands through [`:ra`](https://github.com/rabbitmq/ra), an Erlang-based implementation of the [Raft](https://www.usenix.org/conference/atc14/technical-sessions/presentation/ongaro) consensus protocol.\n\n## Installation\n\n1. Add the `pistis` artifact to you project's dependencies\n\n```elixir\ndef deps do\n  [\n    {:pistis, \"~\u003e 0.1.10\"}\n  ]\nend\n```\n\n2. Define your state machine module on `config/config.exs`\n\n```elixir\nconfig :pistis, machine: YourApp.YourStateMachine\n```\n\n3. Add the library's entrypoint supervisor to your Elixir app's children\n\n```elixir\ndefmodule YourApp.Application do\n  # ...\n  def start(_type, _args) do\n    children = [Pistis.Core.Entrypoint]\n    opts = [strategy: :one_for_one, name: YourApp.Supervisor]\n    Supervisor.start_link(children, opts)\n  end\nend\n```\n\n4. Profit\n\n## Usage\n\nThe library demands two things from its user:\n\n1. Make sure client commands are sent to Pistis' server\n\n```elixir\ndefmodule YourApp.SomeModule do\n  def your_fn_that_increments_state_by_2(_args) do\n    Pistis.Server.send_request({:increment_by, 2})\n  end\n\n  def another_fn_but_a_shy_one(_args) do\n    Pistis.Server.send_request(:increment)\n  end\nend\n```\n\n2. A concrete state-machine\n\n```elixir\ndefmodule YourApp.YourStateMachine do\n  @behaviour Pistis.Machine\n\n  def initial_state, do: 0\n\n  def process_command(%Pistis.Request{body: :increment}, current_state) do\n    %Pistis.Response(response: :ok, state: current_state + 1)\n  end\n\n  def process_command(%Pistis.Request{body: {:increment_by, num}}, current_state) do\n    %Pistis.Response(response: :ok, state: current_state + num)\n  end\nend\n```\n\nPistis does not inspect your message's content. It simply wraps your state-machine implementation with a Raft-aware component that takes care of delivering the request and getting a response out of it.\n\nAll requests are wrapped inside the `Pistis.Request` struct. Responses should follow the same pattern by being wrapped in a `Pistis.Response` struct.\n\n## Examples\n\nExample state-machines can be found at `lib/example`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterkrauz%2Fpistis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterkrauz%2Fpistis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterkrauz%2Fpistis/lists"}