{"id":31714339,"url":"https://github.com/supabase-community/realtime-ex","last_synced_at":"2025-10-09T01:20:40.237Z","repository":{"id":280223401,"uuid":"940326604","full_name":"supabase-community/realtime-ex","owner":"supabase-community","description":"An isomorphic Elixir client for Supabase Realtime server","archived":false,"fork":false,"pushed_at":"2025-07-16T00:10:19.000Z","size":59,"stargazers_count":2,"open_issues_count":6,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-09-29T06:28:15.509Z","etag":null,"topics":["elixir","supabase-realtime"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/supabase_realtime","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/supabase-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2025-02-28T01:37:20.000Z","updated_at":"2025-07-16T00:09:07.000Z","dependencies_parsed_at":"2025-03-02T04:34:18.383Z","dependency_job_id":"6d7e29ee-db45-4d4d-a63e-8769a4c23617","html_url":"https://github.com/supabase-community/realtime-ex","commit_stats":null,"previous_names":["supabase-community/realtime-ex"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/supabase-community/realtime-ex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase-community%2Frealtime-ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase-community%2Frealtime-ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase-community%2Frealtime-ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase-community%2Frealtime-ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/supabase-community","download_url":"https://codeload.github.com/supabase-community/realtime-ex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supabase-community%2Frealtime-ex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000725,"owners_count":26082894,"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-10-08T02:00:06.501Z","response_time":56,"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":["elixir","supabase-realtime"],"created_at":"2025-10-09T01:20:38.376Z","updated_at":"2025-10-09T01:20:40.230Z","avatar_url":"https://github.com/supabase-community.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Supabase Realtime\n\n[![Hex.pm](https://img.shields.io/hexpm/v/supabase_realtime.svg)](https://hex.pm/packages/supabase_realtime)\n[![Docs](https://img.shields.io/badge/hex-docs-blue.svg)](https://hexdocs.pm/supabase_realtime)\n\n\u003e [!WARNING]  \n\u003e\n\u003e This project is still in pre-release development. Expect breaking changes and evolving API.\n\nElixir client for the Supabase Realtime service, providing robust, OTP-powered connectivity for real-time database changes, broadcast messages, and presence features.\n\n## Key Features\n\n- **OTP-Powered Architecture**: Leverages Elixir's supervision trees for resilient connections and automatic recovery\n- **Channel-Based Subscription Model**: Familiar subscription patterns inspired by Phoenix Channels\n- **Automatic Reconnection**: Built-in exponential backoff reconnection strategy\n- **Message Filtering**: Granular control over event types (INSERT, UPDATE, DELETE)\n\n## Installation\n\nAdd `supabase_realtime` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:supabase_potion, \"~\u003e 0.6\"},\n    {:supabase_realtime, \"~\u003e 0.1.0\"} # x-release-version\n  ]\nend\n```\n\n## Quick Start\n\n### Basic Setup\n\nCreate a Realtime client module in your application:\n\n```elixir\ndefmodule MyApp.Realtime do\n  use Supabase.Realtime\n  \n  def start_link(opts \\\\ []) do\n    Supabase.Realtime.start_link(__MODULE__, opts)\n  end\n  \n  @impl true\n  def handle_event({:postgres_changes, :insert, payload}) do\n    # Handle database INSERT events\n    IO.inspect(payload, label: \"New record created\")\n  end\n  \n  @impl true\n  def handle_event({:postgres_changes, :update, payload}) do\n    # Handle database UPDATE events\n    IO.inspect(payload, label: \"Record updated\")\n  end\nend\n```\n\nAdd the client to your application's supervision tree:\n\n```elixir\n# In lib/my_app/application.ex\ndef start(_type, _args) do\n  children = [\n    # Other children...\n    {MyApp.Supabase, name: MyApp.Supabase},\n    {MyApp.Realtime, supabase_client: MyApp.Supabase}\n  ]\n  \n  opts = [strategy: :one_for_one, name: MyApp.Supervisor]\n  Supervisor.start_link(children, opts)\nend\n```\n\n### Subscribing to Database Changes\n\n```elixir\n# Create a channel\nchannel = MyApp.Realtime.channel(\"public:users\")\n\n# Subscribe to all changes on the users table\nMyApp.Realtime.on(channel, \"postgres_changes\", \n  event: \"*\", \n  schema: \"public\",\n  table: \"users\"\n)\n\n# Or subscribe only to specific events\nMyApp.Realtime.on(channel, \"postgres_changes\", \n  event: :insert, \n  schema: \"public\",\n  table: \"users\"\n)\n```\n\n### Broadcast Messages\n\n```elixir\n# Subscribe to broadcast events\nMyApp.Realtime.on(channel, \"broadcast\", event: \"new_message\")\n\n# Send a broadcast message\nMyApp.Realtime.send(channel, type: \"broadcast\", event: \"new_message\", payload: %{\n  body: \"Hello world!\",\n  user_id: 123\n})\n```\n\n### Managing Subscriptions\n\n```elixir\n# Unsubscribe from a channel\nMyApp.Realtime.unsubscribe(channel)\n\n# Remove all channels\nMyApp.Realtime.remove_all_channels()\n```\n\n## Configuration\n\nConfigure your Realtime client in your application's configuration:\n\n```elixir\n# In config/config.exs or config/runtime.exs\nconfig :my_app, MyApp.Realtime, heartbeat_interval: :timer.seconds(30),\n```\n\n## Integration with supabase-ex\n\n`realtime-ex` is designed to work seamlessly with the existing Supabase Elixir ecosystem. It leverages the authentication and client management capabilities of `supabase-ex`, for example, considering a [self-managed](https://github.com/supabase-community/supabase-ex?tab=readme-ov-file#self-managed-clients) client:\n\n```elixir\ndefmodule MyApp.Supabase do\n  use Supabase.Client, otp_app: :my_app\nend\n\ndefmodule MyApp.Realtime do\n  use Supabase.Realtime\n  \n  def start_link(opts \\\\ []) do\n    client = Keyword.get(opts, :supabase_client)\n    Supabase.Realtime.start_link(__MODULE__, [client: client])\n  end\n  \n  # Event handlers...\nend\n```\n\n## References\n\n- [Supabase Realtime Documentation](https://supabase.com/docs/guides/realtime)\n- [Phoenix Channels Documentation](https://hexdocs.pm/phoenix/Phoenix.Channel.html)\n- [supabase-ex Repository](https://github.com/zoedsoupe/supabase-ex)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupabase-community%2Frealtime-ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsupabase-community%2Frealtime-ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupabase-community%2Frealtime-ex/lists"}