{"id":13879584,"url":"https://github.com/rootstrap/rails_api_base","last_synced_at":"2025-04-14T08:15:32.466Z","repository":{"id":37742772,"uuid":"70519835","full_name":"rootstrap/rails_api_base","owner":"rootstrap","description":"API boilerplate project for Ruby on Rails 7","archived":false,"fork":false,"pushed_at":"2025-04-04T20:36:54.000Z","size":8880,"stargazers_count":543,"open_issues_count":2,"forks_count":122,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-04-07T01:07:57.561Z","etag":null,"topics":["api","api-boilerplate","boilerplate","hacktoberfest","rails-api","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"https://rootstrap.com","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/rootstrap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-10T19:07:58.000Z","updated_at":"2025-04-04T17:28:54.000Z","dependencies_parsed_at":"2023-10-17T02:06:10.192Z","dependency_job_id":"f504973c-cef5-4b23-b046-c3a81c2c70a7","html_url":"https://github.com/rootstrap/rails_api_base","commit_stats":{"total_commits":844,"total_committers":85,"mean_commits":9.929411764705883,"dds":0.5699052132701421,"last_synced_commit":"e1cab6a94f976f1585f2531f3d6037f3a6a6ba6b"},"previous_names":[],"tags_count":9,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootstrap%2Frails_api_base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootstrap%2Frails_api_base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootstrap%2Frails_api_base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootstrap%2Frails_api_base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rootstrap","download_url":"https://codeload.github.com/rootstrap/rails_api_base/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248843954,"owners_count":21170495,"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":["api","api-boilerplate","boilerplate","hacktoberfest","rails-api","ruby","ruby-on-rails"],"created_at":"2024-08-06T08:02:25.916Z","updated_at":"2025-04-14T08:15:32.434Z","avatar_url":"https://github.com/rootstrap.png","language":"Ruby","readme":"# Rails API Template\n\n[![Github Actions CI](https://github.com/rootstrap/rails_api_base/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/rootstrap/rails_api_base/actions)\n[![Code Climate](https://codeclimate.com/github/rootstrap/rails_api_base/badges/gpa.svg)](https://codeclimate.com/github/rootstrap/rails_api_base)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/63de7f82c79f5fe82f46/test_coverage)](https://codeclimate.com/github/rootstrap/rails_api_base/test_coverage)\n\nRails API Base is a boilerplate project for JSON RESTful APIs. It follows the community best practices in terms of standards, security and maintainability, integrating a variety of testing and code quality tools. It's based on Rails 8.0 and Ruby 3.4.\n\nFinally, it contains a plug an play Administration console (thanks to [ActiveAdmin](https://github.com/activeadmin/activeadmin)).\n\n## Features\n\nThis template comes with:\n- Schema\n  - Users table\n  - Admin users table\n- Endpoints\n  - Sign up with user credentials\n  - Sign in with user credentials\n  - Sign out\n  - Reset password\n  - Get and update user profile\n- Administration panel\n- Feature flags support with a UI for management\n- Code quality tools\n- RSpec tests\n- RSpec API Doc Generator\n- API documentation following [OpenAPI](https://www.openapis.org/)\n- Docker support\n\n## How to use\n\n1. Clone this repo\n1. Install PostgreSQL in case you don't have it\n1. Install node. The expected node version is defined in `.nvmrc` file.\n1. Install yarn. You can run `corepack enable` to install the required yarn binaries. Corepack is already included in newest node versions.\n1. Run `bootstrap.sh` with the name of your project like `./bin/bootstrap.sh --name=my_awesome_project`.\n1. Run `yarn install` and `yarn build --watch`. This bundles the JS assets in the administration site using [esbuild](https://github.com/evanw/esbuild).\n1. `bundle exec rspec` and make sure all tests pass (non-headless mode) or `HEADLESS=true bundle exec rspec` (headless mode)\n1. Run `bin/dev`.\n1. You can now try your REST services!\n\n## How to use with Docker\n\n1. Have `docker` and `docker-compose` installed (You can check this by doing `docker -v` and `docker-compose -v`)\n1. Run `bootstrap.sh` with the name of your project and the `-d` or `--for-docker` flag like `./bin/bootstrap.sh --name=my_awesome_project -d`\n    1. Run `./bin/bootstrap.sh --help` for the full details.\n1. (Optional) If you want to deny access to the database from outside of the `docker-compose` network, remove the `ports` key in the `docker-compose.yml` from the `db` service.\n1. (Optional) Run the tests to make sure everything is working with: `bin/rspec .`.\n1. You can now try your REST services!\n\nSee [Docker docs](./docs/docker.md) for more info\n\n## Dev scripts\n\nThis template provides a handful of scripts to make your dev experience better!\n\n- bin/bundle to run any `bundle` commands.\n  - `bin/bundle install`\n- bin/rails to run any `rails` commands\n  - `bin/rails console`\n- bin/web to run any `bash` commands\n  - `bin/web ls`\n- bin/rspec to run specs\n  - `bin/rspec .`\n- bin/dev to run both Rails and JS build processes at the same time in a single terminal tab.\n  - `bin/dev`\n\nYou don't have to use these but they are designed to run the same when running with Docker or not.\nTo illustrate, `bin/rails console` will run the console in the docker container when running with docker and locally when not.\n\n## Gems\n\n- [ActiveAdmin](https://github.com/activeadmin/activeadmin) for easy administration\n- [Arctic Admin](https://github.com/cprodhomme/arctic_admin) for responsive active admin\n- [Annotaterb](https://github.com/drwl/annotaterb) for documenting the schema in the classes\n- [Better Errors](https://github.com/charliesome/better_errors) for a better error page\n- [Brakeman](https://github.com/presidentbeef/brakeman) for security static analysis\n- [Byebug](https://github.com/deivid-rodriguez/byebug) for debugging\n- [Devise](https://github.com/plataformatec/devise) for basic authentication\n- [Devise Token Auth](https://github.com/lynndylanhurley/devise_token_auth) for API authentication\n- [Dotenv](https://github.com/bkeepers/dotenv) for handling environment variables\n- [Draper](https://github.com/drapergem/draper) for decorators\n- [Factory Bot](https://github.com/thoughtbot/factory_bot) for testing data\n- [Faker](https://github.com/stympy/faker) for generating test data\n- [Flipper](https://github.com/jnunemaker/flipper) for feature flag support\n- [GoodJob](https://github.com/bensheldon/good_job) for background processing\n- [Jbuilder](https://github.com/rails/jbuilder) for JSON views\n- [JS Bundling](https://github.com/rails/jsbundling-rails) for bundling JS assets\n- [Knapsack](https://github.com/KnapsackPro/knapsack) for splitting tests evenly based on execution time\n- [Letter Opener](https://github.com/ryanb/letter_opener) for previewing emails in the browser\n- [New Relic](https://github.com/newrelic/newrelic-ruby-agent) for monitoring and debugging\n- [Pagy](https://github.com/ddnexus/pagy) for pagination\n- [Parallel Tests](https://github.com/grosser/parallel_tests) for running the tests in multiple cores\n- [Prosopite](https://github.com/charkost/prosopite) to detect N+1 queries\n- [Pry](https://github.com/pry/pry) for enhancing the Ruby shell\n- [Puma](https://github.com/puma/puma) for the web server\n- [Pundit](https://github.com/varvet/pundit) for authorization management\n- [Rack CORS](https://github.com/cyu/rack-cors) for handling CORS\n- [Rails Best Practices](https://github.com/flyerhzm/rails_best_practices) for Rails linting\n- [Reek](https://github.com/troessner/reek) for Ruby linting\n- [RSpec](https://github.com/rspec/rspec) for testing\n- [RSpec OpenAPI](https://github.com/exoego/rspec-openapi) for generating API documentation\n- [Rswag](https://github.com/rswag/rswag) for serving the API documentation\n- [Rubocop](https://github.com/bbatsov/rubocop/) for Ruby linting\n- [Sendgrid](https://github.com/stephenb/sendgrid) for sending emails\n- [Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers) for other testing matchers\n- [Simplecov](https://github.com/colszowka/simplecov) for code coverage\n- [Strong Migrations](https://github.com/ankane/strong_migrations) for catching unsafe migrations in development\n- [Webmock](https://github.com/bblimke/webmock) for stubbing http requests\n- [YAAF](https://github.com/rootstrap/yaaf) for form objects\n\n## Optional configuration\n\n- Set your [frontend URL](https://github.com/cyu/rack-cors#origin) in `config/initializers/rack_cors.rb`\n- Set your mail sender in `config/initializers/devise.rb`\n- Config your timezone accordingly in `application.rb`\n- Config CI parallel execution. See [docs](docs/ci.md)\n- Fullstack development. See [docs](docs/fullstack.md).\n\n## API Docs\n\n- [RSpec API Doc Generator](https://github.com/exoego/rspec-openapi) you can generate the docs after writing requests specs\n- [Rswag](https://github.com/rswag/rswag) you can expose the generated docs\n\nSee [API documentation docs](./docs/api_documentation.md) for more info\n\n## Code quality\n\nWith `bundle exec rails code:analysis` you can run the code analysis tool, you can omit rules with:\n\n- [Rubocop](https://github.com/bbatsov/rubocop/blob/master/config/default.yml) Edit `.rubocop.yml`\n- [Reek](https://github.com/troessner/reek#configuration-file) Edit `config.reek`\n- [Rails Best Practices](https://github.com/flyerhzm/rails_best_practices#custom-configuration) Edit `config/rails_best_practices.yml`\n- [Brakeman](https://github.com/presidentbeef/brakeman) Run `brakeman -I` to generate `config/brakeman.ignore`\n\n## More linters\n- [Hadolint](https://github.com/hadolint/hadolint) Install with `brew install hadolint` and run `hadolint Dockerfile*`. Edit `.hadolint.yml` to omit additional rules.\n\n## Impersonation\n\nThe `rails_api_base` incorporates a user impersonation feature, allowing `AdminUser`s to assume the identity of other `User`s. This feature is disabled by default.\n\nSee [Impersonation docs](./docs/impersonation.md) for more info\n\n## Monitoring\n\nIn order to use [New Relic](https://newrelic.com) to monitor your application requests and metrics, you must setup `NEW_RELIC_API_KEY` and `NEW_RELIC_APP_NAME` environment variables.\nTo obtain an API key you must create an account in the platform.\n\n## Configuring Code Climate\n\n1. After adding the project to CC, go to `Repo Settings`\n1. On the `Test Coverage` tab, copy the `Test Reporter ID`\n1. Set the current value of `CC_TEST_REPORTER_ID` in the [GitHub secrets and variables](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository)\n\n## Code Owners\n\nYou can use [CODEOWNERS](https://help.github.com/en/articles/about-code-owners) file to define individuals or teams that are responsible for code in the repository.\n\nCode owners are automatically requested for review when someone opens a pull request that modifies code that they own.\n\n## Credits\n\nRails API Base is maintained by [Rootstrap](http://www.rootstrap.com) with the help of our\n[contributors](https://github.com/rootstrap/rails_api_base/contributors).\n\n[\u003cimg src=\"https://s3-us-west-1.amazonaws.com/rootstrap.com/img/rs.png\" width=\"100\"/\u003e](http://www.rootstrap.com)\n","funding_links":[],"categories":["Rails Templates 👷 (open source)","Ruby","Starters/Boilerplates"],"sub_categories":["Articles"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootstrap%2Frails_api_base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frootstrap%2Frails_api_base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootstrap%2Frails_api_base/lists"}