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

@power-seo/content-analysis

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@power-seo/content-analysis - npm Package Compare versions

Comparing version
1.0.4
to
1.0.5
+9
-1
package.json
{
"name": "@power-seo/content-analysis",
"version": "1.0.4",
"version": "1.0.5",
"description": "Yoast-style SEO content analysis engine with scoring, checks, and React components",

@@ -73,3 +73,11 @@ "license": "MIT",

"access": "public"
},
"bugs": {
"url": "https://github.com/CyberCraftBD/power-seo/issues"
},
"homepage": "https://github.com/CyberCraftBD/power-seo/tree/main/packages/content-analysis#readme",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/cybercraftbd"
}
}
+238
-130

@@ -1,3 +0,5 @@

# @power-seo/content-analysis — Yoast-Style SEO Content Scoring Engine for React & Node.js
# @power-seo/content-analysis
![content-analysis banner](../../image/content-analysis/banner.svg)
Keyword-focused content analysis with real-time scoring, readability checks, and actionable feedback — like Yoast SEO, but as a standalone TypeScript library that works anywhere.

@@ -7,2 +9,4 @@

[![npm downloads](https://img.shields.io/npm/dm/@power-seo/content-analysis)](https://www.npmjs.com/package/@power-seo/content-analysis)
[![Socket](https://socket.dev/api/badge/npm/package/@power-seo/content-analysis)](https://socket.dev/npm/package/@power-seo/content-analysis)
[![npm provenance](https://img.shields.io/badge/npm-provenance-enabled-blue)](https://github.com/CyberCraftBD/power-seo/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

@@ -12,58 +16,85 @@ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue)](https://www.typescriptlang.org/)

`@power-seo/content-analysis` gives you a complete Yoast-style SEO scoring pipeline for any text content. Feed it a page's title, meta description, body HTML, focus keyphrase, images, and links — get back structured `good` / `improvement` / `error` results for every SEO factor. Run it server-side in a CMS, client-side in a React editor, or inside a CI content quality gate. All checks are individually configurable and tree-shakeable.
`@power-seo/content-analysis` delivers a comprehensive, WordPress SEO plugin–style scoring pipeline for evaluating text content, comparable to Yoast SEO, All in One SEO (AIOSEO), Rank Math, SEOPress, and The SEO Framework. Provide a page title, meta description, body content, focus keyphrase, images, and links — get back structured `good` / `needs-improvement` / `poor` results across all critical SEO factors. Run it server-side in a CMS, client-side in a React editor, or inside a CI content quality gate. All 13 analysis checks are fully configurable and tree-shakeable.
> **Zero runtime dependencies** — only `@power-seo/core` as a peer.
## Documentation
---
- **Package docs:** [`apps/docs/src/content/docs/packages/content-analysis.mdx`](../../apps/docs/src/content/docs/packages/content-analysis.mdx)
- **Ecosystem overview:** [`README.md`](../../README.md)
- **Contributing guide:** [`CONTRIBUTING.md`](../../CONTRIBUTING.md)
## Why @power-seo/content-analysis?
| | Without | With |
|---|---|---|
| Keyphrase check | ❌ Manual grep | ✅ Density + distribution scoring |
| Title validation | ❌ Eye-check only | ✅ Presence, length, keyphrase match |
| Meta description | ❌ Unchecked | ✅ Length (120–160 chars) + keyphrase |
| Heading structure | ❌ Missed H1s | ✅ H1 hierarchy + keyphrase in subheadings |
| Image alt text | ❌ Skipped | ✅ Alt presence + keyphrase in alt |
| Link analysis | ❌ Unknown | ✅ Internal + external link presence |
| SEO score | ❌ Guesswork | ✅ Aggregate score with per-check breakdown |
| Framework support | ❌ WordPress-only | ✅ Next.js, Remix, Vite, Node.js, Edge |
![SEO Score Dashboard](../../image/content-analysis/score-dashboard.svg)
---
## Features
- **Keyphrase density check** — scores optimal 0.5–3% keyword frequency in body copy
- **Keyphrase distribution** — verifies the focus keyword appears in the first 10% of content
- **Keyphrase density check** — scores optimal 0.5–2.5% keyword frequency in body copy
- **Keyphrase distribution** — verifies the focus keyword appears in intro, headings, slug, and image alt
- **Title checks** — detects missing titles and keyphrase absence in the `<title>` tag
- **Meta description checks** — validates presence, length (120–158 chars), and keyphrase inclusion
- **Heading structure** — ensures H1 exists and that the keyphrase appears in at least one heading
- **Word count** — flags pages under the 300-word minimum threshold
- **Meta description checks** — validates presence, length (120–160 chars), and keyphrase inclusion
- **Heading structure** — validates H1 existence, hierarchy, and keyphrase in subheadings
- **Word count** — flags pages under 300 words (good at 1,000+)
- **Image alt text** — scans all images for missing alt attributes
- **Image keyphrase** — checks whether at least one image alt contains the focus keyphrase
- **Internal and external link analysis** — verifies outbound and inbound link presence
- **Configurable check suite** — disable any individual check via `disabledChecks` config
- **Framework-agnostic** — works in Next.js, Remix, Gatsby, Vite, vanilla Node.js
- **Internal and external link analysis** — verifies inbound and outbound link presence
- **Per-check disable config** — skip irrelevant checks via `disabledChecks` config
- **React components** — pre-built `ScorePanel`, `CheckList`, and `ContentAnalyzer` UI components
- **Framework-agnostic** — works in Next.js, Remix, Gatsby, Vite, vanilla Node.js, Edge
- **Full TypeScript support** — complete type definitions for all inputs, outputs, and check IDs
- **Tree-shakeable** — import only the checks you use; zero dead code in your bundle
## Table of Contents
![Google SERP Preview](../../image/content-analysis/serp-preview.svg)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Usage](#usage)
- [Running All Checks at Once](#running-all-checks-at-once)
- [Running Individual Checks](#running-individual-checks)
- [Disabling Specific Checks](#disabling-specific-checks)
- [Using in a React Editor](#using-in-a-react-editor)
- [API Reference](#api-reference)
- [`analyzeContent()`](#analyzecontent)
- [Individual Check Functions](#individual-check-functions)
- [Types](#types)
- [The @power-seo Ecosystem](#the-power-seo-ecosystem)
- [About CyberCraft Bangladesh](#about-cybercraft-bangladesh)
---
## Comparison
| Feature | @power-seo/content-analysis | Yoast SEO | next-seo | seo-analyzer | react-helmet |
| ------------------------------ | :-------------------------: | :-------: | :------: | :----------: | :----------: |
| Keyphrase density check | ✅ | ✅ | ❌ | Partial | ❌ |
| Keyphrase distribution | ✅ | ✅ | ❌ | ❌ | ❌ |
| Title + meta validation | ✅ | ✅ | ❌ | Partial | ❌ |
| Heading structure check | ✅ | ✅ | ❌ | ❌ | ❌ |
| Image alt + keyphrase check | ✅ | ✅ | ❌ | ❌ | ❌ |
| Internal / external link check | ✅ | ✅ | ❌ | ❌ | ❌ |
| Aggregate SEO score | ✅ | ✅ | ❌ | Partial | ❌ |
| Per-check disable config | ✅ | ❌ | ❌ | ❌ | ❌ |
| Works outside WordPress | ✅ | ❌ | ✅ | ✅ | ✅ |
| TypeScript-first | ✅ | ❌ | Partial | ❌ | ❌ |
| Tree-shakeable | ✅ | ❌ | Partial | ❌ | ❌ |
| React UI components | ✅ | ✅ | ❌ | ❌ | ❌ |
| CI / Node.js usage | ✅ | ❌ | ❌ | ✅ | ❌ |
| Zero runtime dependencies | ✅ | ❌ | ❌ | ❌ | ❌ |
![Keyword Density Analysis](../../image/content-analysis/keyword-density.svg)
---
## Installation
```bash
npm install @power-seo/content-analysis
npm install @power-seo/content-analysis @power-seo/core
```
```bash
yarn add @power-seo/content-analysis
yarn add @power-seo/content-analysis @power-seo/core
```
```bash
pnpm add @power-seo/content-analysis
pnpm add @power-seo/content-analysis @power-seo/core
```
---
## Quick Start

@@ -74,19 +105,24 @@

const result = await analyzeContent({
keyphrase: 'react seo',
title: 'How to Add SEO to React Apps',
metaDescription:
'A complete guide to adding SEO meta tags, Open Graph, and structured data in React.',
bodyHtml: '<h1>React SEO Guide</h1><p>Search engine optimization for React...</p>',
images: [{ src: '/hero.jpg', alt: 'React SEO diagram' }],
links: {
internal: ['https://example.com/blog'],
external: ['https://developers.google.com/search'],
},
const result = analyzeContent({
title: 'Best Running Shoes for Beginners',
metaDescription: 'Discover the best running shoes for beginners with our expert guide.',
keyphrase: 'running shoes for beginners',
content: '<h1>Best Running Shoes</h1><p>Finding the right running shoes...</p>',
url: 'https://example.com/best-running-shoes',
});
console.log(result.score); // e.g. 82
console.log(result.results); // array of { id, status, message }
console.log(result.overallStatus); // "good" | "needs-improvement" | "poor"
console.log(result.results);
// [{ id: 'title-presence', status: 'good', message: '...' }, ...]
```
![SEO Check Results](../../image/content-analysis/check-results.svg)
**Status thresholds (per check):**
- `good` — check fully passes
- `needs-improvement` — check partially passes
- `poor` — check fails
---
## Usage

@@ -96,3 +132,3 @@

`analyzeContent()` runs all 13 built-in checks and returns an aggregated score (0–100) along with per-check results.
`analyzeContent()` runs all 13 built-in checks and returns an aggregated status along with per-check results.

@@ -102,16 +138,15 @@ ```ts

const output = await analyzeContent({
const output = analyzeContent({
title: 'Next.js SEO Best Practices',
metaDescription: 'Learn how to optimize your Next.js app for search engines with meta tags and structured data.',
keyphrase: 'next.js seo',
title: 'Next.js SEO Best Practices',
metaDescription:
'Learn how to optimize your Next.js app for search engines with meta tags and structured data.',
bodyHtml: htmlString,
wordCount: 1250,
content: htmlString,
url: 'https://example.com/nextjs-seo',
images: imageList,
links: { internal: internalLinks, external: externalLinks },
internalLinks: internalLinks,
externalLinks: externalLinks,
});
// output.score → number 0–100
// output.results → AnalysisResult[]
// output.status → 'good' | 'improvement' | 'error'
// output.overallStatus → 'good' | 'needs-improvement' | 'poor'
// output.results → AnalysisResult[]
```

@@ -134,7 +169,12 @@

const titleResult = checkTitle({ keyphrase: 'react seo', title: 'React SEO Guide' });
// { id: 'title-keyphrase', status: 'good', message: 'Focus keyphrase found in title.' }
const titleResults = checkTitle({
title: 'React SEO Guide',
keyphrase: 'react seo',
content: '',
});
// [{ id: 'title-presence', status: 'good', message: '...' },
// { id: 'title-keyphrase', status: 'good', message: '...' }]
const wc = checkWordCount({ wordCount: 250 });
// { id: 'word-count', status: 'improvement', message: 'Word count is below 300 words.' }
const wcResult = checkWordCount({ content: shortHtml });
// { id: 'word-count', status: 'poor', message: 'Content is 180 words, below minimum of 300.' }
```

@@ -144,3 +184,3 @@

Pass `config.disabledChecks` to skip checks that don't apply to your content type (e.g. skip image checks on text-only pages):
Pass `config.disabledChecks` to skip checks that don't apply to your content type:

@@ -150,3 +190,3 @@ ```ts

const output = await analyzeContent(input, {
const output = analyzeContent(input, {
disabledChecks: ['image-alt', 'image-keyphrase', 'external-links'],

@@ -156,34 +196,23 @@ });

### Using in a React Editor
### React Components
Integrate live scoring into a content editor — re-run analysis on every keystroke or debounced change:
Import from the `/react` entry point for pre-built analysis UI components:
```tsx
import { useState, useEffect } from 'react';
import { analyzeContent } from '@power-seo/content-analysis';
import type { ContentAnalysisOutput } from '@power-seo/content-analysis';
import { ContentAnalyzer, ScorePanel, CheckList } from '@power-seo/content-analysis/react';
import type { ContentAnalysisInput } from '@power-seo/content-analysis';
function SeoScorePanel({ content }: { content: EditorContent }) {
const [analysis, setAnalysis] = useState<ContentAnalysisOutput | null>(null);
// All-in-one component
function Editor({ input }: { input: ContentAnalysisInput }) {
return <ContentAnalyzer input={input} />;
}
useEffect(() => {
analyzeContent({
keyphrase: content.keyphrase,
title: content.title,
metaDescription: content.description,
bodyHtml: content.html,
}).then(setAnalysis);
}, [content]);
if (!analysis) return null;
// Or compose individually
function SeoPanel({ input }: { input: ContentAnalysisInput }) {
const result = analyzeContent(input);
return (
<div>
<p>SEO Score: {analysis.score}/100</p>
{analysis.results.map((r) => (
<div key={r.id} className={`check-${r.status}`}>
{r.message}
</div>
))}
</div>
<>
<ScorePanel score={result.score} maxScore={result.maxScore} />
<CheckList results={result.results} />
</>
);

@@ -193,4 +222,31 @@ }

### Inside a CI Content Quality Gate
Block deploys when SEO checks fail:
```ts
import { analyzeContent } from '@power-seo/content-analysis';
const output = analyzeContent({ title, metaDescription, keyphrase, content });
const failures = output.results.filter((r) => r.status === 'poor');
if (failures.length > 0) {
console.error('SEO checks failed:');
failures.forEach((r) => console.error(' ✗', r.message));
process.exit(1);
}
```
---
## API Reference
### Entry Points
| Import | Description |
| --- | --- |
| `@power-seo/content-analysis` | Core analyzer and individual check functions |
| `@power-seo/content-analysis/react` | React components for analysis UI |
### `analyzeContent()`

@@ -202,3 +258,3 @@

config?: AnalysisConfig,
): Promise<ContentAnalysisOutput>;
): ContentAnalysisOutput;
```

@@ -208,50 +264,98 @@

| Prop | Type | Description |
| ----------------- | ------------------------------------------ | ---------------------------------------------------------------------------- |
| `keyphrase` | `string` | Focus keyphrase to analyze against |
| `title` | `string` | Page `<title>` content |
| `metaDescription` | `string` | Meta description content |
| `bodyHtml` | `string` | Full body HTML string |
| `wordCount` | `number` | Pre-computed word count (optional; auto-detected from `bodyHtml` if omitted) |
| `images` | `Array<{src: string; alt?: string}>` | Images found on the page |
| `links` | `{internal: string[]; external: string[]}` | Internal and external link URLs |
| Prop | Type | Required | Description |
| ----------------- | -------------------------------------- | -------- | ---------------------------------------------- |
| `content` | `string` | ✅ | Body HTML string |
| `title` | `string` | — | Page `<title>` content |
| `metaDescription` | `string` | — | Meta description content |
| `keyphrase` | `string` | — | Focus keyphrase to analyze against |
| `url` | `string` | — | Page URL (used for slug analysis) |
| `images` | `Array<{ src: string; alt?: string }>` | — | Images found on the page |
| `internalLinks` | `string[]` | — | Internal link URLs |
| `externalLinks` | `string[]` | — | External link URLs |
#### `ContentAnalysisOutput`
| Field | Type | Description |
| --------- | ------------------ | ---------------------------------------------------------- |
| `score` | `number` | Aggregate score 0–100 |
| `status` | `AnalysisStatus` | `'good'` (≥70) \| `'improvement'` (≥40) \| `'error'` (<40) |
| `results` | `AnalysisResult[]` | Per-check results |
| Field | Type | Description |
| --------------- | ------------------ | --------------------------------------------------------- |
| `overallStatus` | `AnalysisStatus` | `'good'` \| `'needs-improvement'` \| `'poor'` |
| `score` | `number` | Sum of all individual check scores |
| `maxScore` | `number` | Maximum possible score (varies by enabled checks) |
| `results` | `AnalysisResult[]` | Per-check results |
| `recommendations` | `string[]` | Descriptions from all failed or partial checks |
#### `AnalysisResult`
| Field | Type | Description |
| --------- | ---------------- | ---------------------------------------- |
| `id` | `CheckId` | Unique check identifier |
| `status` | `AnalysisStatus` | `'good'` \| `'improvement'` \| `'error'` |
| `message` | `string` | Human-readable feedback |
| Field | Type | Description |
| --------- | ---------------- | --------------------------------------------- |
| `id` | `CheckId` | Unique check identifier (see table below) |
| `status` | `AnalysisStatus` | `'good'` \| `'needs-improvement'` \| `'poor'` |
| `message` | `string` | Human-readable actionable feedback |
| `score` | `number` | Points earned for this check |
| `maxScore`| `number` | Maximum points for this check |
#### `AnalysisConfig`
| Field | Type | Description |
| ---------------- | ----------- | ----------------------------------------- |
| `disabledChecks` | `CheckId[]` | List of check IDs to skip during analysis |
### Individual Check Functions
| Function | Checks For |
| ----------------------------- | --------------------------------------- |
| `checkTitle(input)` | Title presence and keyphrase inclusion |
| `checkMetaDescription(input)` | Description presence, length, keyphrase |
| `checkKeyphraseUsage(input)` | Density (0.5–3%) and distribution |
| `checkHeadings(input)` | H1 existence and keyphrase in headings |
| `checkWordCount(input)` | Minimum 300-word threshold |
| `checkImages(input)` | Alt text presence and keyphrase in alt |
| `checkLinks(input)` | Internal and external link presence |
| Function | Check ID(s) | Checks For |
| ----------------------------- | -------------------------------------------------------------- | -------------------------------------------------- |
| `checkTitle(input)` | `title-presence`, `title-keyphrase` | Title presence, length (30–60 chars), keyphrase |
| `checkMetaDescription(input)` | `meta-description-presence`, `meta-description-keyphrase` | Description presence, length (120–160 chars), keyphrase |
| `checkKeyphraseUsage(input)` | `keyphrase-density`, `keyphrase-distribution` | Density (0.5–2.5%) and occurrence in key areas |
| `checkHeadings(input)` | `heading-structure`, `heading-keyphrase` | H1 presence, hierarchy, keyphrase in subheadings |
| `checkWordCount(input)` | `word-count` | Min 300 words (good at 1,000+) |
| `checkImages(input)` | `image-alt`, `image-keyphrase` | Alt text presence and keyphrase in alt |
| `checkLinks(input)` | `internal-links`, `external-links` | Internal and external link presence |
### Types
| Type | Description |
| ----------------------- | ------------------------------------ |
| `CheckId` | Union of all 13 built-in check IDs |
| `AnalysisConfig` | `{ disabledChecks?: CheckId[] }` |
| `AnalysisStatus` | `'good' \| 'improvement' \| 'error'` |
| `ContentAnalysisInput` | Input shape for `analyzeContent()` |
| `ContentAnalysisOutput` | Output shape from `analyzeContent()` |
| Type | Description |
| ----------------------- | --------------------------------------------------------- |
| `CheckId` | Union of all 13 built-in check IDs |
| `AnalysisConfig` | `{ disabledChecks?: CheckId[] }` |
| `AnalysisStatus` | `'good' \| 'needs-improvement' \| 'poor'` |
| `ContentAnalysisInput` | Input shape for `analyzeContent()` |
| `ContentAnalysisOutput` | Output shape from `analyzeContent()` |
| `AnalysisResult` | Single check result with id, status, message, score |
---
## Use Cases
- **Headless CMS** — score content as editors write, before publishing
- **Next.js / Remix apps** — run analysis server-side per route and expose scores in admin dashboards
- **SaaS landing pages** — enforce SEO quality programmatically across all marketing pages
- **eCommerce product pages** — validate product titles, descriptions, and image alt text at scale
- **Blog platforms** — provide real-time Yoast-style feedback in the post editor
- **CI/CD content gates** — block deploys when SEO checks fail
---
## Architecture Overview
- **Pure TypeScript** — no compiled binary, no native modules
- **Zero runtime dependencies** — only `@power-seo/core` as a peer dependency
- **Framework-agnostic** — works in any JavaScript environment
- **SSR compatible** — safe to run in Next.js Server Components, Remix loaders, or Express handlers
- **Edge runtime safe** — no Node.js-specific APIs; runs in Cloudflare Workers, Vercel Edge, Deno
- **Tree-shakeable** — `"sideEffects": false` with named exports per check function
- **Dual ESM + CJS** — ships both formats via tsup for any bundler or `require()` usage
---
## Supply Chain Security
- No install scripts (`postinstall`, `preinstall`)
- No runtime network access
- No `eval` or dynamic code execution
- npm provenance enabled — every release is signed via Sigstore through GitHub Actions
- CI-signed builds — all releases published via verified `github.com/CyberCraftBD/power-seo` workflow
- Safe for SSR, Edge, and server environments
---
## The [@power-seo](https://www.npmjs.com/org/power-seo) Ecosystem

@@ -283,13 +387,17 @@

## Keywords
seo content analysis · yoast seo alternative · content scoring typescript · keyword density checker · react seo scoring · nextjs content analysis · seo score npm · focus keyphrase checker · meta description validator · heading seo checker · content quality gate · headless cms seo · seo readability checker · content optimization library · programmatic seo · keyphrase density analyzer · seo audit npm package · typescript seo library · content seo automation · react editor seo · ci seo check · edge runtime seo
---
## About [CyberCraft Bangladesh](https://ccbd.dev)
**[CyberCraft Bangladesh](https://ccbd.dev)** 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.
**[CyberCraft Bangladesh](https://ccbd.dev)** is a Bangladesh-based enterprise-grade software development and Full Stack SEO service provider 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.
| | |
| -------------------- | -------------------------------------------------------------- |
| **Website** | [ccbd.dev](https://ccbd.dev) |
| **GitHub** | [github.com/cybercraftbd](https://github.com/cybercraftbd) |
| **npm Organization** | [npmjs.com/org/power-seo](https://www.npmjs.com/org/power-seo) |
| **Email** | [info@ccbd.dev](mailto:info@ccbd.dev) |
[![Website](https://img.shields.io/badge/Website-ccbd.dev-blue?style=for-the-badge)](https://ccbd.dev)
[![GitHub](https://img.shields.io/badge/GitHub-cybercraftbd-black?style=for-the-badge&logo=github)](https://github.com/cybercraftbd)
[![npm](https://img.shields.io/badge/npm-power--seo-red?style=for-the-badge&logo=npm)](https://www.npmjs.com/org/power-seo)
[![Email](https://img.shields.io/badge/Email-info@ccbd.dev-green?style=for-the-badge&logo=gmail)](mailto:info@ccbd.dev)
© 2026 [CyberCraft Bangladesh](https://ccbd.dev) · Released under the [MIT License](../../LICENSE)