@codepark-apps/seofaster-nextjs
v0.1.10
Published
SEO Faster API client for Next.js - fetch and display AI-generated SEO content
Downloads
1,047
Maintainers
Readme
@codepark-apps/seofaster-nextjs
Turn Keywords into Traffic-Driving Content
🚀 seofaster.app
SEO Faster generates hundreds of SEO-optimized articles from your keywords using AI — in 19+ languages, with your brand voice.
This package lets you fetch and display that content on your Next.js website in minutes.
Why SEO Faster?
- Programmatic SEO at Scale — Generate 100s of articles from a keyword list
- 19+ Languages — Reach global audiences with native-quality content
- Your Brand Voice — AI learns your tone, style, and terminology
- SEO-Optimized — Built-in scoring, meta tags, FAQs, and schema markup
- One-Click Publishing — Push to WordPress, Webflow, Ghost, and more
Installation
npm install @codepark-apps/seofaster-nextjsQuick Start
1. Create a client
// lib/seofaster.ts
import { createSEOFasterClient } from '@codepark-apps/seofaster-nextjs';
export const seoFaster = createSEOFasterClient({
apiKey: process.env.SEOFASTER_SECRET_KEY!,
});2. Fetch articles
// app/blog/page.tsx
import { seoFaster } from '@/lib/seofaster';
export default async function BlogPage() {
const { articles } = await seoFaster.getArticles({ limit: 10 });
return (
<div>
{articles.map((article) => (
<a key={article._id} href={`/blog/${article.slug}`}>
<h2>{article.title}</h2>
<p>{article.metaDescription}</p>
</a>
))}
</div>
);
}3. Display single article
// app/blog/[slug]/page.tsx
import { seoFaster } from '@/lib/seofaster';
import { notFound } from 'next/navigation';
export default async function ArticlePage({
params,
}: {
params: { slug: string };
}) {
const article = await seoFaster.getArticleBySlug(params.slug);
if (!article) {
notFound();
}
return (
<article>
<h1>{article.title}</h1>
{/* Use content.html for full content with embedded images */}
<div
dangerouslySetInnerHTML={{
__html: article.content.html || article.content.markdown,
}}
/>
</article>
);
}Tip: Always prefer
content.htmlovercontent.markdown— HTML includes all section images and rich formatting.
API Reference
createSEOFasterClient(config)
Creates a new SEO Faster client.
const client = createSEOFasterClient({
apiKey: 'cp_seof_sec_xxx', // Required: Your secret API key
baseUrl: 'https://...', // Optional: Custom API URL
});client.getArticles(options?)
Fetches a list of published articles.
const { articles, total, page, limit } = await client.getArticles({
page: 1, // Page number (default: 1)
limit: 10, // Articles per page (default: 10)
locale: 'en', // Filter by locale (optional)
});client.getArticleBySlug(slug, locale?)
Fetches a single article by its slug.
const article = await client.getArticleBySlug('my-article-slug');
// Returns null if not foundTypes
interface ArticleContent {
markdown: string; // Markdown content
html?: string; // HTML content with embedded images (preferred)
}
interface Article {
_id: string;
title: string;
slug: string;
content: ArticleContent; // Use content.html for full rendering
metaDescription?: string;
featuredImage?: {
url: string;
alt?: string;
};
author?: {
name: string;
title?: string;
photo?: { url: string; alt?: string };
};
faqs?: Array<{
question: string;
answer: string;
}>;
seoScore?: number;
locale?: string;
status: 'draft' | 'published';
publishedAt?: string;
createdAt: string;
updatedAt: string;
}Environment Variables
Add your secret API key to .env.local:
SEOFASTER_SECRET_KEY=cp_seof_sec_xxxxxNote: Use secret keys (
cp_seof_sec_*) for Next.js since it runs on the server. Public keys (cp_seof_pub_*) are for static sites where keys are exposed in the browser.
Get your API key from seofaster.app/api-keys.
License
MIT
