API Documentation

Base URL: https://api.waelio.com (example)

Overview

This API provides read-only endpoints around npm package metadata and download stats. All endpoints support CORS (Access-Control-Allow-Origin: *). Authentication is not required.

Note: Deploy the backend separately (e.g., Deno Deploy) and map a hostname like api.waelio.com.

Health

GET /api/health
{
  "status": "ok",
  "time": "2025-11-13T...Z",
  "version": "1.0.0"
}

Version

GET /api/version
{ "version": "1.0.0" }

Package details

GET /api/pkg?name=@scope/pkg
GET /api/npm?name=@scope/pkg

Returns merged npm metadata (latest version) and last-week downloads.

{
  "name": "@waelio/messaging",
  "description": "...",
  "version": "x.y.z",
  "homepage": "...",
  "repository": { "type": "git", "url": "..." },
  "downloads_week": 1234,
  "keywords": ["..."],
  "license": "MIT",
  "has_types": true
}

Downloads

GET /api/downloads?name=@scope/pkg&range=last-day|last-week|last-month|last-year

Returns npm downloads for a time period.

{
  "name": "@waelio/messaging",
  "range": "last-week",
  "data": { /* npm downloads API response */ }
}

Search

GET /api/search?q=vue&size=10

Proxies npm registry search with a size limit (1..50).

Examples

Replace https://api.waelio.com with your backend URL.

# Health
curl -s https://api.waelio.com/api/health

# Package details
curl -s "https://api.waelio.com/api/pkg?name=@waelio/messaging"

# Downloads last-month
curl -s "https://api.waelio.com/api/downloads?name=@waelio/messaging&range=last-month"

# Search
curl -s "https://api.waelio.com/api/search?q=vue&size=5"
// fetch example
const base = 'https://api.waelio.com';
const res = await fetch(`${base}/api/pkg?name=@waelio/messaging`);
const data = await res.json();
console.log(data);