You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@power-seo/core

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@power-seo/core

Framework-agnostic SEO analysis engines, types, and utilities

Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
83
-86.28%
Maintainers
1
Weekly downloads
 
Created
Source

@power-seo/core — Framework-Agnostic SEO Utilities for TypeScript & React

Zero-dependency foundation for the @power-seo toolkit. Provides shared types, meta tag builders, URL utilities, text statistics, keyword density analysis, robots directive builder, validators, and constants.

npm version npm downloads License: MIT TypeScript tree-shakeable

The foundation package used by all other @power-seo packages. Useful on its own for headless SEO tooling, custom framework integrations, or any Node.js application that needs SEO utilities without a React dependency.

Documentation

Features

  • Meta tag builders — generate typed MetaTag[] and LinkTag[] objects for title, description, Open Graph, Twitter Card, hreflang
  • Robots directive builder — build and parse robots meta content strings with full directive support (noindex, nofollow, max-snippet, max-image-preview, max-video-preview, unavailable_after, noarchive, nosnippet, noimageindex, notranslate)
  • Title template engine%s | Site Name style templates with applyTitleTemplate()
  • Meta validators — validate title and description length in both characters and pixel width
  • URL utilities — normalize, slug-ify, strip tracking params, resolve canonical, check absolute/relative
  • Text statistics — word count, sentence count, syllable count, paragraph count from HTML content
  • Keyword density analysis — calculate density, count occurrences, analyze keyphrase distribution
  • Shared constantsTITLE_MAX_LENGTH, META_DESCRIPTION_MAX_LENGTH, OG_IMAGE, KEYWORD_DENSITY thresholds
  • Zero runtime dependencies — safe to use in any environment including edge runtimes
  • Dual ESM + CJS — works with any bundler or Node.js require
  • TypeScript-first — all types exported, full .d.ts declarations

Table of Contents

Installation

npm install @power-seo/core
yarn add @power-seo/core
pnpm add @power-seo/core

Quick Start

import { buildMetaTags, buildRobotsContent, validateTitle, toSlug } from '@power-seo/core';

const tags = buildMetaTags({
  title: 'My Page',
  description: 'Page description',
  robots: { index: true, follow: true },
});
const robots = buildRobotsContent({ index: false, maxSnippet: 150 }); // → "noindex, max-snippet:150"
const valid = validateTitle('My Page Title'); // { valid: true, length: 14, pixelWidth: 95 }
const slug = toSlug('My Blog Post!'); // → "my-blog-post"

Usage

Meta Tag Builders

import {
  buildMetaTags,
  buildLinkTags,
  buildOpenGraphTags,
  buildTwitterTags,
  buildHreflangTags,
} from '@power-seo/core';

const meta = buildMetaTags({
  title: 'My Page',
  description: 'Page description',
  robots: { index: true, follow: true },
});

const links = buildLinkTags({ canonical: 'https://example.com/page' });

const og = buildOpenGraphTags({
  title: 'My Page',
  description: 'Page description',
  type: 'website',
  url: 'https://example.com',
  images: [{ url: 'https://example.com/og.jpg', width: 1200, height: 630 }],
});

const twitter = buildTwitterTags({
  card: 'summary_large_image',
  site: '@mysite',
  title: 'My Page',
  description: 'Page description',
  image: 'https://example.com/twitter.jpg',
});

const hreflang = buildHreflangTags([
  { hrefLang: 'en', href: 'https://example.com/page' },
  { hrefLang: 'fr', href: 'https://fr.example.com/page' },
  { hrefLang: 'x-default', href: 'https://example.com/page' },
]);

Robots Directive Builder

import { buildRobotsContent, parseRobotsContent } from '@power-seo/core';

// Build robots meta content string
buildRobotsContent({ index: true, follow: true });
// → "index, follow"

buildRobotsContent({ index: false, follow: false, noarchive: true });
// → "noindex, nofollow, noarchive"

buildRobotsContent({ index: true, maxSnippet: 150, maxImagePreview: 'large' });
// → "index, max-snippet:150, max-image-preview:large"

// Parse existing robots string back to config
parseRobotsContent('noindex, follow, max-image-preview:large');
// → { index: false, follow: true, maxImagePreview: 'large' }

All supported directives:

DirectiveTypeDescription
indexbooleantrueindex, falsenoindex
followbooleantruefollow, falsenofollow
noarchivebooleanPrevent cached version in search results
nosnippetbooleanPrevent text/video snippet in results
noimageindexbooleanPrevent page images from being indexed
notranslatebooleanPrevent Google Translate offer
maxSnippetnumberMax text snippet length (e.g. 150)
maxImagePreview'none' | 'standard' | 'large'Max image preview size
maxVideoPreviewnumberMax video preview duration in seconds
unavailableAfterstringDate after which to remove page from results

Title Template Engine

