Skip to content
Back to skills

Configuration

ASecurity

Environment variables validation and ConfigModule setup.

  • 8 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
ai-agentstypescriptnodegitdatabase

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add ngxtm/devkit --skill configuration --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Configuration?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Configuration
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ngxtm-configuration/badge)](https://www.skillsdirectory.com/skills/ngxtm-configuration)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: NestJS Configuration
description: Environment variables validation and ConfigModule setup.
metadata:
  labels: [nestjs, config, env]
  triggers:
    files: ['.env', 'app.module.ts', '**/config.ts']
    keywords: [ConfigModule, Joi, env]
---

# NestJS Configuration Standards

## Setup

1. **Library**: Use `@nestjs/config`.
2. **Initialization**: Import `ConfigModule.forRoot({ isGlobal: true })` in `AppModule`.

## Validation

- **Mandatory**: Validate environment variables at startup.
- **Tool**: Use `joi` or a custom validation class.
- **Effect**: The app **must crash** immediately if a required env var (e.g., `DB_URL`) is missing.

```typescript
// app.module.ts
ConfigModule.forRoot({
  validationSchema: Joi.object({
    NODE_ENV: Joi.string()
      .valid('development', 'production')
      .default('development'),
    PORT: Joi.number().default(3000),
    DATABASE_URL: Joi.string().required(),
  }),
});
```

## Usage

- **Injection**: Inject `ConfigService` to access values.
- **Typing**: Avoid magic strings. Use a type-safe getter helper or a dedicated configuration object/interface.
- **Secrets**: Never commit `.env` files. Add `.env*` to `.gitignore`.

Files in this skill

  • SKILL.md1.2 KB
  • references/REFERENCE.md344 B
  • references/config-patterns.md3.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…