{"id":28085621,"url":"https://github.com/leocodeio/common-njs","last_synced_at":"2025-10-19T23:12:04.211Z","repository":{"id":292680809,"uuid":"981606034","full_name":"leocodeio/common-njs","owner":"leocodeio","description":"common starter nest application","archived":false,"fork":false,"pushed_at":"2025-05-11T14:20:53.000Z","size":283,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-11T15:21:21.969Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/leocodeio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2025-05-11T13:46:27.000Z","updated_at":"2025-05-11T14:20:50.000Z","dependencies_parsed_at":"2025-05-11T15:21:28.475Z","dependency_job_id":"20a6866c-ede7-4ed4-a4e3-bd83171ac8db","html_url":"https://github.com/leocodeio/common-njs","commit_stats":null,"previous_names":["leocodeio/common-njs"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocodeio%2Fcommon-njs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocodeio%2Fcommon-njs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocodeio%2Fcommon-njs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocodeio%2Fcommon-njs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leocodeio","download_url":"https://codeload.github.com/leocodeio/common-njs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253924590,"owners_count":21985141,"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":[],"created_at":"2025-05-13T10:39:57.618Z","updated_at":"2025-10-19T23:11:59.191Z","avatar_url":"https://github.com/leocodeio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## how to use\n\n```bash\ngit clone https://github.com/leocodeio/common-njs.git\ncd common-njs\npnpm install\n# install dependencies\npnpm add @nestjs/config @leocodeio-njs/njs-config helmet express-basic-auth joi class-validator class-transformer @leocodeio-njs/njs-logging @leocodeio-njs/njs-health @nestjs/typeorm typeorm husky @commitlint/cli @commitlint/config-conventional @commitlint/cz-commitlint @semantic-release/commit-analyzer @semantic-release/github @semantic-release/npm @semantic-release/release-notes-generator @semantic-release/git husky semantic-release\n```\n\n## things to add\n\n- add configservice to app module\n\napp.module.ts\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { ConfigModule } from '@nestjs/config';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\nimport {\n  LogEntry,\n  LoggingInterceptor,\n  LoggingModule,\n  PerformanceInterceptor,\n  ResponseInterceptor,\n} from '@leocodeio-njs/njs-logging';\nimport { HealthModule, PrometheusService } from '@leocodeio-njs/njs-health';\nimport { AppConfigModule } from '@leocodeio-njs/njs-config';\nimport { AppConfigService } from '@leocodeio-njs/njs-config';\nimport { TypeOrmModule } from '@nestjs/typeorm';\n\n@Module({\n  imports: [\n    ConfigModule.forRoot({\n      isGlobal: true,\n    }),\n    LoggingModule.forRoot({\n      entities: [LogEntry],\n      winston: {\n        console: true,\n        file: {\n          enabled: true,\n        },\n      },\n    }),\n    TypeOrmModule.forRootAsync({\n      imports: [AppConfigModule],\n      inject: [AppConfigService],\n      useFactory: (configService: AppConfigService) =\u003e ({\n        ...configService.databaseConfig,\n        entities: [__dirname + '/**/*.entity{.ts,.js}'],\n        migrations: [__dirname + '/database/migrations/**/*{.ts,.js}'],\n        migrationsRun: true,\n        synchronize: true,\n        autoLoadEntities: true,\n      }),\n    }),\n    TypeOrmModule.forFeature([LogEntry]),\n    HealthModule,\n  ],\n  controllers: [AppController],\n  providers: [\n    AppService,\n    PrometheusService,\n    {\n      provide: 'APP_INTERCEPTOR',\n      useClass: PerformanceInterceptor,\n    },\n    {\n      provide: 'APP_INTERCEPTOR',\n      useClass: ResponseInterceptor,\n    },\n    {\n      provide: 'APP_INTERCEPTOR',\n      useClass: LoggingInterceptor,\n    },\n  ],\n})\nexport class AppModule {}\n```\nmain.ts\n\n```typescript\nimport { NestFactory } from '@nestjs/core';\nimport { ValidationPipe, VersioningType } from '@nestjs/common';\nimport { ConfigService } from '@nestjs/config';\nimport { AppModule } from './app.module';\nimport { BootstrapConfig } from '@leocodeio-njs/njs-config';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule);\n  const configService = app.get(ConfigService);\n  const bootstrapConfig = new BootstrapConfig();\n\n  app.useGlobalPipes(new ValidationPipe({ transform: true }));\n\n  app.enableVersioning({\n    type: VersioningType.URI,\n    defaultVersion: configService.get('API_VERSION'),\n    prefix: 'v',\n  });\n\n  bootstrapConfig.setupHelmet(app);\n  // bootstrapConfig.setupCors(app);\n  bootstrapConfig.setupSwagger(app);\n\n  console.log('application running on port', configService.get('PORT'));\n  await app.listen(configService.get('PORT') as number);\n}\nbootstrap();\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocodeio%2Fcommon-njs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleocodeio%2Fcommon-njs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocodeio%2Fcommon-njs/lists"}