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

geomelon

v1.0.7

Published

TypeScript client for the Geomelon API — cities, countries, regions, and languages with multilingual support

Readme

Geomelon TypeScript Client

TypeScript/JavaScript client for the Geomelon API — a read-only geospatial database of cities, countries, regions, and languages with multilingual support.

Available on RapidAPI.

Installation

npm install geomelon

Requirements

  • Node.js 18+ (uses native fetch)
  • A RapidAPI key with access to the Geomelon API

Quick start

import { GeomelonClient } from 'geomelon';

const geo = new GeomelonClient({ apiKey: 'YOUR_RAPIDAPI_KEY' });

// Find cities near a point
const cities = await geo.cities.byCoordinatesClosest({ lat: 41.38, lon: 2.18 });
console.log(cities[0].name); // "Barcelona"

// Search cities by name with language preference
const results = await geo.cities.search({ name: 'tokyo', preferredLanguages: 'ja' });
console.log(results[0].localizedName); // "東京"

CommonJS:

const { GeomelonClient } = require('geomelon');
const geo = new GeomelonClient({ apiKey: 'YOUR_RAPIDAPI_KEY' });

Configuration

const geo = new GeomelonClient({
  apiKey: 'YOUR_RAPIDAPI_KEY', // required
  host: 'geomelon.p.rapidapi.com', // optional, override for custom gateway
});

API reference

Cities

// Search with filters and pagination
geo.cities.search({
  name: 'paris',          // prefix search (also matches translations)
  countryCode: 'FR',      // ISO 3166-1 alpha-2, case-insensitive
  regionId: 'uuid',
  minPopulation: 100000,
  maxPopulation: 5000000,
  sort: 'population_desc', // population_desc | population_asc | name_asc | name_desc
  preferredLanguages: 'fr,en', // comma-separated, priority order
  limit: 20,
  offset: 0,
})

// Get city by ID
geo.cities.get('964512d1-f150-4876-87ec-0ba47aef694a')

// All translations for a city
geo.cities.translations('964512d1-f150-4876-87ec-0ba47aef694a')

// Settlement types (city, municipality, etc.)
geo.cities.settlementTypes('964512d1-f150-4876-87ec-0ba47aef694a')

// Distance between two cities
geo.cities.distance('uuid-city1', 'uuid-city2') // → { distanceKm: 504.7 }

// Nearest cities to a coordinate
geo.cities.byCoordinatesClosest({ lat: 41.38, lon: 2.18, preferredLanguages: 'en' })

// Most populated cities near a coordinate
geo.cities.byCoordinatesLargest({ lat: 41.38, lon: 2.18, preferredLanguages: 'en' })

Countries

// List countries with optional filters
geo.countries.list({ limit: 200, offset: 0 })
geo.countries.list({ name: 'Spa', preferredLanguages: 'es,en' }) // prefix search
geo.countries.list({ telephoneCode: '+34' })

// Get country by ID (includes embedded translations and regions)
geo.countries.get('a1e06cc1-817c-429f-84f4-6ab51dac9bfa')

// Translations for a country
geo.countries.translations('uuid', { preferredLanguages: 'fr,de' })

// Regions within a country
geo.countries.regions('uuid')

Regions

// List regions, optionally filtered by country
geo.regions.list({ countryId: 'uuid' })

// Get region by ID (includes nested country)
geo.regions.get('dde1e1c6-ca22-48e6-8ad7-f97b141c1929')

// Translations for a region
geo.regions.translations('uuid', { preferredLanguages: 'ca,fr' })

Languages

// List languages sorted by city coverage
geo.languages.list({ limit: 50, offset: 0 })

// Get language by ID
geo.languages.get('08cb6cd7-7c3e-4058-a34a-405052db63ec')

Response types

All types are exported for use in TypeScript projects:

import type {
  CityDto,
  CountryDto,
  CountryExtendedDto,
  RegionDto,
  RegionExtendedDto,
  LanguageDto,
  DistanceDto,
  SearchCitiesParams,
  // ... all param and response types
} from 'geomelon';

Error handling

The client throws an Error for non-2xx responses with the HTTP status code and body in the message:

try {
  const city = await geo.cities.get('non-existent-id');
} catch (err) {
  // Error: Geomelon API error 404: {"message":"City non-existent-id not found"}
}

Build

npm install
npm run build       # outputs dist/cjs/ and dist/esm/