# Search and Deployment Setup

This guide covers the public marketing/documentation site for `@ai-node-editor/core`. The npm library build and the website build are intentionally separate:

- `npm run build` creates the publishable library in `dist/`.
- `npm run site:build` creates the prerendered website in `site-dist/`.
- Marketing video files remain on the website and are not added to the npm tarball.

## What Is Already Configured

The website build now provides:

- prerendered HTML instead of an empty JavaScript app shell;
- a unique title, description, canonical URL, and robots directive per page;
- Open Graph and Twitter preview metadata;
- `SoftwareApplication` JSON-LD;
- `robots.txt`, `sitemap.xml`, `site.webmanifest`, and `llms.txt`;
- an original SVG favicon;
- crawlable documentation and keyword-focused pages;
- a build-time SEO validation script;
- a helper for adding the final website and repository URLs to `package.json`.

## Test Everything Locally

Build the site with safe localhost canonical URLs:

```powershell
npm run site:build:local
```

Start the production preview:

```powershell
npm run site:preview
```

Open `http://127.0.0.1:4173`. Also test these generated pages:

- `http://127.0.0.1:4173/docs/getting-started/`
- `http://127.0.0.1:4173/templates/`
- `http://127.0.0.1:4173/react-ai-workflow-editor/`
- `http://127.0.0.1:4173/rag-workflow-builder/`
- `http://127.0.0.1:4173/ai-agent-node-editor/`
- `http://127.0.0.1:4173/sitemap.xml`
- `http://127.0.0.1:4173/robots.txt`

Local builds intentionally disallow crawlers in `robots.txt`. Production builds allow crawling.

## 1. Create the Public GitHub Repository

Create a public GitHub repository named `ai-node-editor`. Do not add generated `dist/`, `site-dist/`, or media build artifacts to source control unless you deliberately need them; `.gitignore` is already configured.

This workspace currently has an empty `.git` directory. After creating the repository on GitHub, initialize and push it:

```powershell
git init
git add .
git commit -m "Publish AI Node Editor source"
git branch -M main
git remote add origin https://github.com/YOUR-ACCOUNT/ai-node-editor.git
git push -u origin main
```

On GitHub, set:

- Description: `React AI workflow node editor and TypeScript graph engine for RAG, agents, and automation.`
- Website: your production website URL.
- Topics: `react`, `typescript`, `ai-workflow`, `node-editor`, `rag`, `agents`, `automation`, `graph-editor`.
- Issues: enabled.

## 2. Choose a Public Website URL

Use a permanent HTTPS domain or subdomain, for example `https://ainodeeditor.example`. The current build expects a root domain or subdomain rather than a path such as `example.com/project/`.

Configure your hosting provider with:

- Install command: `npm ci`
- Build command: `npm run site:build`
- Output directory: `site-dist`
- Environment variable: `SITE_URL=https://YOUR-DOMAIN`

The host must serve existing directory `index.html` files and return `404.html` for unknown pages. No server-side runtime is required.

Before deployment, build once on Windows with the real URL:

```powershell
$env:SITE_URL="https://YOUR-DOMAIN"
npm run site:build
```

Inspect `site-dist/index.html`, `site-dist/sitemap.xml`, and `site-dist/robots.txt`. Every canonical and sitemap URL must use the final domain.

## 3. Connect npm to the Website and Repository

Once both URLs are public, run:

```powershell
npm run metadata:configure -- --homepage=https://YOUR-DOMAIN --repository=https://github.com/YOUR-ACCOUNT/ai-node-editor
```

This updates `homepage`, `repository`, and `bugs` in `package.json`. Review the resulting file, then publish a new version because npm versions are immutable:

```powershell
npm version patch
npm run release:check
npm publish --access public
```

The updated description and search keywords are already prepared locally for that release.

## 4. Register Google Search Console

1. Open [Google Search Console](https://search.google.com/search-console/).
2. Add a **Domain property** for the production domain.
3. Add the provided DNS TXT record at your domain registrar.
4. Wait for verification to succeed.
5. Open **Sitemaps** and submit `https://YOUR-DOMAIN/sitemap.xml`.
6. Use **URL Inspection** for the homepage and each main documentation page.
7. Select **Request indexing** once for each important URL.
8. Inspect the rendered HTML and confirm the heading, description, canonical URL, links, and structured data are visible.

Do not repeatedly submit the same URLs. Google controls crawl scheduling, and indexing can take days or weeks.

## 5. Validate Search Presentation

After deployment, run the production URL through:

- [Google Rich Results Test](https://search.google.com/test/rich-results)
- [PageSpeed Insights](https://pagespeed.web.dev/)
- Search Console URL Inspection

Then monitor these searches over time:

```text
"@ai-node-editor/core"
site:YOUR-DOMAIN
React AI workflow node editor
RAG workflow editor React
AI agent node editor TypeScript
```

## 6. Build Authority, Not Just Metadata

Technical SEO makes the product crawlable; useful references help it rank. Publish original pages or posts that link to the relevant documentation page and npm package:

- Build a RAG workflow editor in React.
- Create custom typed nodes for an AI workflow builder.
- Validate and serialize AI workflow graphs in TypeScript.
- Build an agent workflow with tools, memory, and human approval.
- Migrate a generic node graph into an AI-specific workflow editor.

Include runnable code, screenshots, and links to the live demo. Avoid duplicated articles, keyword stuffing, purchased links, and automated directory spam.

## Release Checklist

- [ ] Public GitHub repository exists and contains the source.
- [ ] Production website uses HTTPS and a permanent domain.
- [ ] `SITE_URL` is configured on the host.
- [ ] `npm run site:build` succeeds.
- [ ] `npm run site:check` succeeds.
- [ ] `robots.txt` says `Allow: /` in production.
- [ ] `sitemap.xml` contains only final production URLs.
- [ ] npm `homepage`, `repository`, and `bugs` point to public URLs.
- [ ] A new npm patch version is published.
- [ ] Search Console property is verified.
- [ ] Sitemap is submitted and priority pages requested once.
- [ ] Rich Results Test can see the software application data.