import { applyTitleTemplate, createTitleTemplate } from '@power-seo/core';

applyTitleTemplate('Blog Post', '%s | My Site');
// → "Blog Post | My Site"

const template = createTitleTemplate({ separator: '|', suffix: 'My Site' });
template.apply('Blog Post'); // → "Blog Post | My Site"

Meta Validators

import { validateTitle, validateMetaDescription, calculatePixelWidth } from '@power-seo/core';

validateTitle('My Page Title');
// { valid: true, length: 14, pixelWidth: 95, warnings: [] }

validateMetaDescription('A description of the page content for search engines.');
// { valid: true, length: 53, pixelWidth: 340, warnings: [] }

calculatePixelWidth('My Title'); // → 56

URL Utilities

import {
  normalizeUrl,
  toSlug,
  stripTrackingParams,
  ensureTrailingSlash,
  removeTrailingSlash,
  isAbsoluteUrl,
  resolveCanonical,
} from '@power-seo/core';

normalizeUrl('https://example.com/PATH?utm_source=x'); // → "https://example.com/path"
toSlug('My Blog Post!'); // → "my-blog-post"
stripTrackingParams('https://example.com?utm_source=google&page=1'); // → "https://example.com?page=1"
ensureTrailingSlash('https://example.com/blog'); // → "https://example.com/blog/"
removeTrailingSlash('https://example.com/blog/'); // → "https://example.com/blog"
isAbsoluteUrl('https://example.com'); // → true
isAbsoluteUrl('/relative/path'); // → false

Text Statistics

import {
  getTextStatistics,
  stripHtml,
  getWords,
  getSentences,
  countSyllables,
} from '@power-seo/core';

const stats = getTextStatistics(
  '<h1>Hello</h1><p>This is a sample paragraph with several words.</p>',
);
// { wordCount: 9, sentenceCount: 1, paragraphCount: 1, syllableCount: 14, avgWordsPerSentence: 9 }

stripHtml('<p>Hello <strong>world</strong></p>'); // → "Hello world"
getWords('Hello world'); // → ["Hello", "world"]
countSyllables('beautiful'); // → 3

Keyword Density

import {
  calculateKeywordDensity,
  countKeywordOccurrences,
  analyzeKeyphraseOccurrences,
} from '@power-seo/core';

calculateKeywordDensity('react seo is great for react apps', 'react'); // → 0.1667 (16.67%)
countKeywordOccurrences('react seo is great for react apps', 'react'); // → 2

const analysis = analyzeKeyphraseOccurrences(
  'Best coffee shops in NYC. The coffee shops on Fifth Avenue are particularly good.',
  'coffee shops',
);
// { count: 2, density: 0.1538, positions: [1, 7], distribution: 'good' }

Constants

import {
  TITLE_MAX_LENGTH,
  META_DESCRIPTION_MAX_LENGTH,
  OG_IMAGE,
  KEYWORD_DENSITY,
  READABILITY,
} from '@power-seo/core';

TITLE_MAX_LENGTH; // 60
META_DESCRIPTION_MAX_LENGTH; // 158
OG_IMAGE.MIN_WIDTH; // 1200
OG_IMAGE.MIN_HEIGHT; // 630
KEYWORD_DENSITY.MIN; // 0.005 (0.5%)
KEYWORD_DENSITY.MAX; // 0.03  (3%)

API Reference

Meta Builders

FunctionSignatureDescription
buildMetaTags(config: MetaConfig) => MetaTag[]Generate meta tag objects from SEO config
buildLinkTags(config: LinkConfig) => LinkTag[]Generate link tag objects (canonical, alternate)
buildOpenGraphTags(config: OpenGraphConfig) => MetaTag[]Generate Open Graph og:* meta tags
buildTwitterTags(config: TwitterConfig) => MetaTag[]Generate Twitter Card twitter:* meta tags
buildHreflangTags(entries: HreflangEntry[]) => LinkTag[]Generate hreflang <link rel="alternate"> tags
resolveTitle(title: string, template?: string) => stringResolve title with optional template

Robots

FunctionSignatureDescription
buildRobotsContent(directive: RobotsDirective) => stringBuild robots meta content string
parseRobotsContent(content: string) => RobotsDirectiveParse robots string into RobotsDirective

Title

FunctionSignatureDescription
applyTitleTemplate(title: string, template: string) => stringApply %s template to title
createTitleTemplate(options: TitleTemplateOptions) => TitleTemplateCreate reusable title template

Validators

FunctionSignatureDescription
validateTitle(title: string) => ValidationResultValidate title length and pixel width
validateMetaDescription(description: string) => ValidationResultValidate description length and pixel width
calculatePixelWidth(text: string) => numberCalculate pixel width using Google's character width table

URL Utilities

