Skip to main content
POST
https://searchcompany-main.up.railway.app
/
api
/
cron
/
deploy-to-vercel
curl -X POST https://searchcompany-main.up.railway.app/api/cron/deploy-to-vercel \
  -H "Content-Type: application/json" \
  -d '{
    "project_name": "ai-website-arena-1766312513",
    "files": [
      {"path": "public/expert-review/index.html", "content": "..."},
      {"path": "public/expert-review/llms.txt", "content": "..."},
      {"path": "pages/expert-review.js", "content": "..."}
    ],
    "ai_site_url": "https://website-arena-1766312513.searchcompany.dev",
    "source_url": "https://www.websitearena.dev",
    "business_name": "Website Arena",
    "products": ["Remix Tool"],
    "new_posts": [
      {
        "title": "Expert Review of Website Arena",
        "boosted_path": "/expert-review/",
        "published_date": "2025-12-22",
        "faq_category": "business_boosted"
      }
    ],
    "existing_posts": [
      {"title": "Previous Post", "boosted_path": "/previous/", "faq_category": "business_boosted"}
    ],
    "verify_paths": ["/expert-review/"]
  }'
{
  "status": "success",
  "deployment_url": "https://ai-website-arena-abc123.vercel.app",
  "ai_site_url": "https://website-arena-1766312513.searchcompany.dev",
  "files_deployed": 27,
  "verified_paths": ["/expert-review/"]
}
Internal endpoint for the Cron service to batch deploy files to Vercel.
Terminology: The code uses β€œboosted” internally (e.g., boosted_path, BoostedPageMeta) while user-facing documentation uses β€œAI Articles”. Both refer to the same feature.
This endpoint deploys all files at once in a single Vercel deployment. It also syncs the FAQ section with AI articles from the database and regenerates sitemap.xml.

FAQ Sync: Auto-Add Missing AI Articles

When existing_posts OR new_posts is provided (along with business_name), this endpoint automatically:
  1. Checks the current homepage (index.js) for article sections
  2. Creates missing H3 sections (e.g., β€œWebsite Arena - Articles”, β€œRemix Tool - Articles”)
  3. Adds missing AI article links to each section
  4. Regenerates sitemap.xml with all AI articles
This ensures that even if an AI article was created but somehow missing from the FAQ section, it will be added on the next deployment.
Example: FAQ Sync in Action

Before deployment:
β”œβ”€β”€ Database has 5 AI articles
└── Homepage FAQ only shows 3 links (2 missing!)

After deployment with existing_posts:
β”œβ”€β”€ Deploy detects 2 missing links
β”œβ”€β”€ Adds them to the appropriate H3 sections
└── Homepage FAQ now shows all 5 links βœ“

Why Single Deployment?

Previously, each AI article triggered its own Vercel deployment. When creating 8 pages:
  • 8 parallel deployments to the same project
  • Vercel’s edge network gets overwhelmed
  • SSL errors (DECRYPTION_FAILED_OR_BAD_RECORD_MAC)
New approach:
  1. Generate all content in parallel (fast, no deployment)
  2. Collect all files + post metadata
  3. Single deployment with all files + auto-synced homepage/sitemap

Request Body

