https://github.com/petrgrishin/config-decorator
PoC: simple config decorator with type casting, validation and env-driven out of the box
https://github.com/petrgrishin/config-decorator
config decorator dotenv env poc
Last synced: 4 months ago
JSON representation
PoC: simple config decorator with type casting, validation and env-driven out of the box
- Host: GitHub
- URL: https://github.com/petrgrishin/config-decorator
- Owner: petrgrishin
- Created: 2022-10-18T17:26:45.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-07-22T14:04:02.000Z (11 months ago)
- Last Synced: 2025-10-10T01:33:56.031Z (8 months ago)
- Topics: config, decorator, dotenv, env, poc
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/config-decorator
- Size: 1.29 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# config-decorator
PoC: simple config decorator with type casting, validation and env-driven out of the box
## TL;DR
```bash
npm i config-decorator
```
```typescript
import { Config, Nullable, Option } from 'config-decorator';
@Config('app')
export class AppConfig {
@Option({
type: 'number',
default: 3000,
})
@Nullable()
public readonly port!: number;
}
const appConfig = new AppConfig();
console.log(appConfig.port);
// 3000
```
Environment:
```dotenv
APP_PORT=3000
```