hackerz
hackerz copied to clipboard
Reason React Hacker News Demo
hackerz
Ultra high performance progressive web application built with React + Reason (hooks, react ppx 3), GraphQL (api and client) and rollup.
Features
- Progressive web app
- offline
- install prompts on supported platforms
- Server side rendering (including prefetching graphql queries for the current route)
- GraphQL (client using graphql-hooks)
- GrappQL (server, using reason-graphql)
- Rollup (dual bundling, module and nomodule)
- Now.sh 2.x
- Reason React (hooks, react ppx 3)
- Yarn (monorepo with workspaces)
- Routing (including ssr support, static routing)
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 8.11.3
and latest yarn, you can always have a look at the engines
section of the package.json
.
$ yarn (install)
$ yarn dev
After doing this, you'll have a server with hot-reloading (ui only) running at http://localhost:8004
You can also start in production.
$ yarn start
After doing this, you'll have a server running at http://localhost:8004
If working on the graphql server and want hot reloading
$ yarn dev-graphql
After doing this, you'll have a server with hot-reloading running at http://localhost:3000
When changing the graphql server schema
$ yarn send-introspection-query http://localhost:8004/api/graphql
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 lint
$ yarn build
$ yarn test
or
$ yarn ci
End to end tests
The end to end test go fetch latest news from the server and expect it to be found inside the homepage. Please check e2e/basic.test.js
for more details.
$ yarn e2e
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 commands
# force a deploy
$ now
# check all running instances
$ now ls
# check logs for a given instance
$ now logs hackerz.now.sh --all