{"id":14955916,"url":"https://github.com/galliani/supabase_api","last_synced_at":"2025-10-25T10:34:53.196Z","repository":{"id":44413116,"uuid":"512484785","full_name":"galliani/supabase_api","owner":"galliani","description":"(Unofficial) Wrapper class to inherit from to access your Supabase tables like ActiveRecord accesses your tables. https://supabase.com","archived":false,"fork":false,"pushed_at":"2022-07-15T22:06:37.000Z","size":51,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-29T14:17:52.140Z","etag":null,"topics":["admin","baas","backend","rails","supabase"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/supabase_api","language":"Ruby","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/galliani.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-10T16:32:31.000Z","updated_at":"2023-12-01T05:42:33.000Z","dependencies_parsed_at":"2022-09-26T16:20:17.320Z","dependency_job_id":null,"html_url":"https://github.com/galliani/supabase_api","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galliani%2Fsupabase_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galliani%2Fsupabase_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galliani%2Fsupabase_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galliani%2Fsupabase_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/galliani","download_url":"https://codeload.github.com/galliani/supabase_api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237944039,"owners_count":19391588,"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":["admin","baas","backend","rails","supabase"],"created_at":"2024-09-24T13:11:59.908Z","updated_at":"2025-10-24T09:30:23.318Z","avatar_url":"https://github.com/galliani.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Supabase Api Ruby Client [![Gem](https://img.shields.io/gem/v/supabase_api?color=blue\u0026label=version)](https://rubygems.org/gems/supabase_api) ![Build Status](https://github.com/galliani/supabase_api/workflows/spec/badge.svg)  [![Coverage](https://github.com/galliani/supabase_api/blob/main/badge.svg)](https://github.com/galliani/supabase_api) ![Commit](https://img.shields.io/github/last-commit/galliani/supabase_api)\n\n\nHi, this is a Ruby wrapper to access your Supabase tables via REST API in a manner similar to ActiveRecord model.\n\nDISCLAIMER: This is not an official Ruby SDK.\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n```bash\n$ bundle add supabase_api\n```\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n```bash\n$ gem install supabase_api\n```\n\n## Usage\n\n\n### Setup\nRun these commands on the config or initializer file.\n\n```ruby\n# setups\nrequire 'supabase_api' # if not using Rails\nSupabaseApi::Config.base_url = 'https://yourrandomapisubdomain.supabase.co'\nSupabaseApi::Config.api_key = 'veryrandomlongstring'\n```\n\nFor production usage, of course it is recommended to use ENV variables manager like Figaro or Dotenv, which then will make your setup like this:\n```ruby\n# setups\nrequire 'supabase_api' # if not using Rails\nSupabaseApi::Config.base_url = ENV['SUPABASE_API_BASE_URL']\nSupabaseApi::Config.api_key = ENV['SUPABASE_API_KEY']\n```\n\nThis setup should be called as early as need be. If using rails, you can put it under `config/initializers` directory inside a file named `supabase_api.rb` as per the usual convention.\n\n\n### With Rails\nCreate a ruby PORO class for your Supabase tables and inherit from the `SupabaseApi::Record` class.\n\n```ruby\nclass Book \u003c SupabaseApi::Record\n  def self.table_name\n    # put the name of the table you want to connect with from Supabase\n    'books' # or 'Books', whatever you fancy\n  end\nend\n```\n\nThen after that you can access your Supabase table just like a `ActiveRecord`-backed models.\n\n### Querying Data\n```ruby\nbook_id_in_supabase = 100\nBook.find(book_id_in_supabase)\n\n# The line below will yield the same like above but will not raise any exception\nbook = Book.find_by_id(book_id_in_supabase)\n\n# or you could call .where\nBook.where(id: 100) # would yield the same result as above, also not raising exception\n\n# .where works like you expect, passing another key-value pair as arguments\nBook.where(name: 'some name of the book')\n\n```\n\n### Mutating Data\n\n```ruby\nbook = Book.find(book_id_in_supabase)\n\n# Assuming the books table has 'status' string column\nbook.status = 'archived'\nbook.save\n\n# If you want to create a new book record\nnew_book = Book.new(\n  name: 'New Book',\n  status: 'pending'\n)\nnew_book.save\n\n# or\nbook = Book.create(\n  name: 'New Book',\n  status: 'pending'\n)\nbook.id # =\u003e 100\n\n# In case you regret creating it, you can delete the record\nbook.destroy\nBook.find(100) # will raise an exception SupabaseApi::RecordNotFound\n```\n\n## TODO List\n- add pagination.\n- adapt command `#create` and `#update`  for the Record class to have multiple inserts and upserts respectively.\n- add more graceful and robust error handler.\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/galliani/supabase_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/galliani/supabase_api/blob/master/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the SupabaseApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/galliani/supabase_api/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgalliani%2Fsupabase_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgalliani%2Fsupabase_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgalliani%2Fsupabase_api/lists"}