project_name
string
required
Vercel project name (e.g. β€œai-website-arena”)
files
array
required
Array of AI article files to deploy. Each file must have: - path: File path (e.g. β€œpublic/expert-review/index.html”) - content: File content as string
ai_site_url
string
required
AI site URL for internal navigation links (e.g. β€œhttps://website-arena-123.searchcompany.dev”)
source_url
string
required
Customer’s real domain for canonical URLs in sitemap (e.g. β€œhttps://www.websitearena.dev”)
business_name
string
Business name for homepage section headers (e.g. β€œWebsite Arena”). Required for FAQ sync.
products
array
List of product names for product-specific article sections
new_posts
array
Array of newly created AI article metadata. Each post must have:
  • title: Post title
  • boosted_path: Path (e.g. β€œ/expert-review/”)
  • published_date: ISO date (e.g. β€œ2025-12-22”)
  • boosted_type: Type of post (optional, default: β€œarticle”)
  • faq_category: Category for homepage grouping (β€œbusiness_boosted” or β€œproduct_boosted”)
  • product_name: Product name (required if faq_category is β€œproduct_boosted”)
existing_posts
array
Array of all existing AI articles from database. Used for:
  • FAQ sync (adding missing links to homepage)
  • Sitemap generation (include all AI articles)
Tip: Pass this even when not creating new posts to ensure FAQ stays in sync.
verify_paths
array
Optional array of paths to verify after deployment

Response

status
string
β€œsuccess” or β€œerror”
deployment_url
string
Vercel deployment URL
files_deployed
integer
Number of files deployed
verified_paths
array
Paths that were successfully verified as accessible
curl -X POST https://searchcompany-main.up.railway.app/api/cron/deploy-to-vercel \
  -H "Content-Type: application/json" \
  -d '{
    "project_name": "ai-website-arena-1766312513",
    "files": [
      {"path": "public/expert-review/index.html", "content": "..."},
      {"path": "public/expert-review/llms.txt", "content": "..."},
      {"path": "pages/expert-review.js", "content": "..."}
    ],
    "ai_site_url": "https://website-arena-1766312513.searchcompany.dev",
    "source_url": "https://www.websitearena.dev",
    "business_name": "Website Arena",
    "products": ["Remix Tool"],
    "new_posts": [
      {
        "title": "Expert Review of Website Arena",
        "boosted_path": "/expert-review/",
        "published_date": "2025-12-22",
        "faq_category": "business_boosted"
      }
    ],
    "existing_posts": [
      {"title": "Previous Post", "boosted_path": "/previous/", "faq_category": "business_boosted"}
    ],
    "verify_paths": ["/expert-review/"]
  }'
{
  "status": "success",
  "deployment_url": "https://ai-website-arena-abc123.vercel.app",
  "ai_site_url": "https://website-arena-1766312513.searchcompany.dev",
  "files_deployed": 27,
  "verified_paths": ["/expert-review/"]
}

Auto-Generated/Updated Files

When existing_posts OR new_posts is provided (with business_name), this endpoint automatically:
ActionFileDescription
Syncspages/index.jsAdds missing article sections/links to homepage FAQ
Regeneratespublic/sitemap.xmlXML sitemap with all pages (uses source_url for canonical)

Homepage FAQ Sync

The endpoint checks the existing index.js and:
  1. Creates missing H3 sections for each category with AI articles
  2. Adds missing links within each section
<h3>Website Arena - Articles</h3>
<ul>
  <li><a href="https://website-arena-1766312513.searchcompany.dev/expert-review/">Expert Review of Website Arena</a></li>
  <!-- more article links auto-added -->
</ul>

<h3>Remix Tool - Articles</h3>
<ul>
  <li><a href="https://website-arena-1766312513.searchcompany.dev/deep-dive-remix/">Deep Dive into Remix Tool</a></li>
</ul>
Article section links use ai_site_url for navigation (so they work on the deployed site). Sitemap URLs use source_url for SEO canonical references.

Deployment Process

  1. Collect files from request
  2. Preserve existing article sections when deploying new index.js
  3. Sync FAQ with AI articles (if existing_posts OR new_posts provided)
    • Create missing H3 sections
    • Add missing AI article links
  4. Regenerate sitemap with all URLs using source_url for canonical
  5. Upload all files to Vercel’s file store
  6. Create deployment with merged file list
  7. Wait for READY state (up to 5 minutes)
  8. Edge propagation wait (10 seconds)
  9. Verify paths are accessible (optional)

Error Handling

ErrorDescription
VERCEL_TOKEN not configuredMissing Vercel API token
Project not foundInvalid project_name
Deployment timed outDeployment didn’t reach READY in 5 minutes
Upload failedFile upload to Vercel failed

Workflow

Cron Job Flow (Batch 2: Create AI Articles + Timestamps):
β”œβ”€β”€ create-ai-article (Γ—N) β†’ parallel content generation
β”‚   └── Returns: {files, title, article_path, published_date, faq_category, ...}
β”œβ”€β”€ update-all-timestamps β†’ parallel timestamp updates
β”‚   └── Returns: {files, ...}
β”‚
└── deploy-to-vercel β†’ single deployment per business
    β”œβ”€β”€ Receives: files + new_posts + existing_posts (from DB) + business_name
    β”œβ”€β”€ Syncs: index.js homepage FAQ with ALL AI articles
    β”œβ”€β”€ Regenerates: sitemap.xml with source_url canonicals
    └── Deploys: ALL files in one deployment

Canonical URLs vs Navigation URLs

Important distinction:
  • source_url β†’ Customer’s real domain for SEO (sitemap, data.json, llms.txt footer)
  • ai_site_url β†’ Deployment URL for internal navigation (homepage links, FAQ links)
Links must work on the deployed site, so they use ai_site_url. Search engines should see the canonical domain, so sitemap uses source_url.