{"id":14978687,"url":"https://github.com/alxevvv/nest-zod-config","last_synced_at":"2025-09-22T04:33:30.664Z","repository":{"id":180547563,"uuid":"664091723","full_name":"alxevvv/nest-zod-config","owner":"alxevvv","description":"Define NestJS configuration with validation and type safety using zod","archived":false,"fork":false,"pushed_at":"2023-11-01T08:52:30.000Z","size":96,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-06T02:34:34.066Z","etag":null,"topics":["config","configuration","dotenv","nest","nestjs","typescript","zod"],"latest_commit_sha":null,"homepage":"","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/alxevvv.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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-07-08T22:22:02.000Z","updated_at":"2025-02-27T15:07:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"581d3f5b-8e56-4873-a302-404b776ad08e","html_url":"https://github.com/alxevvv/nest-zod-config","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.2857142857142857,"last_synced_commit":"186a5a6a7d45f3039be760fc2463d839f1d476f4"},"previous_names":["alxevvv/nest-zod-config"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/alxevvv/nest-zod-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxevvv%2Fnest-zod-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxevvv%2Fnest-zod-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxevvv%2Fnest-zod-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxevvv%2Fnest-zod-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alxevvv","download_url":"https://codeload.github.com/alxevvv/nest-zod-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxevvv%2Fnest-zod-config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276347148,"owners_count":25626597,"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","status":"online","status_checked_at":"2025-09-22T02:00:08.972Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["config","configuration","dotenv","nest","nestjs","typescript","zod"],"created_at":"2024-09-24T13:58:11.781Z","updated_at":"2025-09-22T04:33:30.382Z","avatar_url":"https://github.com/alxevvv.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nest-zod-config\n\nDefine NestJS configuration with validation and type safety using zod\n\n## Install\n\n```\nnpm install zod nest-zod-config\n```\n\nIf you want to load configuration from `.env` file, also install\n[dotenv](https://github.com/motdotla/dotenv) package:\n\n```\nnpm install dotenv\n```\n\n## Example\n\n```properties\n# .env\n\nport=3000\nstr=something\n```\n\n### Usage in NestJS module\n\n```typescript\n// app.config.ts\n\nimport { Config } from 'nest-zod-config';\nimport { z } from 'zod';\n\nconst appConfigSchema = z.object({\n  port: z.number(),\n  str: z.string(),\n});\n\nexport class AppConfig extends Config(appConfigSchema) {}\n```\n\n```typescript\n// app.service.ts\n\nimport { Injectable } from '@nestjs/common';\n\nimport { AppConfig } from './app.config';\n\n@Injectable()\nexport class AppService {\n  constructor(private readonly config: AppConfig) {}\n\n  someMethod() {\n    // `this.config` now contains your configuration with types:\n    // { port: 3000, str: 'something' }\n  }\n}\n```\n\n```typescript\n// app.module.ts\n\nimport { ZodConfigModule, dotEnvLoader } from 'nest-zod-config';\n\nimport { AppConfig } from './app.config';\nimport { AppService } from './app.service';\n\n@Module({\n  imports: [\n    ZodConfigModule.forRootAsync({\n      config: AppConfig,\n      loader: dotEnvLoader(),\n    }),\n  ],\n  providers: [AppService],\n})\nexport class AppModule {}\n```\n\n### Usage outside of NestJS modules\n\nFor example in the `bootstrap` function before application creation:\n\n```typescript\n// main.ts\n\nimport { NestFactory } from '@nestjs/core';\nimport { dotEnvLoader, loadConfig } from 'nest-zod-config';\nimport { AppModule } from './app.module';\nimport { AppConfig } from './app.config';\n\nasync function bootstrap() {\n  const config = await loadConfig(AppConfig, dotEnvLoader());\n  const app = await NestFactory.create(AppModule);\n  await app.listen(config.PORT);\n}\n\nbootstrap();\n```\n\n## License\n\nLicensed under the MIT license. Copyright (c) 2023-present Vladislav Alexeev\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falxevvv%2Fnest-zod-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falxevvv%2Fnest-zod-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falxevvv%2Fnest-zod-config/lists"}