rails_rom_graphql_clean_architecture_boilerplate
rails_rom_graphql_clean_architecture_boilerplate copied to clipboard
Boilerplate Rails project using clean architecture, GraphQL and ROM 4.0
Rails 5 + ROM 4 + GraphQL + Clean Architecture example application
This is a sample app which shows how Rails 5, ROM 4.0, GraphQL and Clean Architecture might work together.
Requirements
- ruby 2.4.2
- postgresql 10
What's done already
By libs
- [x] N+1 issue by BatchLoader app/graphql/types/user_type.rb.
By own implementation - feedback is appreciated!
- [x] Abstraction on BatchLoader(more DRY implementation)[refactor] Abstraction in resolvers | 6930a13
- [x] modularization of fields in QueryType app/graphql/query_type.rb
- [x] Implementation of Clean Architecture
- [x] Separation of seeds by the environment db/seeds.rb
- [x] Loading relations one-to-many without N+1, fixed by naive implementation - BatchLoader issue#5
- [x] Modularization project "per feature"(app/concepts/*)
- [x] Global container(dry-container) with auto-registration repositories
What's to be done
- [ ] 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
Known issues
Links
- Application demo GraphiQL: https://rails-graphql-rom-example-app.herokuapp.com/graphiql
Example Query(can be used in 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
}
}
}