어쩌다보니 배그 관련 프로젝트를 4개나 만들었었다.
처음 프로젝트를 만들 때 공식 문서를 보니 모델도 많고, 조합해서 써야하는 경우도 많았다.
특히 타입스크립트로 만들 때 각 응답별로 모델을 만들 때 많은 시간이 들기도 했다.
NPM에 배그 관련 패키지들이 몇 개 있긴 한데, 대부분 7~8년 전에 만들어진 것들이라 현재 API와 호환이 안 되는 경우가 많다
그래서 만들었다.
타입스크립트도 지원하고, 각 응답별 모델도 지원하고, 손쉽게 API를 쓸 수 있는 NPM을.
https://github.com/smw0807/pubg-kit
공식문서를 하나하나 보면서 만들면 진짜 생각보다 많은 시간이 들기 때문에...
배틀그라운드 API를 이용한 애플리케이션을 만들 때 도움이 됐으면 하는 마음으로 만들었다.
특히 NestJS에서도 사용할 수 있도록 만들었다.
설치
npm install pubg-kit
순수 TypeScript / Node에서의 사용법
import { PubgClient } from 'pubg-kit';
const client = new PubgClient({ apiKey: 'YOUR_API_KEY' });
// platform을 동적으로 넘기면 if/else 없이 처리 가능
async function getPlayer(name: string, platform: string) {
return client.shard(platform).players.getByNames([name]);
}
const kakaoPlayer = await getPlayer('홍길동', 'kakao');
const steamPlayer = await getPlayer('shroud', 'steam');
NestJS에서의 사용법
// app.module.ts
import { PubgModule } from 'pubg-kit/nestjs';
@Module({
imports: [
PubgModule.forRoot({ apiKey: process.env.PUBG_API_KEY }),
],
})
export class AppModule {}
// player.service.ts
@Injectable()
export class PlayerService {
constructor(private readonly pubg: PubgService) {}
async getPlayer(name: string, platform: string) {
return this.pubg.shard(platform).players.getByNames([name]);
}
}
플레이어 정보, 스탯, 매치 정보, 텔레메트리 등 모든 API를 쉽게 받을 수 있도록 구현했다.
지원되는 엔드포인트
| Players | 이름 / ID로 플레이어 조회 |
| Matches | 매치 상세 데이터 조회 |
| Seasons | 시즌 목록 조회 |
| Stats | 시즌 스탯 / 랭크 스탯 / 평생 스탯 / 배치 조회 |
| Leaderboards | 리더보드 조회 (페이지네이션 지원) |
| Samples | 랜덤 샘플 매치 목록 |
| Telemetry | 텔레메트리 전체 / 이벤트 타입별 조회 |
| Mastery | 무기 / 생존 마스터리 |
| Clans | 클랜 정보 조회 |
| Status | API 서버 상태 확인 |
NPM에 배포 후 제일 먼저 내가 만들 었던 PUBG-API 프로젝트를 모두 pubg-kit으로 변경했다.
적용중에 발생했던 여러 버그들도 수정했고, 기존 기능이 이상없이 정상 작동하는 것을 확인했다.
https://github.com/smw0807/pubg-api
GitHub - smw0807/pubg-api: PUBG API
PUBG API. Contribute to smw0807/pubg-api development by creating an account on GitHub.
github.com
https://github.com/smw0807/pubg-kit
GitHub - smw0807/pubg-kit: TypeScript SDK for the official PUBG API with NestJS support
TypeScript SDK for the official PUBG API with NestJS support - smw0807/pubg-kit
github.com
'개인프로젝트' 카테고리의 다른 글
| [LLM] OpenClaw + 로컬LLM(Ollama) 후기 (0) | 2026.05.18 |
|---|---|
| 유튜브 타임라인 메모 크롬 확장프로그램 배포 (0) | 2026.04.18 |
| [NPM] 레디스 GUI - redis-eye (2) | 2026.04.10 |
| [토이프로젝트] 유튜브 타임라인 메모 서비스 (2) | 2026.04.02 |
| [토이프로젝트] 경매 사이트 (0) | 2026.02.27 |