Package Exports
- @sophonn/sophon
Readme
Sophon
Sophon is an open source programmatic SEO toolkit packaged as an npm library with both a CLI and programmatic API. It turns a seed keyword or entity list into framework-specific pages, sitemaps, schema markup, internal linking data, and optional AI enrichment outputs.
The package is prepared to publish as @sophonn/sophon while keeping the CLI command name sophon.
It is framework agnostic in its core logic and currently ships generation adapters for:
- Next.js
- Astro
- Nuxt 3
- SvelteKit
- Remix
Who This Is For
Indie hackers
Use Sophon to go from a niche keyword to dozens or hundreds of long-tail landing pages without building a custom content pipeline from scratch.
Agencies
Standardize pSEO execution across client projects with a repeatable discovery and generation workflow.
Enterprise teams
Use Sophon as a controlled scaffolding layer for large SEO surfaces, while keeping routing, data, and review workflows inside your existing Next.js codebase.
Core Workflow
- Discover entities from either a CSV file or a seed keyword.
- Persist those entities to
data/entities.json. - Generate static entity routes for the Next.js App Router at
app/[slug]/page.tsx. - Generate technical SEO assets such as
sitemap.xml,robots.txt, schema records, and internal link graphs. - Replace the scaffolded TODO sections with your AI content generation provider and domain-specific enrichment logic.
Repository Structure
.
├── AGENT.md
├── README.md
├── src/
│ ├── adapters/
│ ├── cli.ts
│ ├── core/
│ ├── index.ts
│ └── types.ts
├── package.json
├── tsconfig.json
└── tsup.config.tsQuickstart
1. Install dependencies
npm installTo use the published package in another project:
npm install @sophonn/sophon2. Build the package
npm run build3. Initialize Sophon in a host project
npx @sophonn/sophon init --framework nextjsThis creates sophon.config.json with detected or specified framework defaults.
4. Discover entities
From a seed keyword:
npx @sophonn/sophon discover --seed "best payroll software"With custom expansion patterns:
npx @sophonn/sophon discover \
--seed "best payroll software" \
--pattern "{seed} alternatives" \
--pattern "{seed} pricing" \
--pattern "best {seed}"From a CSV file:
npx @sophonn/sophon discover --csv ./input/entities.csvThis writes normalized entities into data/entities.json by default, or to --discover-output when provided.
5. Generate pages
npx @sophonn/sophon generate --framework nextjsSophon generates one static page per entity. Output roots by framework default to:
nextjs->app/[slug]/page.tsxastro->src/pages/[slug].astronuxt->pages/[slug].vuesveltekit->src/routes/[slug]/+page.svelteandsrc/routes/[slug]/+page.tsremix->app/routes/[slug].tsx
Notes:
- Repeated
--patternflags are preferred over--patterns "a|b|c"because they are less fragile in shells. - Extra CSV columns are preserved in
metadata.attributesso downstream generation can use them. - Entity IDs are deterministic and source-agnostic, so the same normalized entity produces the same ID across CSV and seed discovery.
- Discovery still uses placeholder seed expansion today; provider-backed entity discovery remains the main unfinished capability.
- For SvelteKit, the companion
+page.tsfile contains the prerenderable entity payload that feeds the generated+page.sveltecomponent.
6. Generate technical SEO assets
npx @sophonn/sophon technical --site https://example.comThis produces scaffolds for:
sitemap.xmlrobots.txtpublic/sophon/schema.jsonpublic/sophon/internal-links.json
The technical generator now also:
- adds
lastmodto sitemap entries - infers a schema type heuristically instead of always using
Article - links entities by shared seed keyword and tags rather than array position
- logs a concrete output summary for every run
7. Run the full pipeline
npx @sophonn/sophon run --seed "best payroll software" --framework nextjs --site https://example.comPer-step output overrides are supported for the full pipeline:
npx @sophonn/sophon run \
--seed "best payroll software" \
--framework sveltekit \
--site https://example.com \
--discover-output ./data/payroll-entities.json \
--generate-output ./src/routes \
--technical-output ./static \
--enrich-output ./data/enriched--output still works for single-command flows, but run should prefer step-specific flags so discovery, generation, technical assets, and enrichment can land in different locations.
Programmatic API
Sophon also exposes a library API:
import { discover, generate, technical, enrich } from "@sophonn/sophon";
const result = await discover({ seed: "best payroll software" });
await generate({
entities: result.entities,
framework: "nextjs",
output: "app",
});
await technical({
entities: result.entities,
site: "https://example.com",
output: "public",
});
await enrich({
entities: result.entities,
output: "data/enriched",
});Claude Code Native
Sophon ships with AGENT.md, which gives Claude Code an explicit operating playbook so a user can clone this repository and ask Claude Code to run Sophon autonomously inside their own project.
Typical prompt:
Use Sophon to add a programmatic SEO surface to this Next.js app for the niche "best employee scheduling software". Discover entities, generate the route scaffold, and wire the technical SEO outputs into this codebase.Publishing
When you are ready to publish:
npm pack --dry-run
npm run build
npm publish --access publicIf you want to verify the package contents first:
npm pack --dry-runRecommended prepublish checklist:
- confirm you are logged into the npm account that owns the
@sophiasuuscope - confirm
npm run typecheckpasses - confirm
npm run buildpasses - inspect the
npm pack --dry-runfile list - confirm
ANTHROPIC_API_KEYis not required for install or basic CLI usage - confirm the MIT license in
LICENSEmatches how you want downstream users to consume the package
Current Scope
Included in this scaffold:
- entity ingestion via CSV
- seed-keyword based placeholder discovery
- multi-framework page generation via CLI and API
- technical SEO asset generation
- shared types in
src/types.ts - AI enrichment entrypoint via the Anthropic SDK
- clear TODO markers for AI content generation and external data enrichment
Not implemented yet:
- live SERP scraping
- AI-assisted entity expansion
- automatic semantic clustering
- provider adapters for LLMs and search APIs
- CMS sync or publishing workflows
Design Principles
- Framework agnostic core, Next.js first output
- Minimal config to get started
- Claude Code native workflow
- Built for scale across hundreds or thousands of pages
Roadmap
- Add pluggable entity discovery providers.
- Improve enrichment prompt orchestration and structured output validation.
- Replace heuristic schema selection with niche-aware schema presets.
- Add review and approval workflows before publishing.
- Package Sophon as an installable CLI.