This project demonstrates an authentication flow using NestJS, TypeORM, and JWT. It includes user registration, login, and protected routes.
-
Clone the repository:
git clone https://github.com/your-username/nestjs-auth-flow-blog-post.git cd nestjs-auth -
Install dependencies:
npm install
-
Set up the environment variables:
cp .env.example .env
-
Update the
.envfile with your database configuration.
-
Start the PostgreSQL database.
-
Run the application:
npm run start:dev
-
The application will be available at
http://localhost:3000.
The following environment variables are used in this project:
POSTGRES_HOST: Database hostPOSTGRES_PORT: Database portPOSTGRES_USER: Database userPOSTGRES_PASSWORD: Database passwordPOSTGRES_DB: Database name
start: Start the applicationstart:dev: Start the application in development modestart:debug: Start the application in debug modestart:prod: Start the application in production modebuild: Build the applicationformat: Format the code using Prettierlint: Lint the code using ESLinttest: Run unit teststest:watch: Run unit tests in watch modetest:cov: Run unit tests with coveragetest:debug: Run unit tests in debug modetest:integration: Set up integration teststest:e2e: Run end-to-end testsmigration:generate: Generate a new migrationtypeorm:migration:run: Run migrations
To run the tests, use the following command:
npm run testTo run the Integration tests using TestContainers, use the following command:
npm run test:integration