|
1 | | -# README |
| 1 | +# GraphQL Rails Blog |
2 | 2 |
|
3 | | -This README would normally document whatever steps are necessary to get the |
4 | | -application up and running. |
| 3 | +This application can be used as **starter kit** if you want to get started building an app with **Rails**, **React**, and **GraphQL**. |
| 4 | +This is a simple blog engine using ordinary features which can be found in most web applications. |
5 | 5 |
|
6 | | -Things you may want to cover: |
| 6 | +## Technologies |
7 | 7 |
|
8 | | -* Ruby version |
| 8 | +### Frontend |
9 | 9 |
|
10 | | -* System dependencies |
| 10 | +- [React](https://facebook.github.io/react) - A JavaScript library for building user interfaces. It introduces many great concepts, such as, Virtual DOM, Data flow, etc. |
| 11 | +- [Babel](https://babeljs.io) - Babel is a JavaScript compiler which allows you to use next generation, ES6/ES7, JavaScript... today. |
| 12 | +- [Sass](http://sass-lang.com) - Sass is an extension of CSS, adding nested rules, variables, mixins, selector inheritance, and more. |
| 13 | +- [Redux](https://github.com/reactjs/redux) - Redux is a predictable state container for JavaScript apps |
| 14 | +- [Redux Form](http://redux-form.com/) - A Higher Order Component using react-redux to keep form state in a Redux store. |
| 15 | +- [Apollo](http://dev.apollodata.com/) - A flexible, fully-featured GraphQL client for every platform. |
| 16 | +- [Webpack 2 (with hot reloading)](https://webpack.js.org/) - webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser. Yet it is also capable of transforming, bundling, or packaging just about any resource or asset. |
| 17 | +- [ESlint](http://eslint.org/) - ESlint is a pluggable linting utility for JavaScript, and JSX. |
11 | 18 |
|
12 | | -* Configuration |
| 19 | +### Backend |
13 | 20 |
|
14 | | -* Database creation |
| 21 | +- Ruby 2.3 |
| 22 | +- Rails 5 |
| 23 | +- [Devise](https://github.com/plataformatec/devise) - Devise is a flexible authentication solution for Rails based on [Warden](https://github.com/hassox/warden). |
| 24 | +- [Active admin](http://activeadmin.info/) - Active Admin is a Ruby on Rails plugin for generating administration style interfaces. |
| 25 | +- [GraphQL-Ruby](https://github.com/rmosolgo/graphql-ruby) - GraphQL-Ruby is a Ruby implementation of [GraphQL](http://graphql.org). |
| 26 | +- [GraphQL-batch](https://github.com/Shopify/graphql-batch) - GraphQL-batch is a query batching executor for the graphql gem. |
| 27 | +- [Graphiql](https://github.com/graphql/graphiql) - Graphiql is an in-browser IDE for exploring GraphQL. |
| 28 | +- [Rack CORS](https://github.com/cyu/rack-cors) - Rack Middleware for handling Cross-Origin Resource Sharing (CORS), which makes cross-origin AJAX possible. |
| 29 | +- [Optics Agent](http://www.apollodata.com/optics) - Optics Agent for GraphQL Monitoring |
| 30 | +- SQLite3 for development and PostgreSQL for production. |
15 | 31 |
|
16 | | -* Database initialization |
| 32 | +## Features |
17 | 33 |
|
18 | | -* How to run the test suite |
| 34 | +- CRUD (create / read / update / delete) on posts |
| 35 | +- Creating comments on post page |
| 36 | +- Pagination on posts listing |
| 37 | +- Searching on posts |
| 38 | +- Authentication with Devise and authorizations (visitors, users, admins) |
| 39 | +- Creating user account |
| 40 | +- Update user profile and changing password |
| 41 | +- Setup dev tools |
| 42 | +- Application ready for production |
19 | 43 |
|
20 | | -* Services (job queues, cache servers, search engines, etc.) |
| 44 | +## GraphQL Using |
21 | 45 |
|
22 | | -* Deployment instructions |
| 46 | +- Queries et mutations |
| 47 | +- FetchMore for pagination |
| 48 | +- Integrating with Redux and updating store |
| 49 | +- Optimistic UI |
| 50 | +- Colocate data / component with fragments |
| 51 | +- Validation management and integration with Redux Form |
| 52 | +- Authentication and authorizations |
| 53 | +- Protect queries and mutations on GraphQL API |
| 54 | +- Batching of SQL queries side backend |
23 | 55 |
|
24 | | -* ... |
| 56 | +## Prerequisites |
| 57 | + |
| 58 | +- Ruby 2.3 |
| 59 | +- [Node.js](https://nodejs.org) v6 or newer + [Yarn](https://yarnpkg.com) package manager |
| 60 | +- SQLite3 |
| 61 | + |
| 62 | +## Getting Started |
| 63 | + |
| 64 | +- Install Bundler |
| 65 | + |
| 66 | + $ gem install bundler |
| 67 | + |
| 68 | +- Checkout the graphql-rails-blog git tree from Github |
| 69 | + |
| 70 | + $ git clone https://github.com/MatthieuSegret/graphql-rails-blog.git |
| 71 | + $ cd graphql-rails-blog |
| 72 | + graphql-rails-blog$ |
| 73 | + |
| 74 | +- Run Bundler to install/bundle gems needed by the project: |
| 75 | + |
| 76 | + graphql-rails-blog$ bundle |
| 77 | + |
| 78 | +- Create the database: |
| 79 | + |
| 80 | + graphql-rails-blog$ rails db:migrate |
| 81 | + |
| 82 | +- Load sample records: |
| 83 | + |
| 84 | + graphql-rails-blog$ rails db:seed |
| 85 | + |
| 86 | +- Run the Rails server in development mode |
| 87 | + |
| 88 | + graphql-rails-blog$ rails server |
| 89 | + |
| 90 | +- Run Yarn to install javascript package in other terminal: |
| 91 | + |
| 92 | + graphql-rails-blog$ cd client |
| 93 | + graphql-rails-blog/client$ yarn |
| 94 | + |
| 95 | +- Start client in development mode. You should be able to go to |
| 96 | +`http://localhost:8080` : |
| 97 | + |
| 98 | + graphql-rails-blog/client$ npm start |
| 99 | + |
| 100 | +## Next step |
| 101 | + |
| 102 | +- [ ] Upgrade to last version of Apollo. Until now I had to downgrade to version 0.5.21 because of a bug on *updatequeries* ([https://github.com/apollographql/apollo-client/issues/1129](https://github.com/apollographql/apollo-client/issues/1129)) |
| 103 | +- [ ] Use [query batching in Apollo](https://dev-blog.apollodata.com/query-batching-in-apollo-63acfd859862#.dusr3dyde). Until now GraphQL-Ruby does not support this functionality in a simple way |
| 104 | +- [ ] Parallelism in GraphQL-Ruby |
| 105 | + |
| 106 | +## Screens |
| 107 | + |
| 108 | +#### Listing posts |
| 109 | +<img alt="Listing posts" src="https://d17oy1vhnax1f7.cloudfront.net/items/463k3o2E2l1Z3N1J3230/listing-posts.png?v=b0949e51" width="500"> |
| 110 | + |
| 111 | +#### Creating comments |
| 112 | +<img alt="Creating comments" src="https://d3uepj124s5rcx.cloudfront.net/items/152S143C2l1a2r0N2n37/creating-comments.png?v=b8dfc71e" width="500"> |
| 113 | + |
| 114 | +#### Post page |
| 115 | +<img alt="Post page" src="https://d17oy1vhnax1f7.cloudfront.net/items/0G2h1l1v2b0I2y1t0j3F/get-post.png?v=6ae0993c" width="500"> |
| 116 | + |
| 117 | +## License |
| 118 | + |
| 119 | +MIT © [Matthieu Segret](http://matthieusegret.com) |
0 commit comments