{"id":20129407,"url":"https://github.com/cybertooth-io/ermahgerd-rails-api-jwt","last_synced_at":"2026-04-29T14:31:52.123Z","repository":{"id":83244672,"uuid":"152158058","full_name":"cybertooth-io/ermahgerd-rails-api-jwt","owner":"cybertooth-io","description":"Rails 5+ API, JWT_Session, Pundit, JSONAPI, Sidekiq, PostgreSQL.","archived":false,"fork":false,"pushed_at":"2018-11-17T21:00:22.000Z","size":153,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-10T08:05:51.918Z","etag":null,"topics":["jsonapi","jsonapi-resources","jwt","jwt-authentication","rails5-api","redis","sidekiq"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cybertooth-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-10-08T23:08:22.000Z","updated_at":"2018-11-17T21:00:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"b926503d-87ce-4d66-a658-7793ea6bfa0b","html_url":"https://github.com/cybertooth-io/ermahgerd-rails-api-jwt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cybertooth-io/ermahgerd-rails-api-jwt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybertooth-io%2Fermahgerd-rails-api-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybertooth-io%2Fermahgerd-rails-api-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybertooth-io%2Fermahgerd-rails-api-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybertooth-io%2Fermahgerd-rails-api-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cybertooth-io","download_url":"https://codeload.github.com/cybertooth-io/ermahgerd-rails-api-jwt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybertooth-io%2Fermahgerd-rails-api-jwt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32429103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: 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":["jsonapi","jsonapi-resources","jwt","jwt-authentication","rails5-api","redis","sidekiq"],"created_at":"2024-11-13T20:34:15.724Z","updated_at":"2026-04-29T14:31:52.108Z","avatar_url":"https://github.com/cybertooth-io.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README  - ermahgerd-rails-api-jwt\n         \nThe Rails API server for Canadian Pump \u0026 Packing Distribution.  Serves up JSONAPI payloads for an EmberJs SPA\nover at [https://github.com/cybertooth-io/ccpdist-com-emberjs](https://github.com/cybertooth-io/ccpdist-com-emberjs).\n\n## Development - Getting Started\n\nYou need the following:\n\n* Ruby-2.3+ - suggest Ruby-2.5 but check your production environment to be sure -- e.g. AWS EB\n* Docker - we use two containers, one for the PostgreSQL database and one for Redis\n* The `config/master.key` file\n\n### First Time Setting Up\n\nPerform the following from the command line:\n\n1. `bundle install` - will install any of the missing gems declared in the `Gemfile`\n1. `docker-compose up -d` - start up a Redis and PostgreSQL server in a container\n1. `rake db:create` - only required the first time, make sure your database is created\n1. `rake db:migrate` - run as required, your application will produce a stacktrace of errors if you're not up to date\n1. `rake db:seed_fu` - run as required, to seed the database with data\n1. `rake test` - run as required, test to make sure your API is behaving\n\n### Running The Server\n\n`rails s` - to serve the API on [http://localhost:3000](http://localhost:3000)\n\n\n### Database Seeds\n\nFor development, feel free to edit the `db/fixtures/development/002_users.rb` file to add yourself.\n\nSeed the database with:\n\n```bash\n$ rake db:seed_fu\n```\n\n### Redis\n\nRedis is used by JWTSessions to store Tokens and is also used by Sidekiq to queue up jobs.\n\nJWTSessions is configured in `config/initializers/jwt_session.rb` to use database `0`.\n\nSidekiq is configured in `config/initializers/sidekiq.rb` to use database `1`.\n\n### Crons/Jobs/Queues\n\nIf you're creating Sidekiq jobs please use the generator: `rails g sidekiq:worker record_session_activity`\n\n### Development Workflow\n\n1. Create a model with its **singular name**: `rails g model role key:string name:string notes:text`\n    1. Edit the migration to ensure the `default` and `null` values are defined\n    1. Add validations, relationships, scopes, etc. to the new model class\n    1. Is the model audited?  Yes, then add the `audited` declaration to the model class\n    1. Add test fixture data accordingly to `test/fixtures/*.yml` (keep it general and un-crazy)\n    1. Unit test accordingly\n    1. Add the model information to the `config/locales/*.yml` file(s)\n1. Create the pundit policy with the **model's singular name**: `rails g pundit:policy role`\n    1. Make sure your policy file extends `ApplicationPolicy` (it should by default)\n    1. Override `create?`, `destroy?`, `index?`, `show?`, and `update?` accordingly\n    1. Unit test accordingly\n    1. Add the policy error messages to the `config/locales/*.yml` if so desired\n1. Create the protected resource using the **model's singular name** at the appropriate api path: \n`rails g jsonapi:resource api/v1/protected/role`\n    1. Make sure the resource extends `BaseResource`\n    1. Add the appropriate attributes from the model that will be serialized in the JSONAPI payload\n    1. Make sure all relationships you want exposed are added\n    1. Add any filters that use model scopes\n    1. Unit test accordingly through the controller (next step)\n1. Create the protected controller using the **model's plural name** at the appropriate api path:\n`rails g controller api/v1/protected/roles`\n    1. Make sure the controller extends `BaseResourceController`\n    1. Add the controller's end points to the `config/routes.rb` file; use `jsonapi_resources` helper :-)\n    1. Unit test accordingly (e.g. confirm returned payload only contains the fields specified in the resource)\n\n### Commiting Code\n\n1. Use a branch and a pull request into master.\n1. Run `rubocop -a` prior to commits to make sure your code conforms to the formatting and linting.\n\n----\n\n## Configuration Notes\n\nThe `config/application.rb` sets the `record_session_activity` boolean which is used to determine whether\nwe should be logging session activity.\n\n----\n\n## Credentials\n\nAs of Rails-5.2 secrets are hashed and locked down with the `config/master.key` file.  Run `rails credentials:help` for\nmore information.\n\nDo you need to create a key?  Use `rake secret`\n\nDo you need to edit some secrets?  Do it from the command line:\n\n```bash\n$ rails credentials:edit\n```\n\n### Keys in `config/credentials.yml.enc`\n\n`secret_key_base` - used by Rails in many ways (e.g. BCrypt)\n\n`secret_jwt_encryption_key` - used by JWT \u0026 JWT_Sessions to create access \u0026 refresh tokens\n\n----\n\n## Releasing\n\n1. Confirm (and edit) the `config/application.rb`'s version property.\n1. Commit.\n1. Tag: `git tag v#.#.#`\n1. Edit the `config/application.rb`'s version property.\n1. Commit \u0026 push everything.\n\n----\n\n## Deployment\n\n_Coming soon_\n\n## Contributing\n\nTeam members, create a branch and pull request.\n\nGeneral Public: Fork and create pull request.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybertooth-io%2Fermahgerd-rails-api-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcybertooth-io%2Fermahgerd-rails-api-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybertooth-io%2Fermahgerd-rails-api-jwt/lists"}