This is a sample app which shows how Rails 5, ROM 4.0, GraphQL and Clean Architecture might work together.
- ruby 2.4.2
- postgresql 10
- N+1 issue by BatchLoader app/graphql/types/user_type.rb.
- Abstraction on BatchLoader(more DRY implementation)[refactor] Abstraction in resolvers | 6930a13
- modularization of fields in QueryType app/graphql/query_type.rb
- Implementation of Clean Architecture
- Separation of seeds by the environment db/seeds.rb
- Loading relations one-to-many without N+1, fixed by naive implementation - BatchLoader issue#5
- Modularization project "per feature"(app/concepts/*)
- Global container(dry-container) with auto-registration repositories
- Sample use case
- Mutations
- Tests
- Sample pagination
- Translation from queries Abstract Syntax Tree to Ruby Object Mapper API - the best solution is adapter, but it's a future voice
- Application demo GraphiQL: https://rails-graphql-rom-example-app.herokuapp.com/graphiql
query {
users{
username
email
posts{
id
content
title
created_at
updated_at
comments {
id
content
created_at
updated_at
author_id
post_id
}
}
comments {
id
content
created_at
updated_at
author_id
post_id
}
}
}