Welcome to your NestJS + SQL (TypeORM)
Project Setup
This page guides you through the essential steps to set up and run your project.
Prerequisites:
- Node.js (version 16 or later) and npm (or yarn) installed.
- A supported SQL database (MySQL, PostgreSQL, etc.) with a running instance.
- Basic familiarity with NestJS and TypeORM concepts.
1. Installation:
bash
npm install
or
bash
yarn install
2. Environment Variables:
There is a .env
file in the root of your project and update the following variables with your actual database and email credentials:
DB_URL=
DB_HOST=
DB_PORT=
DB_USER=
DB_PASS=
DB_NAME=
NODEMAILER_HOST=
NODEMAILER_PORT=
NODEMAILER_USER=
NODEMAILER_PASS=
FROM_EMAIL=
FRONT_END_URL=
3. Database Configuration:
The database configuration is located in src/config/typeorm.config.ts
. Adjust it according to your database type and credentials. Refer to the TypeORM documentation for detailed configuration options.
4. Run Migration:
bash
npm run migration-generate
npm run migration-run
or
bash
yarn migration-generate
yarn migration-run
4. Running the Application:
Development:
bash
npm run start:dev
or
bash
yarn start:dev
Production:
bash
npm run build
npm run start:prod
5. Accessing the Swagger API Document:
Open Swagger API document by entering this URL http://localhost:3000/api-docs
.