{"id":18257775,"url":"https://github.com/tomlobato/riff","last_synced_at":"2025-09-06T10:35:45.985Z","repository":{"id":99117465,"uuid":"606584230","full_name":"tomlobato/riff","owner":"tomlobato","description":"Riff enables you to build ruby restful apis in record time!","archived":false,"fork":false,"pushed_at":"2024-07-22T02:08:50.000Z","size":284,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T22:46:28.260Z","etag":null,"topics":["api","automatic-api","restful","roda","ruby","sequel"],"latest_commit_sha":null,"homepage":"","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/tomlobato.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-25T23:21:57.000Z","updated_at":"2024-10-16T11:19:28.000Z","dependencies_parsed_at":"2024-11-05T10:56:10.572Z","dependency_job_id":null,"html_url":"https://github.com/tomlobato/riff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomlobato/riff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlobato%2Friff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlobato%2Friff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlobato%2Friff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlobato%2Friff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomlobato","download_url":"https://codeload.github.com/tomlobato/riff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomlobato%2Friff/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273892835,"owners_count":25186561,"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-09-06T02:00:13.247Z","response_time":2576,"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":["api","automatic-api","restful","roda","ruby","sequel"],"created_at":"2024-11-05T10:27:37.124Z","updated_at":"2025-09-06T10:35:45.947Z","avatar_url":"https://github.com/tomlobato.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Riff\n\nRiff is a ruby gem that permits you to quickly build a Restful API in ruby projects that is using [Roda](https://github.com/jeremyevans/roda) and [Sequel ORM](https://github.com/jeremyevans/sequel).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"riff\", :git =\u003e \"git://github.com/tomlobato/riff.git\"\n```\n\nAnd then execute:\n\n```sh\nbundle install\n```\n\n## Features\n\n- Auth (access_token/refresh_token)\n- Authorization\n- Parameters checking\n- Implementation of the default CRUD actions (but can be overwritten)\n- Custom actions (aka restful custom methods, like `POST /actions/users/123:custom_method`)\n- Pagination/Ordering\n- Request throttling (in the seed/sample_app)\n- [tests] Full test coverage\n\n## TODO\n\n- Rails and Activerecord support\n- JSON API support\n- Project generator (`riff new my_api`)\n- Gem docs\n- Docs generation for apis created with Riff\n- Elasticsearch support\n- rake to generate resource customizations from database tables\n- [marketing] Open source marketing\n\n## Usage\n\nInstead to create a roda app from zero, copying the [sample riff app](https://github.com/tomlobato/riff/tree/main/sample_app) is a quick way to have your project up and running.\n\nBut if you prefer to plug riff directly in you app...\n\n1) In your app.rb file (where you have `class App \u003c Roda ...`), add entries like this to direct your requests to Riff (see the [sample riff app](https://github.com/tomlobato/riff/tree/main/sample_app)).\n\n```ruby\nroute do |r|\n  r.post('session', String) do |action|\n    Riff.handle_session(r, response, action)\n  end\n  r.on('actions') do\n    Riff.handle_action(r, response)\n  end\nend\n```\n\n2) Create the riff customizations inside your app inside the constant path `Actions::\u003cMY_MODEL\u003e::*` for each model you want to expose in your api (see examples in [sample_app/app/riff/actions](https://github.com/tomlobato/riff/tree/main/sample_app/app/riff/actions)).\n\n3) Configure Riff minimally setting the user class `Riff::Conf.set(:default_auth_user_class, User)`, so riff can handle auth for you. See a example in [riff.rb](https://github.com/tomlobato/riff/tree/main/sample_app/system/boot/riff.rb)).\n\nSee also the [sample_app](https://github.com/tomlobato/riff/tree/main/sample_app) and its [specs](https://github.com/tomlobato/riff/tree/main/sample_app/spec) for help on using Riff.\n\n## Running tests\n\nThe automated tests for riff are inside the sample_app:\n\n```sh\ncd sample_app\n\nmysqladmin create my_app_test\n# Then create .env.test based on .env.test.template\n\n# Install and run redis-server in another terminal:\nbrew install redis # on mac\nredis-server # on mac\n\nsudo aptitude install redis-server # on ubuntu/debian\n\nbundle install\n\nRACK_ENV=test bundle exec rake db:migrate\nRACK_ENV=test bundle exec rspec\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/tomlobato/riff. 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/tomlobato/riff/blob/main/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 Riff project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/tomlobato/riff/blob/main/CODE_OF_CONDUCT.md).\n\n## Acknowledgements\n\nRiff runs on top of:\n\n- [Roda](https://github.com/jeremyevans/roda)\n- [Sequel ORM](https://github.com/jeremyevans/sequel)\n- [ActiveSupport](https://github.com/rails/rails/tree/main/activesupport)\n- [dry-validation](https://github.com/dry-rb/dry-validation)\n- [todo_api](https://github.com/MatUrbanski/todo_api) for the sample app\n- [Oj](https://github.com/ohler55/oj)\n\nBig thanks to [Jeremy Evans](https://github.com/jeremyevans) for bring to us Roda and Sequel, not mentioning [rodauth](https://github.com/jeremyevans/rodauth) and tons of other great code.\n\nBig thanks to [Mateusz Urbański](https://github.com/MatUrbanski) for bring to us the great project [todo_api](https://github.com/MatUrbanski/todo_api), used in riff as a seed for the sample app and its auth logic for Riff auth handler.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomlobato%2Friff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomlobato%2Friff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomlobato%2Friff/lists"}