npm install
For the application to run, you need to set up the following dependencies.
Install PostgreSQL and create a database for the application.
Link to download PostgreSQL: PostgreSQL
Create an S3 bucket in AWS and set up the required permissions.
Create an email account for sending emails. For example, you can use Gmail.
- First create a Gmail account.
- Create an Google app password. How to: App passwords
- Use the email and the app password in the environment variables.
After finishing the setup, create a .env
file in the root directory of the project and add the required environment variables.
- APP_ENV: For development, set it to development and for production, set it to production. Example: APP_ENV=development
- APP_PORT: The port on which the application will run. Example: APP_PORT=3000
- DB_HOST: The host of the database. Example: DB_HOST=localhost
- DB_PORT: The port of the database. Example: DB_PORT=5432
- DB_NAME: The name of the database. Example: DB_NAME=database_name
- DB_USER: The username of the database. Example: DB_USER=username
- DB_PASS: The password of the database. Example: DB_PASSWORD=password
- DB_URL: The URL of the database. Example: DATABASE_URL=postgresql://username:password@localhost:5432/database_name
- DB_SHADOW_URL: The URL of the shadow database. This is used for migrations. Example: DB_SHADOW_URL=postgresql://username:password@localhost:5432/database_name
- AUTH_SECRET: The secret key used for JWT token generation. Example: AUTH_SECRET=secret
- AUTH_ACCESS_TOKEN_LIFE_SEC: The life of the access token in seconds. Example: AUTH_ACCESS=604800
- AUTH_REFRESH_TOKEN_LIFE_SEC: The life of the refresh token in seconds. Example: AUTH_REFRESH_TOKEN_LIFE_SEC=604800
- TOKEN_LIFE_SEC: The life of the email verification token and password reset token in seconds. Example: TOKEN_LIFE_SEC=604800
- TOKEN_PASSWORD_RESET_RENEWAL_SEC: The time in seconds after which the password reset token can be renewed. Example: TOKEN_PASSWORD_RESET_RENEWAL_SEC=604800
- TOKEN_EMAIL_VERIFICATION_RENEWAL_SEC: The time in seconds after which the email verification token can be renewed. Example: TOKEN_EMAIL_VERIFICATION_RENEWAL_SEC=604800
- TOKEN_DISABLE_HASHING: Set to true to disable hashing of the token. Example: TOKEN_DISABLE_HASHING=false
- EMAIL_HOST: The host of the email service. Example: EMAIL_HOST=smtp.gmail.com
- EMAIL_PORT: The port of the email service. Example: EMAIL_PORT=587
- EMAIL_USER: The username of the email service. Example: EMAIL_USER=username
- EMAIL_PASSWORD: The password of the email service. Example: EMAIL_PASSWORD=password
- EMAIL_DEFAULT_FROM: The default email address from which the emails will be sent. Example: "'My Cinema Website' noreply.cinemaweb@gmail.com"
- FILE_ENDPOINT: The endpoint of the S3 storage service. Example: FILE_ENDPOINT=http://localhost:3001
- FILE_REGION: The region of the S3 storage service. Example: FILE_REGION=us-east-1
- FILE_ACCESS_KEY: The access key of the S3 storage service. Example: FILE_ACCESS
- FILE_SECRET_KEY: The secret key of the S3 storage service. Example: FILE_SECRET_KEY=secret
- FILE_BUCKET_NAME: The name of the bucket in the S3 storage service. Example: FILE_BUCKET_NAME=bucket_name
To generate fake data, run the following command:
npm run prisma:reset-and-seed
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod