/react-postgraphile

React Apollo and Postgraphile

Primary LanguageTypeScript

React Postgraphile

🚧

A React app communicating with a Postgresql database Using Urql and Postgraphile's API generation.

    .+------+     +------+     +------+     +------+.
  .' |    .'|    /|     /|     |\     |\    |`.    | `.
 +---+--+'  |   +-+----+ |     | +----+-+   |  `+--+---+
 |   |  |   |   | |    | |     | |    | |   |   |  |   |
 | React|  <-> graphql.js| <-> Postgraphile <-> Postgresql
 |.'    | .'    |/     |/       \|     \|    `. |   `. |
 +------+'      +------    \     +------+      `+------+
                            \
                             \ +------+
                               |\     |\
                               | +----+-+
                               | |    | |
                               .Github API
                                \|     \|
                                 +------+

You'll need

  • Postgresql
  • react-postgraphile git clone https://github.com/skvale/react-postgraphile

Starting it

Start Postgres

# for MacOS
brew services start postgres
# or
# postgres -D /usr/local/var/postgres

Create a database:

createdb react_postgraphile

Populate it

psql -f database/create.sql -d react_postgraphile

Start Postgraphile to create a Graphql layer over the created database

yarn run postgraphile

You can check your Graphql out at localhost:5000/graphql

Generate the Types from the running schema

yarn run types:gen

Run the React app in a new terminal

yarn start