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

tidesatlas

v0.1.0

Published

Official Node.js SDK for TidesAtlas — worldwide tide predictions, weather & marine data API

Readme

TidesAtlas Node.js SDK

Official Node.js SDK for TidesAtlas — worldwide tide predictions, weather & marine data API.

  • 18,000+ tide stations across 188 countries
  • Tide predictions, weather, marine/wave, astronomy (sun & moon) data
  • Historical data access
  • Zero dependencies, native fetch (Node 18+)
  • Full TypeScript type definitions

Installation

npm install tidesatlas

Quick Start

const TidesAtlas = require('tidesatlas');

const client = new TidesAtlas('your-api-key');

// Get today's tides for Brest, France
const data = await client.tides({ port: 'brest-3-fra-refmar' });
console.log(data.extremes);

Get your free API key at tidesatlas.com/api/docs.

Usage

Initialize

const TidesAtlas = require('tidesatlas');

const client = new TidesAtlas('your-api-key');

// With options
const client = new TidesAtlas('your-api-key', {
  baseUrl: 'https://tidesatlas.com/api/v1',  // default
  timeout: 15000,                              // 15s timeout
});

Tides

Get tide predictions (high/low water times and heights).

// By port slug
const tides = await client.tides({ port: 'aberdeen-abe-gbr-bodc', days: 3 });

// By coordinates (finds nearest station)
const tides = await client.tides({ lat: 48.39, lon: -4.49, days: 7 });

// With specific date and datum
const tides = await client.tides({
  port: 'brest-3-fra-refmar',
  date: '2026-06-15',
  days: 3,
  datum: 'MSL',
});

console.log(tides.port);     // { name, slug, lat, lon, timezone, country, ... }
console.log(tides.datum);    // { reference: 'MSL', native: 'LAT', available: [...] }
console.log(tides.extremes); // [{ datetime, timestamp, height_m, type }, ...]

Ports

Search for tide stations worldwide.

// Search by name
const results = await client.ports({ search: 'london' });

// Filter by country
const results = await client.ports({ country: 'france', limit: 100 });

// List all (up to 500)
const results = await client.ports({ limit: 500 });

console.log(results.count);
console.log(results.ports); // [{ name, slug, lat, lon, timezone, country, ... }, ...]

Countries

List all countries with station counts.

const data = await client.countries();

console.log(data.count);      // 188
console.log(data.countries);   // [{ name, slug, code_iso, station_count }, ...]

Weather

Get weather forecast for a location.

// By port
const weather = await client.weather({ port: 'brest-3-fra-refmar', days: 5 });

// By coordinates
const weather = await client.weather({ lat: 51.5, lon: -0.1, days: 3 });

console.log(weather.daily);  // [{ date, temperature_max_c, condition, sunrise, sunset, ... }]
console.log(weather.hourly); // [{ datetime, temperature_c, wind_speed_kmh, condition, ... }]

Marine

Get wave and swell forecast.

const marine = await client.marine({ port: 'brest-3-fra-refmar', days: 3 });

console.log(marine.daily);  // [{ date, wave_height_max_m, sea_state, swell_height_max_m, ... }]
console.log(marine.hourly); // [{ datetime, wave_height_m, swell_height_m, wave_period_s, ... }]

Astronomy

Get sun and moon data (sunrise, sunset, moon phase, etc.).

const astro = await client.astronomy({ port: 'brest-3-fra-refmar', days: 7 });

for (const day of astro.data) {
  console.log(day.date);
  console.log(day.sun);   // { sunrise, sunset, dawn, dusk, day_length }
  console.log(day.moon);  // { phase, illumination_pct, age_days, moonrise, moonset }
}

Conditions

Get combined weather + marine + astronomy data in a single call.

// All data
const conditions = await client.conditions({ port: 'brest-3-fra-refmar', days: 3 });

// Only specific data types
const conditions = await client.conditions({
  lat: 48.39,
  lon: -4.49,
  days: 3,
  include: ['weather', 'marine'],
});

console.log(conditions.weather);   // { daily: [...], hourly: [...] }
console.log(conditions.marine);    // { daily: [...], hourly: [...] }
console.log(conditions.astronomy); // [{ date, sun, moon }, ...]

History

Get historical tide and weather data for past dates.

// Historical tides only
const history = await client.history({
  port: 'brest-3-fra-refmar',
  date: '2025-01-01',
  days: 30,
});

// Historical tides + weather
const history = await client.history({
  port: 'brest-3-fra-refmar',
  date: '2025-06-01',
  days: 14,
  include: ['tides', 'weather'],
});

console.log(history.tides.extremes);  // [{ datetime, height_m, type }, ...]
console.log(history.weather.daily);   // [{ date, temperature_max_c, ... }, ...]

Error Handling

const { TidesAtlasError } = require('tidesatlas');

try {
  const data = await client.tides({ port: 'nonexistent-port' });
} catch (err) {
  if (err instanceof TidesAtlasError) {
    console.error(err.message);  // "Station 'nonexistent-port' not found."
    console.error(err.status);   // 404
    console.error(err.body);     // { error: true, message: "...", status: 404 }
  }
}

Error status codes:

  • 400 - Bad request (invalid parameters)
  • 401 - Unauthorized (invalid API key)
  • 404 - Not found (unknown port or endpoint)
  • 429 - Rate limit exceeded
  • 502 - Upstream data source temporarily unavailable

TypeScript

Full type definitions are included. Import types directly:

import TidesAtlas, { TidesResponse, PortsResponse, TidesAtlasError } from 'tidesatlas';

const client = new TidesAtlas('your-api-key');
const tides: TidesResponse = await client.tides({ port: 'brest-3-fra-refmar' });

Requirements

  • Node.js 18+ (uses native fetch)
  • No external dependencies

API Documentation

Full API reference: tidesatlas.com/api/docs

License

MIT