{"id":17931013,"url":"https://github.com/iamnnort/nestjs-serializer","last_synced_at":"2026-03-05T15:01:49.168Z","repository":{"id":257822329,"uuid":"871409178","full_name":"iamnnort/nestjs-serializer","owner":"iamnnort","description":"Serialization module for NestJS - Efficient - Flexible - Streamlined","archived":false,"fork":false,"pushed_at":"2026-02-27T13:31:56.000Z","size":119,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-27T18:42:50.248Z","etag":null,"topics":["deserialization","dto","mapping","nestjs","serialization","serializer","transform"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@iamnnort/nestjs-serializer","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamnnort.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-11T22:52:50.000Z","updated_at":"2026-02-27T13:31:49.000Z","dependencies_parsed_at":"2025-04-13T15:27:56.551Z","dependency_job_id":"01d50f8d-182d-46fa-b145-caf730616d78","html_url":"https://github.com/iamnnort/nestjs-serializer","commit_stats":null,"previous_names":["iamnnort/nestjs-serializer"],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/iamnnort/nestjs-serializer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamnnort%2Fnestjs-serializer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamnnort%2Fnestjs-serializer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamnnort%2Fnestjs-serializer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamnnort%2Fnestjs-serializer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamnnort","download_url":"https://codeload.github.com/iamnnort/nestjs-serializer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamnnort%2Fnestjs-serializer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30132585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T14:41:47.141Z","status":"ssl_error","status_checked_at":"2026-03-05T14:41:21.567Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["deserialization","dto","mapping","nestjs","serialization","serializer","transform"],"created_at":"2024-10-28T21:19:04.176Z","updated_at":"2026-03-05T15:01:49.161Z","avatar_url":"https://github.com/iamnnort.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Info\n\nSerialization module for NestJS - Efficient - Flexible - Streamlined\n\n## Installation\n\n```bash\nyarn install @iamnnort/nestjs-serializer\n```\n\n## Usage\n\n```javascript\n\n// types.ts\n\nexport enum Scopes {\n  BASE = 'BASE',\n  FULL = 'FULL',\n}\n\n// model.ts\n\nimport { SerializeField } from '@iamnnort/nestjs-serializer';\nimport { Scopes } from './types';\n\nexport class Model {\n  @SerializeField([{ scopes: [Scopes.BASE] }])\n  id: number;\n\n  constructor(dto: { id: number }) {\n    this.id = dto.id;\n  }\n}\n\n// city.ts\n\nimport { SerializeField } from '@iamnnort/nestjs-serializer';\nimport { Model } from './model';\nimport { Scopes } from './types';\n\nexport class City extends Model {\n  @SerializeField([{ scopes: [Scopes.FULL] }])\n  name: string;\n\n  constructor(dto: { id: number; name: string }) {\n    super(dto);\n\n    this.name = dto.name;\n  }\n}\n\n// user.ts\n\nimport { SerializeField, SerializeRelation } from '@iamnnort/nestjs-serializer';\nimport { City } from './city';\nimport { Model } from './model';\nimport { Scopes } from './types';\n\nexport class User extends Model {\n  @SerializeField([{ scopes: [Scopes.FULL] }])\n  name: string;\n\n  @SerializeRelation([{ scopes: [Scopes.FULL], relationScopes: [Scopes.BASE, Scopes.FULL] }])\n  city: City;\n\n  constructor(dto: { id: number; name: string; city: City }) {\n    super(dto);\n\n    this.name = dto.name;\n    this.city = dto.city;\n  }\n}\n\n// controller.ts\n\nimport { Controller, Get, Post, UseInterceptors } from '@nestjs/common';\nimport { SerializerIdInterceptor, SerializerInterceptor } from '@iamnnort/nestjs-serializer';\nimport { User } from './user';\nimport { Scopes } from './types';\nimport { City } from './city';\n\n@Controller()\nexport class AppController {\n  @Get()\n  @UseInterceptors(SerializerInterceptor({ scopes: [Scopes.BASE] }))\n  search() {\n    const city = new City({\n      id: 1,\n      name: 'London',\n    });\n\n    const user = new User({\n      id: 1,\n      name: 'John',\n      city,\n    });\n\n    return [user];\n  }\n\n  @Get(':id')\n  @UseInterceptors(SerializerInterceptor({ scopes: [Scopes.BASE, Scopes.FULL] }))\n  get() {\n    const city = new City({\n      id: 1,\n      name: 'London',\n    });\n\n    const user = new User({\n      id: 1,\n      name: 'John',\n      city,\n    });\n\n    return user;\n  }\n\n  @Post()\n  @UseInterceptors(SerializerIdInterceptor)\n  create() {\n    const city = new City({\n      id: 1,\n      name: 'London',\n    });\n\n    const user = new User({\n      id: 1,\n      name: 'John',\n      city,\n    });\n\n    return user;\n  }\n}\n\n// module.ts\n\nimport { Module } from '@nestjs/common';\nimport { LoggerModule } from '@iamnnort/nestjs-logger';\nimport { SerializerModule } from '@iamnnort/nestjs-serializer';\nimport { Model } from './model';\nimport { AppController } from './controller';\n\n@Module({\n  imports: [\n    LoggerModule,\n    SerializerModule,\n  ],\n  controllers: [AppController],\n})\nexport class AppModule {}\n\n// index.ts\n\nimport { NestFactory } from '@nestjs/core';\nimport { LoggerService } from '@iamnnort/nestjs-logger';\nimport { AppModule } from './module';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule, {\n    bufferLogs: true,\n  });\n\n  app.useLogger(new LoggerService());\n\n  await app.listen(3000);\n}\n\nbootstrap();\n```\n\n## Output\n\n```bash\n[System] Application is starting...\n[System] Application started.\n[System] [Request] GET /\n[System] [Response] GET / 200 OK [{ id: 1 }]\n[System] [Request] GET /1\n[System] [Response] GET /1 200 OK [{ id: 1, name: \"John\", city: { id: 1, name: \"London\" } }]\n[System] [Request] POST /1\n[System] [Response] POST /1 201 Created { id: 1 }\n```\n\n## License\n\nThis project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamnnort%2Fnestjs-serializer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamnnort%2Fnestjs-serializer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamnnort%2Fnestjs-serializer/lists"}