A study project for a little market
Frontend - React
Backend - NestJS
Database - Postgres
ORM - TypeORM
The database and admin tools (pgAdmin) moved to Docker
To start to use the following command:
docker-compose -f docker-compose.dev.yml up --build
The database tool pgadmin - http://localhost:5555
it is necessary to create a database server.
For details see ormconfig.env in server folder.
All the data needeed for the database connection is in ormconfig.env file This file is in server folder.
Config example:
TYPEORM_CONNECTION = postgres # For a local - localhost # If you use nginx - postgres TYPEORM_HOST = postgres TYPEORM_USERNAME = postgres TYPEORM_PASSWORD = postgres TYPEORM_DATABASE = autoportal TYPEORM_PORT = 5432 TYPEORM_SYNCHRONIZE = false TYPEORM_LOGGING = false TYPEORM_MIGRATIONS=./dist/database/migrations/*.js TYPEORM_MIGRATIONS_DIR=./dist/database/migrations TYPEORM_ENTITIES=./dist/database/entities/*.entity.js TYPEORM_ENTITIES_DIR=./dist/database/entities
Variables PASSWORD, USER, DATABASE must match with the parameters in docker-compose.yml
Variables TYPEORM_MIGRATIONS, TYPEORM_MIGRATIONS_DIR, TYPEORM_ENTITIES, TYPEORM_ENTITIES_DIR
should point to specific parameters of the server application
To creation of the database tables it's necessary to run the following command:
npm run typeorm migration:run
To revert:
npm run typeorm migration:revert