Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wmaciejak/rails_rom_graphql_clean_architecture_boilerplate
Boilerplate Rails project using clean architecture, GraphQL and ROM 4.0
https://github.com/wmaciejak/rails_rom_graphql_clean_architecture_boilerplate
clean-architecture clean-ruby-architecute example-project graphql graphql-ruby postgresql rails rails5 rails5-api rom ruby-architecture ruby-object-mapper ruby-on-rails sequel
Last synced: 22 days ago
JSON representation
Boilerplate Rails project using clean architecture, GraphQL and ROM 4.0
- Host: GitHub
- URL: https://github.com/wmaciejak/rails_rom_graphql_clean_architecture_boilerplate
- Owner: wmaciejak
- License: mit
- Created: 2017-10-17T19:15:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-13T23:13:17.000Z (almost 2 years ago)
- Last Synced: 2024-09-30T06:24:22.338Z (about 1 month ago)
- Topics: clean-architecture, clean-ruby-architecute, example-project, graphql, graphql-ruby, postgresql, rails, rails5, rails5-api, rom, ruby-architecture, ruby-object-mapper, ruby-on-rails, sequel
- Language: Ruby
- Size: 60.5 KB
- Stars: 18
- Watchers: 4
- Forks: 3
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Maintainability](https://api.codeclimate.com/v1/badges/85e2b0f11f46e78fe89b/maintainability)](https://codeclimate.com/github/wmaciejak/rails_rom_graphql_clean_architecture_boilerplate/maintainability)
# 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](https://github.com/exAspArk/batch-loader/) [app/graphql/types/user_type.rb](https://github.com/wmaciejak/rails_rom_graphql_clean_architecture_boilerplate/blob/master/app/graphql/types/user_type.rb#L8).### By own implementation - feedback is appreciated!
- [x] Abstraction on BatchLoader(more DRY implementation)[[refactor] Abstraction in resolvers | 6930a13](https://github.com/wmaciejak/rails_rom_graphql_clean_architecture_boilerplate/pull/2/commits/6930a13758bd4aa250c3cd70b4bc9b081cc78d89)
- [x] modularization of fields in QueryType [app/graphql/query_type.rb](https://github.com/wmaciejak/rails_rom_graphql_clean_architecture_boilerplate/blob/master/app/graphql/query_type.rb#L6)
- [x] Implementation of Clean Architecture
- [x] Separation of seeds by the environment [db/seeds.rb](https://github.com/wmaciejak/rails_rom_graphql_clean_architecture_boilerplate/blob/master/db/seeds.rb)
- [x] Loading relations one-to-many without N+1, fixed by naive implementation - [BatchLoader issue#5](https://github.com/exAspArk/batch-loader/issues/5)
- [x] Modularization project "per feature"([app/concepts/*](https://github.com/wmaciejak/rails_rom_graphql_clean_architecture_boilerplate/commit/9d95c1f6831557c466996196b6d671937c8049bd))
- [x] Global container([dry-container](http://dry-rb.org/gems/dry-container/)) with [auto-registration repositories](https://github.com/wmaciejak/rails_rom_graphql_clean_architecture_boilerplate/commit/6cb7b909590f47b6a4c19e8a454080290eb5243b)## 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
- [x] camelCase in queries(thx [RadoMark](https://github.com/RadoMark/))[fix](https://github.com/wmaciejak/rails_rom_graphql_clean_architecture_boilerplate/commit/e0d0c7fe10f31f37ef3d997a2c056b84f29bf6ed)
## Links
- Application demo GraphiQL: https://rails-graphql-rom-example-app.herokuapp.com/graphiql
## Example Query(can be used in graphiql)
```graphql
query {
users{
username
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
}
}
}
```