{"id":22128040,"url":"https://github.com/fredvuni/nest-js-playground","last_synced_at":"2026-04-15T14:02:10.262Z","repository":{"id":164788053,"uuid":"639726940","full_name":"FREDVUNI/nest-js-playground","owner":"FREDVUNI","description":"A compilation of different things in nest js ","archived":false,"fork":false,"pushed_at":"2023-05-17T05:38:36.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-29T14:12:40.091Z","etag":null,"topics":["express","mysql","nestjs","postgresql","prisma","typeorm"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FREDVUNI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-12T05:06:03.000Z","updated_at":"2023-05-12T05:31:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"e4264798-c751-4429-856a-9dfbc0431960","html_url":"https://github.com/FREDVUNI/nest-js-playground","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FREDVUNI%2Fnest-js-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FREDVUNI%2Fnest-js-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FREDVUNI%2Fnest-js-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FREDVUNI%2Fnest-js-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FREDVUNI","download_url":"https://codeload.github.com/FREDVUNI/nest-js-playground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245238222,"owners_count":20582824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","mysql","nestjs","postgresql","prisma","typeorm"],"created_at":"2024-12-01T17:33:53.542Z","updated_at":"2026-04-15T14:02:10.190Z","avatar_url":"https://github.com/FREDVUNI.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NestJS: A Compilation of Different Things\n\nNestJS is a progressive Node.js framework that is designed to build efficient and scalable server-side applications. It is built with TypeScript and uses modern JavaScript features, making it a powerful tool for building complex web applications.\n\nThis readme file is a compilation of different things that you can do with NestJS, including installation, basic usage, and some advanced topics.\n\n## Note\n\nThis repo is mostly for anything nest JS - Nothing's really set up to run the entire nest JS APP\n\n## Installation\n\nTo get started with NestJS, you first need to install it. You can install NestJS using either `npm` or `yarn`.\n\n### Installing NestJS using npm\n\nTo install NestJS using npm, run the following command:\n\n```\nnpm install --save @nestjs/core @nestjs/common @nestjs/platform-express\n```\n\n### Installing NestJS using yarn\n\nTo install NestJS using yarn, run the following command:\n\n```\nyarn add @nestjs/core @nestjs/common @nestjs/platform-express\n```\n\n## Basic Usage\n\nOnce you have installed NestJS, you can create a new project using the `nest new` command. This will create a new NestJS project with a basic directory structure and some example files.\n\n```\nnest new my-app\n```\n\n### Creating a Controller\n\nTo create a controller in NestJS, you can use the `@Controller()` decorator. This decorator takes an optional parameter that specifies the path prefix for all the routes defined in the controller.\n\n```typescript\nimport { Controller, Get } from '@nestjs/common';\n\n@Controller('hello')\nexport class HelloController {\n  @Get()\n  getHello(): string {\n    return 'Hello World!';\n  }\n}\n```\n\n### Creating a Service\n\nTo create a service in NestJS, you can use the `@Injectable()` decorator. This decorator marks the class as a provider that can be injected into other classes.\n\n```typescript\nimport { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class HelloService {\n  getHello(): string {\n    return 'Hello World!';\n  }\n}\n```\n\n### Injecting a Service into a Controller\n\nTo inject a service into a controller, you can use the `@Inject()` decorator in the constructor of the controller. This will automatically inject an instance of the service into the controller.\n\n```typescript\nimport { Controller, Get } from '@nestjs/common';\nimport { HelloService } from './hello.service';\n\n@Controller('hello')\nexport class HelloController {\n  constructor(private readonly helloService: HelloService) {}\n\n  @Get()\n  getHello(): string {\n    return this.helloService.getHello();\n  }\n}\n```\n\n## Advanced Topics\n\n### Authentication with Passport\n\nNestJS provides built-in support for authentication with the popular Passport library. To use Passport with NestJS, you can install the `@nestjs/passport` and `passport` packages.\n\n```npm install --save @nestjs/passport passport\n```\n\nOnce installed, you can create a Passport strategy and use it in a controller.\n\n```typescript\nimport { Injectable } from '@nestjs/common';\nimport { PassportStrategy } from '@nestjs/passport';\nimport { Strategy } from 'passport-local';\nimport { AuthService } from './auth.service';\n\n@Injectable()\nexport class LocalStrategy extends PassportStrategy(Strategy) {\n  constructor(private readonly authService: AuthService) {\n    super();\n  }\n\n  async validate(username: string, password: string): Promise\u003cany\u003e {\n    const user = await this.authService.validateUser(username, password);\n    if (!user) {\n      throw new UnauthorizedException();\n    }\n    return user;\n  }\n}\n```\n\n```typescript\nimport { Controller, Post, Request, UseGuards } from '@nestjs/common';\nimport { LocalAuthGuard } from './local-auth.guard';\n\n@Controller()\nexport class AuthController {\n  @UseGuards(LocalAuthGuard)\n  @Post('auth/login')\n}```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredvuni%2Fnest-js-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffredvuni%2Fnest-js-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredvuni%2Fnest-js-playground/lists"}