- ReactJs (Hooks) + Typescript, MaterialUI
- ExpressJs + Typescript
- Postgres, Sequelize, Sqitch db version control
- Docker
- Auth0
cdin to project directory where thedocker-compose.ymlfile is. There are no seperate (dev/production) compose files for this project.docker-compose build apidocker-compose build web
Step 2 and 3 are only required to run the first time you start the project, or whenever you add a new package.
docker-compose up
Stop docker-compose first, docker-compose down.
If you want to add a package for the client side:
cd frontendyarn add <package>docker-compose build web
If you want to add package for the server side:
cd backendyarn add <package>docker-compose build api
# If you want to generate migration files
1. cd migration
2. docker-compose run sqitch add <migration_file_name> -n <description>
ex: docker-compose run sqitch add quantity -n 'Add quantity column to inventories table'
This will generate a file called 'quantity.sql'
# Deploy
docker-compose run sqitch deploy db:pg://<pg_user>:<pg_password>@db:5432/inventa_db
# Revert
docker-compose run sqitch revert db:pg://<pg_user>:<pg_password>@db:5432/inventa_db
For this project, I used docker to run the tests. Create test docker containers locally to run the tests.
docker-compose -p tests up dbto set up the test database.docker-compose -p tests run --rm sqitch deploy db:pg://<pg_user>:<pg_password>@db:5432/inventa_dbto deploy to the test database.- Below:
# test all files
docker-compose -p tests run --rm api yarn test:unit
# test 1 file
docker-compose -p tests run --rm api yarn test:unit -- <file_name_to_test>
If you face duplicate errors then you need to clean up the test's docker volume:
docker psto get the container name.docker stop <container_name>, container name should be 'tests_db_1' unless you changed the name of the service.docker rm <container_name>, container name should be 'tests_db_1'docker volume lsto get the volume namedocker volume rm <volume_name>, volume name should be 'tests_postgres_data'