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 🙏

© 2024 – Pkg Stats / Ryan Hefner

seo-api

v1.2.1

Published

A client package for accessing the Hooray SEO API

Downloads

24

Readme

SEO-API

The Hooray SEO API, accompanied by a client-side JavaScript package to interact with the API. This was developed by Jake Labate for the purposes of accelerating the auditing, fulfillment and reporting of the agency's SEO services.

Install & Import

npm i seo-api
import SEO from 'seo-api';

Init & Auth

auth (required)

brand_id (optional)

  • This accesses previous saved information about a brand you wish to consider when calling services.
const seo = new SEO({
  auth: process.env.SEO_API_KEY,
  brand_id: 'your-brand-id'
});

back to top ⬆️

Service Configuration

  • The config object specifies input information for the requested service.
  • The 2 keys in the config object are style and data.
const seo = new SEO({
  auth: process.env.SEO_API_KEY,
  brand_id: 'your-brand-id'
});

const config = {
  style: '',
  data: []
}

seo.audit.speed(config);

style

  • The style key sets the style / format / option / desired approach of the requested service.
  • Defaults to a service-specific default style if not set.
  • Style options depend on the requested service.

data

  • The data key expects information used in the services requested. This expects an array of objects to perform the service on.
  • Multi-object requests are server-processed in parallel, and await all responses before returning.
  • The expect keys nested inside a data object change based on the service requested.
// config.data as an array of objects
seo.generate.titleTag({
  style: 'pathIndicative',
  data: [
    { url: 'https://www.jakelabate.com/clients/hooray-agency' },
    { url: 'https://www.jakelabate.com/work/hotel-schema' }
  ]
});

Object-specific styling

style keys can be placed inside each data object for more granular styling options. Falls back to the config.style key value.

seo.generate.titleTag({
  style: 'pathIndicative', // fallback styling
  data: [
    {
      style: 'ai', // processed as 'ai'
      url: 'https://www.jakelabate.com/clients/hooray-agency'
    },
    {
      style: null, // processed as 'pathIndicative'
      url: 'https://www.jakelabate.com/clients/bitx-funding'
    }
  ]
});

back to top ⬆️

Response Object

{
  status: 'success',
  code: 200,
  value: [], // returns a res object for each req object
  errors: [], // if any server errors
  meta: {
    timestamp: 1620000000,
    service: 'generate/title-tag', // endpoint path
    docs: 'https://www.npmjs.com/package/seo-api#{{service}}' // public README.md
  }
}

Service Index

back to top ⬆️

Data Gathering Services

// function path
seo.gather

User Data

seo.gather.userData({
  style: '',
  data: [
    
  ]
});

Auditing Services

// function path
seo.audit

Domain Age

seo.audit.domainAge({
  style: '',
  data: [
    
  ]
});

Forms

seo.audit.forms({
  style: '',
  data: [
    
  ]
});

Heading Structure

seo.audit.headingStructure({
  style: '',
  data: [
    
  ]
});

Images

seo.audit.images({
  style: '',
  data: [
    
  ]
});

Links

seo.audit.links({
  style: '',
  data: [
    
  ]
});

Meta Data

seo.audit.metaData({
  style: '',
  data: [
    
  ]
});

Robots txt

seo.audit.robotTxt({
  style: '',
  data: [
    
  ]
});

Schema Markup

seo.audit.schemaMarkup({
  style: '',
  data: [
    
  ]
});

Sitemap

seo.audit.sitemap({
  style: '',
  data: [
    
  ]
});

Speed

seo.audit.speed({
  style: '',
  data: [
    
  ]
});

SSL Certificate

seo.audit.sslCertificate({
  style: '',
  data: [
    
  ]
});

URL Structure

seo.audit.urlStructure({
  style: '',
  data: [
    
  ]
});

back to top ⬆️

Compression Services

// function path
seo.compress

Image

Compress the file size of any publicly accessible image (via a URL) without losing image quality.

Config

style

  • Not relevant for this service.

data

  • image_url is the URL of the publicly accessible image.
seo.compress.image({
  style: null,
  data: [
    {
      image_url: 'https://www.example.com/image.png'
    }
  ]
});

back to top ⬆️

Generation Services

// function path
seo.generate

Title Tag

Write a title tag for any published or non-published URL.

seo.generate.titleTag({
  style: '',
  data: [

  ]
});

Meta Description

Write a meta description for any published URL.

seo.generate.metaDescription({
  style: '',
  data: [

  ]
});

Image Alt Text

Generate alt text for any publicly accessible image (via a URL).

seo.generate.imageAltText({
  style: '',
  data: [

  ]
});

Open Graph Image

seo.generate.openGraphImage({
  style: '',
  data: [

  ]
});

back to top ⬆️

Reporting Services

// function path
seo.report

The report service is a single-endpoint service that works a little different.

style

  • The pdf option returns a PDF report.

data

  • Expects an array of service-result objects in the default service-returned response.
async function reportWebsiteSpeed(url) {

  const response = await seo.audit.speed({
    style: null,
    data: [{ url }]
  });
  
  return await seo.report({
    style: 'pdf',
    data: response
  });
  
}

const url = 'https://www.jakelabate.com';
reportWebsiteSpeed(url);

back to top ⬆️