reason-graphql-demo
reason-graphql-demo copied to clipboard
Ultra high performance progressive web application built with React + Reason (with hooks) and Next.js.
reason-graphql-demo
Originated from: https://github.com/peggyrayzis/redux-to-graphql
View the application Go to a specific reddit
Ultra high performance progressive web application built with React + Reason (with hooks) and Next.js.
Features
- Progressive web app
- offline
- install prompts on supported platforms
- Server side rendering
- Next.js 9 (canary)
- Webpack 4.x
- Babel 7.x
- Now.sh 2.x
- Reason React (latest release with hooks)
- Yarn (monorepo with workspaces)
Things to know
- A production build is deployed from a merge to master
- A staging build is deployed from a PR against master
Setting the project up locally
First of all make sure you are using node 10.15.3 (any node 10.x would also do) and latest yarn, you can always have a look at the engines section of the package.json. Why node 8.10. We are using Now.sh to make the app available online and underneath it's using AWS lambda and you have to use Node 8.
$ yarn (install)
$ yarn dev
After doing this, you'll have a server with hot-reloading running at http://localhost:3000 and a graphql server running at http://localhost:3000/api/graphql.
When changing the graphql server schema
$ yarn dev
$ yarn update-graphql-schema
Setting up your editor for reasonml
Go install this plugin from the vscode market: here. The plugin is called reason-vscode from Jared Forsyth. For more editors go see this guide.
Run tests and friends
We don't want to use snapshots, we use also use react-testing-library to avoid having to use enzyme and to enforce best test practices.
$ yarn format
$ yarn typecheck
$ yarn lint
$ yarn test
or
$ yarn ci
Troubleshooting
If you have any issue while running this sample app, open an issue or often just running yarn clean && yarn build:reason will help resolve issues.
End to end tests
We use cypress. Please check e2e for more details.
If you wan to add a new test use the following command and wait for cypress to open
yarn e2e-build
yarn start
yarn workspace @dblechoc/e2e cypress open
Storybook
This is where we list all our components (comes with hot reloading)
$ yarn storybook
After doing this, you'll have a showcase page running at http://localhost:6006
CI
We are using Github Actions.
Useful Now.sh commands
# force a deploy
$ yarn now
# check all running instances
$ yarn now ls
# check logs for a given instance
$ yarn now logs reason-graphql-demo.now.sh --all