BridgeToAgentGet the kit — $49
All install guides
Next.js~3 minBeginner

Install your Agentic Kit on Next.js

Next.js serves files placed in the public/ directory directly at the root of your domain — no redirects, no rewrites, no platform-specific tooling. This is the cleanest installation in the entire kit.

You'll be done in under 3 minutes.

This guide also applies to most modern static-site generators that follow the same convention: Astro, Hugo (static/), Eleventy, Gatsby, and Vite-based sites.


Step 1 — Drop the three files into public/

In your repository root:

cp /path/to/agents.json public/
cp /path/to/llms.txt public/
cp /path/to/agent-instructions.md public/

That's the entire copy step. Next.js serves them at:

  • /agents.jsonpublic/agents.json
  • /llms.txtpublic/llms.txt
  • /agent-instructions.mdpublic/agent-instructions.md

with correct content-types inferred from the extension.

🔒 Don't edit next.config.js for this. No rewrites, no headers, no custom middleware needed. The public/ directory is the supported path.

Step 2 — Add auto-discovery links to <head>

Open your root layout — usually app/layout.tsx for App Router or pages/_document.tsx for Pages Router.

App Router (app/layout.tsx)

Add the links inside the <head> slot. The cleanest way is via metadata:

import type { Metadata } from "next";

export const metadata: Metadata = {
  // ...your existing metadata
  alternates: {
    types: {
      "application/json": "/agents.json",
      "text/plain": "/llms.txt",
      "text/markdown": "/agent-instructions.md",
    },
  },
};

Next.js renders these as <link rel="alternate"> tags automatically.

Pages Router (pages/_document.tsx)

import Document, { Html, Head, Main, NextScript } from "next/document";

export default class MyDocument extends Document {
  render() {
    return (
      <Html lang="en">
        <Head>
          <link rel="alternate" type="application/json" title="Agent Action Map" href="/agents.json" />
          <link rel="alternate" type="text/plain" title="LLM Context" href="/llms.txt" />
          <link rel="alternate" type="text/markdown" title="Agent Runbook" href="/agent-instructions.md" />
        </Head>
        <body>
          <Main />
          <NextScript />
        </body>
      </Html>
    );
  }
}

Step 3 — Deploy

Commit and push. If you deploy to Vercel, Netlify, Cloudflare Pages, or any host that respects Next.js's public/ convention, the files are live the moment the deploy completes.

Step 4 — Verify

Open each URL in a new tab:

  • https://yourdomain.com/agents.json
  • https://yourdomain.com/llms.txt
  • https://yourdomain.com/agent-instructions.md

Each should serve the file content with the correct content-type. You can also confirm with curl:

curl -I https://yourdomain.com/agents.json
# Look for: Content-Type: application/json

Regenerating on a schedule

For sites where the kit needs to stay in sync with content changes, add a small build step that fetches a fresh kit from BridgeToAgent during your CI run.

Example GitHub Actions step:

- name: Refresh Agentic Kit
  run: |
    curl -L "https://bridgetoagent.com/api/kit?site=https://yourdomain.com&key=$KIT_KEY" \
      -o /tmp/kit.zip
    unzip -o /tmp/kit.zip -d public/
  env:
    KIT_KEY: ${{ secrets.BTA_KIT_KEY }}

Talk to us if you want a long-lived regeneration key — the default purchase covers a single download but we offer regeneration access on request.


Static-site generator variants

ToolStatic directory
Next.jspublic/
Astropublic/
Hugostatic/
Eleventypublic/ (or _site/static/)
Gatsbystatic/
Vitepublic/
SvelteKitstatic/
Remixpublic/

The flow is identical — drop the three files into the static directory, build, and deploy.


Troubleshooting

Files return 404 after deploy. Confirm they're committed (git status). The public/ directory is usually not in .gitignore but check anyway. Also confirm your build process copies public/ to the deploy output (it does by default in every framework listed above).

Wrong content-type. Next.js maps extensions correctly by default. If a host in front of Next.js (Cloudflare, CloudFront) is rewriting headers, check its config — set the override explicitly there.

HMR / dev server doesn't pick up new files. Restart the dev server. New files in public/ are picked up on restart, not via HMR.


Need a hand? Reply to your purchase receipt and we'll help directly.