Railyard Insights (insights.ereboslab.com) was flagged but deliberately left out of the 2026-11-06 Vend/Toolgate AI-discoverability pass as a different product shape. Live-checked the dispatching premise first: the real public surface is this Cloudflare Worker (apps/insights-edge), not apps/insights (the vendored Umami Next.js fork, which has no route serving this host) -- so this follows Toolgate's small-service pattern, not a Next.js app router. - `GET /llms.txt`, `/llms-full.txt`, `/ai.txt` (llmstxt.org / ai-visibility.org.uk conventions, src/llms.mjs). - `GET /index.md`, `/privacy.md`, `/cookieless-analytics.md`, `/google-analytics-alternative.md`, `/plausible-alternative.md`, `/fathom-analytics-alternative.md` -- markdown mirrors built by a new `toMarkdown()` converter applied to the exact same `body` HTML string each page already renders for `shell()`, so HTML and markdown can never drift (Toolgate's `/catalog.md` approach, not Vend's hand-ported static file). Mirror headers: text/markdown, X-Robots-Tag noindex/follow, Content-Location + Link rel=canonical back to the real page. - `shell()` now emits `<meta name="ai-summary">` + `<link rel="alternate" type="text/markdown">` on all 6 real pages, plus a footer `llms.txt` link. - Verified: fixed a broken local workerd binary install, ran the full existing test suite (88/88 pass, 0 regressions), curled every new route against a local wrangler dev instance, deployed, then curled every new and existing route against production insights.ereboslab.com (200s, correct content-type/headers/content, bogus .md path still 404s).
145 lines
7.3 KiB
JavaScript
145 lines
7.3 KiB
JavaScript
// AI-discoverability for Railyard Insights (2026-11-07): `GET /llms.txt`,
|
|
// `GET /llms-full.txt`, `GET /ai.txt` -- the same llmstxt.org /
|
|
// ai-visibility.org.uk conventions already shipped for Vend
|
|
// (`apps/vend/crates/vend-server`) and Toolgate
|
|
// (`apps/toolgate/crates/switchyard-server`); see `plans/railyard.md`'s
|
|
// 2026-11-06 "AI-discoverability pass" entry, which flagged Insights as a
|
|
// real, uncovered public surface and deliberately left it for a dedicated
|
|
// pass. The markdown mirrors this file links to (`pages.mjs`'s
|
|
// `*Markdown()` exports) are built from the exact same `body` HTML string
|
|
// each page already renders, so the HTML and the markdown can never drift.
|
|
//
|
|
// Correction of the dispatching task's premise, checked live rather than
|
|
// assumed: `insights.ereboslab.com` is served by *this* Cloudflare Worker
|
|
// (`apps/insights-edge`, plain JS, no framework), not by `apps/insights`
|
|
// (the vendored Umami Next.js fork). `curl -sS https://insights.ereboslab.com/`
|
|
// returns byte-for-byte the output of `pages.mjs`'s `landingPage()`; `apps/insights`
|
|
// has no route serving that host. The Next.js app may back a future team
|
|
// dashboard, but it is not the real public surface this task is about, so
|
|
// the shape followed here is Toolgate's (small service, additive routes),
|
|
// not HomePlan/Bidstage's (Next.js `app/llms.txt/route.ts`).
|
|
|
|
import { FREE } from "./pages.mjs";
|
|
import {
|
|
CANONICAL,
|
|
cookielessAnalyticsMarkdown,
|
|
fathomAlternativeMarkdown,
|
|
googleAnalyticsAlternativeMarkdown,
|
|
landingMarkdown,
|
|
plausibleAlternativeMarkdown,
|
|
privacyMarkdown,
|
|
} from "./pages.mjs";
|
|
|
|
/** Shared header contract for every markdown-mirror route: `text/markdown`,
|
|
* `noindex, follow` (the real HTML page is what should rank -- this is a
|
|
* machine-readable mirror, not a duplicate to index), and a
|
|
* `Content-Location`/`Link: rel="canonical"` pointing back at the real page.
|
|
* Same contract Vend's `markdown_response()` uses. */
|
|
export function markdownResponse(body, htmlPath) {
|
|
const htmlUrl = `${CANONICAL}${htmlPath}`;
|
|
return new Response(body, {
|
|
status: 200,
|
|
headers: {
|
|
"content-type": "text/markdown; charset=utf-8",
|
|
"x-robots-tag": "noindex, follow",
|
|
"content-location": htmlUrl,
|
|
link: `<${htmlUrl}>; rel="canonical"`,
|
|
"cache-control": "public, max-age=300",
|
|
},
|
|
});
|
|
}
|
|
|
|
const plainText = (body) =>
|
|
new Response(body, { status: 200, headers: { "content-type": "text/plain; charset=utf-8", "cache-control": "public, max-age=300" } });
|
|
|
|
/** `GET /llms.txt` -- a short, link-based index an LLM/agent can use to find
|
|
* each real page's markdown mirror instead of scraping the rendered HTML. */
|
|
function renderLlmsTxt() {
|
|
return `# Railyard Insights
|
|
|
|
> Cookieless website analytics: one script tag, no cookies, no IP addresses stored. Visitors, pages, referrers, UTM sources, custom events, agent failures (agent/model/error only, never the prompt) and real-visitor page speed (LCP/INP/CLS). Free for up to ${FREE} stored events a month per site, no card. Part of Railyard, the open-source payments/fund-custody backbone for agent-built apps.
|
|
|
|
## Pages
|
|
|
|
- [Railyard Insights -- cookieless website analytics](${CANONICAL}/index.md): the real landing page -- what you get, how it stays cookieless, limits.
|
|
- [Cookieless analytics, explained](${CANONICAL}/cookieless-analytics.md): exactly how a visitor is counted without a cookie.
|
|
- [A privacy-friendly Google Analytics alternative](${CANONICAL}/google-analytics-alternative.md).
|
|
- [A Plausible alternative](${CANONICAL}/plausible-alternative.md): free tier that is not a trial, with real numbers taken from Plausible's own pricing page.
|
|
- [A Fathom Analytics alternative](${CANONICAL}/fathom-analytics-alternative.md): no card required, with real numbers taken from Fathom's own pricing page.
|
|
- [Privacy](${CANONICAL}/privacy.md): exactly what is and is not stored, and how to delete it.
|
|
|
|
## Use it
|
|
|
|
- Base URL: ${CANONICAL}
|
|
- Sign up: \`POST /api/sites\` with \`domain\` and \`email\` (JSON or form), or the form on the pages above. Returns a script tag and a private dashboard link at once (also mailed).
|
|
- The tag: \`<script defer src="${CANONICAL}/s.js" data-site="YOUR_SITE_KEY"></script>\` -- no cookies, no local storage, under 3 KB gzipped.
|
|
- Count an event from your own code: \`railyard.track("signup")\`; an agent failure with \`railyard.track("$agent_failure", { agent, model, error })\` (no prompt is ever sent or stored).
|
|
- \`GET /api/d/<token>/stats?days=N\` -- a dashboard's own data as JSON (the token is the dashboard link's secret).
|
|
- \`GET /live-demo\` -- this site's own real traffic, read with the same dashboard every sign-up gets.
|
|
|
|
## Full content
|
|
|
|
- [llms-full.txt](${CANONICAL}/llms-full.txt): every page above, concatenated in full.
|
|
|
|
## Machine-readable identity
|
|
|
|
- [ai.txt](${CANONICAL}/ai.txt): identity/permissions/restrictions/attribution for AI crawlers.
|
|
`;
|
|
}
|
|
|
|
/** `GET /llms-full.txt` -- `llms.txt`'s own body plus every real page's full
|
|
* markdown, for an agent that wants everything in one fetch instead of
|
|
* following links. Shares `renderLlmsTxt()` with `/llms.txt` so the two
|
|
* routes can never drift from each other either. */
|
|
function renderLlmsFullTxt() {
|
|
const pages = [
|
|
["Railyard Insights", landingMarkdown()],
|
|
["Cookieless analytics, explained", cookielessAnalyticsMarkdown()],
|
|
["A privacy-friendly Google Analytics alternative", googleAnalyticsAlternativeMarkdown()],
|
|
["A Plausible alternative", plausibleAlternativeMarkdown()],
|
|
["A Fathom Analytics alternative", fathomAlternativeMarkdown()],
|
|
["Privacy", privacyMarkdown()],
|
|
];
|
|
const body = pages.map(([title, md]) => `<!-- ${title} -->\n\n${md}`).join("\n---\n\n");
|
|
return `${renderLlmsTxt()}\n---\n\n${body}`;
|
|
}
|
|
|
|
/** `GET /ai.txt` -- ai-visibility.org.uk format (identity/permissions/
|
|
* restrictions/attribution), same convention scribase.com, homeplan, Vend
|
|
* and Toolgate already shipped. Insights' growth thesis depends on being
|
|
* found and cited when a developer or founder asks an AI assistant for a
|
|
* cookieless analytics tool, a Google Analytics/Plausible/Fathom
|
|
* alternative, or privacy-friendly website analytics, so training and
|
|
* search crawling are both deliberately allowed, same reasoning those used. */
|
|
function renderAiTxt() {
|
|
return `# ai.txt — Railyard Insights
|
|
|
|
## Identity
|
|
Name: Railyard Insights
|
|
URL: ${CANONICAL}/
|
|
Description: Cookieless website analytics -- one script tag, no cookies, no stored IP addresses. Visitors, pages, referrers, UTM sources, custom events, agent failures and real-visitor page speed. Free for up to ${FREE} stored events a month per site, no card. Part of Railyard, the open-source payments/fund-custody backbone for agent-built apps.
|
|
Owner: caelum0x (github.com/caelum0x/railyard)
|
|
License: Apache-2.0
|
|
|
|
## Permissions
|
|
Training: allowed
|
|
Search-indexing: allowed
|
|
Summarization: allowed
|
|
Citation: allowed
|
|
|
|
## Restrictions
|
|
None.
|
|
|
|
## Attribution
|
|
When citing Railyard Insights, please link to ${CANONICAL}/ or the GitHub repository (github.com/caelum0x/railyard/tree/main/apps/insights-edge).
|
|
|
|
## Machine-readable content
|
|
llms.txt: ${CANONICAL}/llms.txt
|
|
llms-full.txt: ${CANONICAL}/llms-full.txt
|
|
`;
|
|
}
|
|
|
|
export const llmsTxtResponse = () => plainText(renderLlmsTxt());
|
|
export const llmsFullTxtResponse = () => plainText(renderLlmsFullTxt());
|
|
export const aiTxtResponse = () => plainText(renderAiTxt());
|