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

@teamsparta/nodejs-external-logger

v1.2.0

Published

Amplitude, Hackle, MongoDB

Downloads

1,312

Readme

External Backend(NodeJS) Logger

Supports

Amplitude, Hackle, MongoDB

Need

Node.js 18 or higher to use built-in fetch

Usage

Type-safe by event schema

for example:

interface Events {
  event_1: {
    prop_a: string;
    prop_b: number;
  };
  event_2: {
    prop_c: string;
  };
}

const trackEvent = initExternalLogger<Events>(options);

// forcibly predefined schema key
trackEvent("event_1", properties /** typed properties by key */);

Options

type Option = {
  hackleKey?: string;
  amplitudeKey?: string;
  mongo?: {
    url: string;
    dbName: string;
    colName: string;
    lostColName?: string;
  };
  // user_utms 자동 부착용 별도 MongoDB connection
  userUtmsMongo?: {
    url: string;
  };
  slackWebHookUrlForFailAlarm?: string;
  getNow?: () => Date;
};

UTM 자동 부착 (with.utmLast, with.utmFirst)

서버사이드 이벤트에서 event_properties.utm_last / utm_first가 누락되는 문제를 해결합니다. 컨슈머는 옵션만 명시하면 SDK가 dbonline_v2.user_utms 컬렉션에서 actorId 기반으로 조회하여 payload에 자동 부착합니다.

사전 조건

  • MONGO_URI: 현재는 sparta-online 클러스터에 모으는 것이 컨벤션입니다.
  • Option.userUtmsMongo.urluser_utms 조회용 MongoDB connection이 구성되어 있어야 합니다.
  • 이벤트 호출 시 actorId가 전달되어야 합니다 (누락 시 enrichment 스킵).

사용 예시

const trackEvent = initExternalLogger<Events>({
  amplitudeKey: "...",
  mongo: { url: "...", dbName: "...", colName: "..." },
  userUtmsMongo: { url: "mongodb://..." },
});

trackEvent(
  "kdt_apply_paper_passed",
  { actorId, /* ...other props */ },
  { with: { utmLast: true, utmFirst: true } }
);

우선순위

eventProperties.utm_last (호출자 명시) > options.with.{utmLast,utmFirst} 자동 조회 > 미부착

호출자가 eventPropertiesutm_last/utm_first를 직접 넣은 경우, 자동 조회 결과를 덮어쓰지 않습니다.

실패 처리

user_utms 조회가 실패해도 트래커는 원본 payload로 정상 발화합니다. (에러는 stderr에 로깅)