NestJS worker infra modules
npm install @jeonghochoi/core-workerbash
npm install @jeonghochoi/core-worker
or
yarn add @jeonghochoi/core-worker
`
> ⚠️ NestJS Worker 환경을 전제로 합니다.
---
📁 Project Structure
`
src
├─ core
│ ├─ config # 환경 변수 / 설정 관리
│ ├─ database # DB 어댑터 (mysql, pg, mssql)
│ ├─ http # HTTP Client (axios 기반)
│ ├─ logger # Pino 기반 로거
│ ├─ mail # Mail (SMTP / SES)
│ └─ index.ts
│
├─ tool
│ ├─ crypto # 암·복호화 / 해시 유틸
│ ├─ file # 파일 처리 / 업로드
│ ├─ tool # 범용 유틸
│ └─ index.ts
│
└─ index.ts # Public entry
`
---
🔗 Peer Dependencies
이 패키지는 아래 패키지를 호스트 프로젝트에서 직접 설치해야 합니다.
`json
{
"@nestjs/common": "^10 || ^11",
"@nestjs/config": "^3 || ^4"
}
`
> NestJS 메이저 버전에 직접 종속되지 않도록
> peerDependencies로 분리되어 있습니다.
---
📚 Included Dependencies
$3
- mysql2
- pg
- mssql
$3
- axios
- axios-retry
- rxjs
$3
- nodemailer
- handlebars
- @aws-sdk/client-ses
$3
- exceljs
- csv-stringify
- basic-ftp
- @aws-sdk/client-s3
$3
- pino
- zod
---
🚀 Usage
$3
`ts
import { logger } from '@jeonghochoi/core-worker';
`
`ts
logger.info('worker started');
`
$3
`ts
import { httpClient } from '@jeonghochoi/core-worker';
const res = await httpClient.get('/health');
`
$3
`ts
import { encrypt, decrypt } from '@jeonghochoi/core-worker/tool';
`
`ts
const encrypted = encrypt('secret');
`
> 실제 export API는 index.ts 기준으로 제공됩니다.
---
🛠 Build
`bash
npm run build
`
- tsup 기반 빌드
- ESM 패키지
- 결과물은 dist/ 디렉토리에 생성됩니다.
---
📐 Design Principles
- Worker 친화적 구조
- Stateless 설계 지향
- 비즈니스 로직 배제
- 인프라 코드의 재사용성과 일관성 우선
- API 서버보다 Batch / Queue / Scheduler 사용을 전제로 설계
---
⚠️ Notes
- API 서버에서도 사용은 가능하지만 일부 모듈은 워커 기준으로 설계됨
- 장기 실행 프로세스(daemon) 환경을 고려하여 작성됨
- Windows / Linux 환경 모두 대응
---
📄 License
MIT License
Copyright (c) 2026
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...
`
``