This is my take on coding along with the Ben Awad's Full Stack React GraphQL TypeScript Tutorial
cdintobackendfolder.- Create
.envand.docker.envfiles (see.env.example)..docker.envfile is used bydocker-run-*scripts. - Two options:
- Run server locally:
- Run
./docker-run-db.shto bring up PostgreSQL and Redis databases. - Run
yarn watchto compile TypeScript code into runnable JavaScript. - Run
yarn devto start backend server.
- Run
- Run server via docker:
- Run
./docker-run-all--build.shto bring up PostgreSQL and Redis databases and to build and run server image. Run this if you make any changes to the code and want to test these changes in docker. - Run
./docker-run-all.shto bring up PostgreSQL and Redis databases and to run previously built server image. If the image has never been built before,docker-composewill build it for you, otherwise it will reuse the last built image that may not include your latest changes to the code.
- Run
- Run server locally:
cdintofrontendfolder.- Create
.envand.docker.envfiles (see.env.example)..docker.envfile is used bydocker-run-*scripts. - Two options:
- Run frontend locally:
- Run
yarn codegen:watchto start GraphQL Code Generator (optional if you don't changegraphql/**/*.tsxfiles that contain queries and mutations). - Run
yarn devto start NextJS server that will serve the UI.
- Run
- Run frontend via docker:
- Run
./docker-run--build.shto build and run frontend image. Run this if you make any changes to the code and want to test these changes in docker. - Run
./docker-run.shto run previously built frontend image. If the image has never been built before,docker-composewill build it for you, otherwise it will reuse the last built image that may not include your latest changes to the code.
- Run
- Run frontend locally:
- I'm using prisma instead of MikroORM and TypeORM that Ben uses in tutorial. IMO it's much nicer to use and supports all required features out of the box without the need to resolve to writing raw SQL code.
- I'm using Apollo Client instead of urql, IMO developer experience is much nicer with Apollo (although SSR setup is a little bit more involved), just look how Ben struggles with the cache updates.