NestJS Rest-Api powered by AWS RDS PostgreSQl
- Create .env file in the root and copy & paste mocked data from .sample-env
- Edit .env file by writing correct credentials and other connection data
- Run
yarn start:dev
(npm run start:dev
) for development oryarn start
(npm start
) to up the server - Connect to swagger using
http://localhost:3000/docs
url. Provide simple auth typingsecret
inx-auth-key
input
- Change any entity class and save file
- Run
NAME=Init npm run generate-migration
to generate a migration. Use custom names that are clear and correspond to table changes e.g.NAME=AddPhoneNumberColumnToUser npm run generate-migration
- Make sure the recently generated migration is in
migrations
folder - Run
npm run run-migration
to apply migrations to the database - If you want to revert a migration, run
npm run revert-migration
, but note: it cancels the last migration
If you make git clone
or git pull
in a project, you should run all migrations (if there are some changes in tables
made by another dev) before development starting
Do not use TABLE_SCHEMA_AUTOUPDATE=true
in prod
- Create an RDS Postgresql instance;
- Connect to RDS and create a database;
- Edit
scripts/install_project_dependencies.sh
by replacing your env variables; - Create an EC2 instance based on Amazon Linux and provide this script to
user data
input while creation to install the CodeDeploy Agent:
#!/bin/bash
sudo yum -y update
sudo yum -y install ruby
sudo yum -y install wget
sudo wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/install
sudo chmod +x ./install
sudo ./install auto