This is my take on coding along with the Ben Awad's Full Stack React GraphQL TypeScript Tutorial
cd
intobackend
folder.- Create
.env
and.docker.env
files (see.env.example
)..docker.env
file is used bydocker-run-*
scripts. - Two options:
- Run server locally:
- Run
./docker-run-db.sh
to bring up PostgreSQL and Redis databases. - Run
yarn watch
to compile TypeScript code into runnable JavaScript. - Run
yarn dev
to start backend server.
- Run
- Run server via docker:
- Run
./docker-run-all--build.sh
to 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.sh
to bring up PostgreSQL and Redis databases and to run previously built server image. If the image has never been built before,docker-compose
will 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:
cd
intofrontend
folder.- Create
.env
and.docker.env
files (see.env.example
)..docker.env
file is used bydocker-run-*
scripts. - Two options:
- Run frontend locally:
- Run
yarn codegen:watch
to start GraphQL Code Generator (optional if you don't changegraphql/**/*.tsx
files that contain queries and mutations). - Run
yarn dev
to start NextJS server that will serve the UI.
- Run
- Run frontend via docker:
- Run
./docker-run--build.sh
to 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.sh
to run previously built frontend image. If the image has never been built before,docker-compose
will 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.