/rails-clean-example

Clean Architecture Example using Ruby on Rails framework

Primary LanguageRubyMIT LicenseMIT

rails-clean-example

Ruby Rails Puma OpenAPI Swagger GraphQL RuboCop Open Issues Closed Issues Open Pulls Closed Pulls Contributors Activity

Description

Example Application Interface using Rails framework in Ruby

This example showcases Repository Pattern in Hexagonal Architecture (also known as Clean Architecture). Here we have two Entities - Books and Authors, whose relationships have been exploited to create CRUD endpoint in REST under OpenAPI standard.

Installation

  • Install all the project dependency:

    $ bundle install
  • Run the application:

    $ bundle exec rails s
    

Testing

  • Run test suite along with Coverage reporting:

    $ bundle exec rspec spec

Swagger UI

  • Generate OpenAPI specifications from RSpec:

    $ RAILS_ENV=test bundle exec rails rswag
  • Open Swagger UI at localhost:3000/api-docs after running the application.

License

© MIT License