npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

swagshot

v0.1.1

Published

Swagger-powered API & type generator

Readme

swagshot

Swagger/OpenAPI 스펙으로 TypeScript API 함수와 타입 정의를 자동 생성하는 CLI 툴.

프로젝트 구조를 자동 감지해서 기존 코드 스타일에 맞는 코드를 생성합니다.

특징

  • 프로젝트 구조 자동 감지 — API 폴더, 타입 폴더, axios 인스턴스, react-query 등
  • Swagger 2.0 / OpenAPI 3.0 모두 지원 (Spring Boot, NestJS 등)
  • axios / fetch 스타일 코드 생성
  • 커스텀 axios 인스턴스 자동 연결
  • deprecated 엔드포인트 자동 제외

설치 없이 바로 사용

npx swagshot <command>

사용법

1. 프로젝트 초기 설정 (처음 한 번만)

프로젝트 루트에서 실행:

cd /your/project
npx swagshot init

프로젝트 구조를 자동으로 감지하고 .swagshot.json 설정 파일을 생성합니다.

👋 swagshot 초기 설정을 시작합니다.
📂 프로젝트 루트: /your/project

자동 감지 결과를 확인해주세요. Enter를 누르면 기본값 사용:

Swagger JSON URL (기본값: ):
API 함수 폴더 (기본값: src/api):
타입 정의 폴더 (기본값: src/types):
...

2. 컨트롤러 목록 확인

npx swagshot list --url "https://api.example.com/v2/api-docs"
📋 컨트롤러 태그 목록 (12개):

  1. auth-controller
  2. payment-controller
  3. order-controller
  ...

3. 코드 생성

# 특정 컨트롤러만
npx swagshot generate --url "https://api.example.com/v2/api-docs" --tag payment-controller

# 전체 생성
npx swagshot generate --url "https://api.example.com/v2/api-docs" --all

# deprecated 포함
npx swagshot generate --url "https://api.example.com/v2/api-docs" --tag payment-controller --include-deprecated

4. 설정 변경

npx swagshot config set apiDir src/services
npx swagshot config set httpClient fetch
npx swagshot config set axiosInstance src/lib/fetcher.ts

생성 결과 예시

payment-controller 기준으로 두 파일이 생성됩니다.

src/types/payment.ts

// Auto-generated by swagshot
// Tag: payment-controller
// Do not edit manually

export interface PaymentHistoryResponse {
  id: number;
  price: number;
  status: string;
  createdAt: string;
}

export interface GetHistoryUsingGETParams {
  startDateTime: string;
  endDateTime: string;
  payment_product_types?: string[];
}

src/api/payment.ts

// Auto-generated by swagshot
// Tag: payment-controller
// Do not edit manually

import fetcher from '../lib/fetcher';
import type { PaymentHistoryResponse, GetHistoryUsingGETParams } from '../types/payment';

/** 결제 히스토리 조회 */
export const getHistory = (params: GetHistoryUsingGETParams) =>
  fetcher.get<PaymentHistoryResponse[]>(`/v2/payments/history`, { params });

/** 결제 히스토리 상세 조회 */
export const getPaymentHistory = (paymentHistoryId: number) =>
  fetcher.get<PaymentHistoryResponse>(`/v2/payments/history/${paymentHistoryId}`);

설정 파일 (.swagshot.json)

{
  "version": "1",
  "project": {
    "root": "/your/project",
    "apiDir": "src/api",
    "typesDir": "src/types",
    "hooksDir": null,
    "outputDir": "src/api"
  },
  "style": {
    "httpClient": "axios",
    "axiosInstance": "src/lib/fetcher.ts",
    "queryLibrary": "react-query",
    "namingConvention": "camelCase"
  },
  "swagger": {
    "url": "https://api.example.com/v2/api-docs"
  }
}

.swagshot.json.gitignore에 추가를 권장합니다.

Swagger JSON URL 찾는 법

Swagger UI 페이지 URL이 아닌, JSON 스펙 URL이 필요합니다.

| 프레임워크 | JSON URL 패턴 | |-----------|--------------| | Spring Boot (springfox) | /v2/api-docs | | Spring Boot (springdoc) | /v3/api-docs | | NestJS | /api-json |

전체 커맨드

npx swagshot init                          # 프로젝트 초기 설정
npx swagshot list --url <url>              # 컨트롤러 목록 조회
npx swagshot generate --url <url> --tag <tag>   # 특정 컨트롤러 생성
npx swagshot generate --url <url> --all    # 전체 생성
npx swagshot config set <key> <value>      # 설정 변경

개발 환경 설정

git clone https://github.com/Jyophie/swagshot.git
cd swagshot
npm install
npm run build
node dist/cli/index.js --help

License

MIT