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

@nepse-toolkit/api

v0.2.5

Published

REST API server for Nepal Stock Exchange data and analysis

Downloads

738

Readme

@nepse-toolkit/api

REST API server for Nepal Stock Exchange data and analysis.

Part of the nepse-toolkit monorepo.

Overview

  • Hono-based API with market, stock, analysis, portfolio, and provider routes
  • Multi-provider failover via @nepse-toolkit/core
  • Built-in telemetry capture worker with anomaly monitoring
  • Optional API guardrails: API key auth, CORS allowlist, and rate limiting

Install

npm install @nepse-toolkit/api

Quick Start

# from monorepo root
bun run build
bun run api

# Docker
# docker build -t nepse-api .
# docker run -p 3000:3000 nepse-api

Server listens on PORT (default 3000).

Environment

Core

PORT=3000

API Security

API_AUTH_KEY=...                           # optional, require x-api-key on all routes except /health
API_CORS_ORIGINS=https://app.example.com,https://admin.example.com   # optional allowlist; default allows all origins
API_RATE_LIMIT_ENABLED=false               # default false
API_RATE_LIMIT_WINDOW_SECONDS=60           # request window when enabled
API_RATE_LIMIT_MAX_REQUESTS=120            # max requests per key/ip per window when enabled

Telemetry Worker

PAYLOAD_TELEMETRY_WORKER_ENABLED=true
PAYLOAD_TELEMETRY_WORKER_INTERVAL_MINUTES=15
PAYLOAD_TELEMETRY_WORKER_LIMIT_ENDPOINTS=100
PAYLOAD_TELEMETRY_WORKER_RUN_ON_START=true
PAYLOAD_TELEMETRY_RETENTION_ENABLED=true
PAYLOAD_TELEMETRY_RETENTION_DAYS=30
PAYLOAD_TELEMETRY_ANOMALY_ALERTS_ENABLED=true
PAYLOAD_TELEMETRY_ANOMALY_WINDOW_HOURS=24
PAYLOAD_TELEMETRY_ANOMALY_TOP_ENDPOINTS=20
PAYLOAD_TELEMETRY_ANOMALY_MIN_SAMPLES=20
PAYLOAD_TELEMETRY_ANOMALY_MIN_FAILURES=3
PAYLOAD_TELEMETRY_ANOMALY_FAILURE_RATE=0.2
PAYLOAD_TELEMETRY_ANOMALY_COOLDOWN_MINUTES=60
PAYLOAD_TELEMETRY_ALERT_WEBHOOK_URL=https://alerts.example.com/webhook
PAYLOAD_TELEMETRY_ALERT_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
PAYLOAD_TELEMETRY_ALERT_EMAIL_WEBHOOK_URL=https://mailer.example.com/send
[email protected]
PAYLOAD_TELEMETRY_ALERT_DELIVERY_TIMEOUT_MS=8000
PAYLOAD_TELEMETRY_ALERT_DELIVERY_MAX_ATTEMPTS=3
PAYLOAD_TELEMETRY_ALERT_DELIVERY_RETRY_DELAY_MS=1000
PAYLOAD_TELEMETRY_ALERT_DEAD_LETTER_ENABLED=true

Route Groups

  • /health
  • /api/v1/market
  • /api/v1/stocks
  • /api/v1/analysis
  • /api/v1/portfolio
  • /api/v1/watchlists
  • /api/v1/alerts
  • /api/v1/backtest
  • /api/v1/providers

Provider telemetry alert-management routes:

  • GET /api/v1/providers/payload-telemetry/alerts/sinks
  • PUT /api/v1/providers/payload-telemetry/alerts/sinks
  • DELETE /api/v1/providers/payload-telemetry/alerts/sinks/:id
  • GET /api/v1/providers/payload-telemetry/alerts/controls
  • PUT /api/v1/providers/payload-telemetry/alerts/controls
  • DELETE /api/v1/providers/payload-telemetry/alerts/controls
  • POST /api/v1/providers/payload-telemetry/prune?retentionDays=30
  • GET /api/v1/providers/payload-telemetry/alerts/dead-letters
  • POST /api/v1/providers/payload-telemetry/alerts/dead-letters/:id/resolve

For full endpoint examples and payload shapes, see the root README.

Development

bun --filter @nepse-toolkit/api run build
bun --filter @nepse-toolkit/api run typecheck
bun test packages/api/tests/

License

MIT