Getting Started

  1. Download & Install Dependencies

    # Install dependencies
    $ yarn
    $ createdb name_of_your_db && createdb name_of_your_db_test

    Then search and replace name_of_your_db and name_of_your_db_test with your db name

    $ yarn run migrate:up
    $ yarn run migrate:up:test
    $ yarn start

Resources

Testing

yarn test

Database

create migration:

yarn run migrate create <name> --sql-file

Sometimes we change current migrations instead of adding new ones. In that case:

yarn resetdb

Install guide for generating TS types based on db schema

db:types

https://github.com/rmp135/sql-ts

File structure

Flow: schemas -> queries/mutations -> dataSources -> reducers -> queries

/schemas

This is where we have our graphql schema types layed out. We also define entry points for the query resolvers and mutations

/app/Queries

This is where we put our query resolvers. It should use StoreDataSources to manipulate the database, and DataSources to call external services

/app/Mutations

This is where we put our mutations. It should use StoreDataSources to manipulate the database, and DataSources to call external services

/app/StoreDataSource

This is where we manipulate the database

/app/DataSource

This is where we call external services

/app/Reducers

This is where we serialize data from the StoreDataSources