API and client apps (NestJS, React). Swagger API docs are available under /api/v1/api-docs URL (http://localhost:4000/api/v1/api-docs in dev mode).
Install Node, Yarn, Docker, Heroku CLI.
- add your user to
dockergroup by runningsudo usermod -a -G docker $USER(this gives ability to access docker engine withoutsudo) - completely log out from your account and log back in (if in doubt, reboot!)
- go to
/apps/apiand prepare.envfile with development configuration values for API app; this file is git-ignored and thus is missing after you pulled the repo, use.env-exampleas reference (most example values are for dev mode) - Create platform owner - follow steps Creating platform owner
- run
yarn --cwd ./apps/react-client run start - (in another terminal) run
yarn --cwd ./apps/api run start:dev(ignore docker error about already allocated port if any)
React client will be available under localhost:3000.
With default .env values (copied from .env-example) API will be available under localhost:4000.
If you set custom value for PORT (other than 4000), then you also have to make corresponding change to proxy field of /apps/react-client/package.json.
Apps will refresh/reload automatically after you make changes to source code.
Development MongoDB will be available under port 27017 on localhost.
MongoDB files will be stored in ~/dntsc_dev_mongo_db_data folder.
For now project is to be deployed/run on Heroku. Due to this, it is configured to work as single Node app (including serving/reverse proxying static assets of React client app). This works fine for MVP.
- go to
/apps/react-clientand prepare.envfile with prod configuration values for client app; this file is git-ignored and thus is missing after you pulled the repo, use.env-exampleas reference - go to Heroku WEB console, select the app, switch to settings tab and set all env vars (Config Vars), do not set
PORT(Heroku will set own one) - go to
/apps - run
heroku login - run
heroku container:login - run
heroku container:push web -a <Heroku app name> - run
heroku container:release web -a <Heroku app name>
For now platform owners are to be created manually.
- run
node ./apps/api/generate-password-hash.js <desired password>passing desired platform owner password as argument; this will print password hash - copy and save it somewhere to use in next steps - make sure API app was at least once successfully built and launched on target env (DB with schemas are created automatically after app first launch, we need those to exist when creating platform owner)
- connect to mongo directly (for dev mode see details below)
- run
use <app DB name>(use your own DB name that is specified in .env file, default dev DB name isdntsc-v1) - run
db.Employees.insert({name: '<desired name>', isActive: true, login: '<desired login>', roles: ['_PLATFORM_OWNER'], password: '<remembered password hash>'})(pass your own name, login and remembered password hash)
- go to
/apps/api - run
docker run -d -p 27017:27017 -v ~/dntsc_dev_mongo_db_data:/data/db mongo(skip this step if mongo container is already running) - run
docker psand remember ID of mongo container - run
docker exec -it <ID of mongo container> bash - you are inside mongo container terminal, finally run
mongo