FunctionSignatureDescription
resolveCanonical(url: string, base: string) => stringResolve canonical URL against base
normalizeUrl(url: string) => stringNormalize URL (lowercase, remove trailing slash)
ensureTrailingSlash(url: string) => stringAdd trailing slash if missing
removeTrailingSlash(url: string) => stringRemove trailing slash if present
stripQueryParams(url: string) => stringRemove all query parameters
stripTrackingParams(url: string) => stringRemove UTM and tracking parameters only
isAbsoluteUrl(url: string) => booleanCheck if URL is absolute
toSlug(text: string) => stringConvert text to URL-safe slug

Text Statistics

FunctionSignatureDescription
getTextStatistics(html: string) => TextStatisticsComprehensive text statistics from HTML
stripHtml(html: string) => stringRemove HTML tags
getWords(text: string) => string[]Split into words array
getSentences(text: string) => string[]Split into sentences array
getParagraphs(text: string) => string[]Split into paragraphs array
countSyllables(word: string) => numberCount syllables in a single word

Keyword Analysis

FunctionSignatureDescription
calculateKeywordDensity(text: string, keyword: string) => numberKeyword density as decimal (0.05 = 5%)
countKeywordOccurrences(text: string, keyword: string) => numberRaw occurrence count
analyzeKeyphraseOccurrences(text: string, keyphrase: string) => KeyphraseAnalysisDetailed keyphrase analysis

Core Types

TypeDescription
MetaTag{ name?: string; property?: string; content: string; httpEquiv?: string }
LinkTag{ rel: string; href: string; hrefLang?: string; type?: string }
RobotsDirectiveFull robots directive configuration object
MetaConfigInput config for buildMetaTags()
OpenGraphConfigInput config for buildOpenGraphTags()
TwitterConfigInput config for buildTwitterTags()
ValidationResult{ valid: boolean; length: number; pixelWidth: number; warnings: string[] }
TextStatistics{ wordCount: number; sentenceCount: number; paragraphCount: number; syllableCount: number; avgWordsPerSentence: number }

The @power-seo Ecosystem

All 17 packages are independently installable — use only what you need.

PackageInstallDescription
@power-seo/corenpm i @power-seo/coreFramework-agnostic utilities, types, validators, and constants
@power-seo/reactnpm i @power-seo/reactReact SEO components — meta, Open Graph, Twitter Card, robots, breadcrumbs
@power-seo/metanpm i @power-seo/metaSSR meta helpers for Next.js App Router, Remix v2, and generic SSR
@power-seo/schemanpm i @power-seo/schemaType-safe JSON-LD structured data — 20 builders + 18 React components
@power-seo/content-analysisnpm i @power-seo/content-analysisYoast-style SEO content scoring engine with React components
@power-seo/readabilitynpm i @power-seo/readabilityReadability scoring — Flesch-Kincaid, Gunning Fog, Coleman-Liau, ARI
@power-seo/previewnpm i @power-seo/previewSERP, Open Graph, and Twitter/X Card preview generators
@power-seo/sitemapnpm i @power-seo/sitemapXML sitemap generation, streaming, index splitting, and validation
@power-seo/redirectsnpm i @power-seo/redirectsRedirect engine with Next.js, Remix, and Express adapters
@power-seo/linksnpm i @power-seo/linksLink graph analysis — orphan detection, suggestions, equity scoring
@power-seo/auditnpm i @power-seo/auditFull SEO audit engine — meta, content, structure, performance rules
@power-seo/imagesnpm i @power-seo/imagesImage SEO — alt text, lazy loading, format analysis, image sitemaps
@power-seo/ainpm i @power-seo/aiLLM-agnostic AI prompt templates and parsers for SEO tasks
@power-seo/analyticsnpm i @power-seo/analyticsMerge GSC + audit data, trend analysis, ranking insights, dashboard
@power-seo/search-consolenpm i @power-seo/search-consoleGoogle Search Console API — OAuth2, service account, URL inspection
@power-seo/integrationsnpm i @power-seo/integrationsSemrush and Ahrefs API clients with rate limiting and pagination
@power-seo/trackingnpm i @power-seo/trackingGA4, Clarity, PostHog, Plausible, Fathom — scripts + consent management

About CyberCraft Bangladesh

CyberCraft Bangladesh is a Bangladesh-based enterprise-grade software engineering company specializing in ERP system development, AI-powered SaaS and business applications, full-stack SEO services, custom website development, and scalable eCommerce platforms. We design and develop intelligent, automation-driven SaaS and enterprise solutions that help startups, SMEs, NGOs, educational institutes, and large organizations streamline operations, enhance digital visibility, and accelerate growth through modern cloud-native technologies.

Websiteccbd.dev
GitHubgithub.com/cybercraftbd
npm Organizationnpmjs.com/org/power-seo
Emailinfo@ccbd.dev

© 2026 CyberCraft Bangladesh · Released under the MIT License

Keywords

seo

FAQs

Package last updated on 22 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts