feat(ai-discoverability): add llms.txt/llms-full.txt/ai.txt + markdown mirror

mail.scribase.com was missing the llmstxt.org/ai-visibility.org.uk
AI-discoverability pass already shipped this session for scribase.com,
HomePlan, Bidstage, Yokharita Web and Railyard Vend/Toolgate/Insights.

Real finding: apps/web's root page (the only thing actually deployed to
mail.scribase.com) always redirects an anonymous visitor straight to
/login -- there is no marketing/pricing HTML live at `/` today, even
though apps/marketing (real written Resend-alternative copy, d806795) was
fully built and never wired into deploy/compose or Caddy. Rather than
invent new copy or silently pretend a page is live, the new /llms.txt,
/llms-full.txt, /index.md and /ai.txt routes mirror that real,
already-authored apps/marketing copy (hero, Resend-alternative
positioning, features, "Part of Scribase") into the surface that IS
actually deployed, with prices pulled live from the shared
PRICING_PLANS source of truth so they can't drift.

- apps/web/src/lib/ai-content/mail-pages.ts: real content + AI_SUMMARY
- app/llms.txt, app/llms-full.txt, app/ai.txt: new public routes
- app/index.md: per-page markdown mirror with the established header
  contract (text/markdown, X-Robots-Tag: noindex/follow, canonical Link)
- app/layout.tsx: <meta name="ai-summary"> + <link rel="alternate"
  type="text/markdown"> on the shared root metadata
- login-page.tsx: footer link to /llms.txt next to the existing AGPL
  source-code link

Verified locally against a real throwaway Postgres+Redis (not mocked):
next build clean, tsc clean, 665/665 unit tests unchanged, all 4 new
routes curled with correct content-type/headers/body, bogus paths still
404, and the metadata/footer-link changes confirmed present in the real
rendered page payload and compiled bundle.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
caelum0x 2026-11-07 20:54:24 +03:00
parent f992883823
commit 5f76bc68fa
7 changed files with 276 additions and 8 deletions

View File

@ -0,0 +1,48 @@
import { APP_URL } from "~/lib/ai-content/mail-pages";
import { SOURCE_CODE_URL } from "~/lib/source-code";
/**
* /ai.txt — ai-visibility.org.uk format (identity/permissions/restrictions/
* attribution), same convention scribase.com/HomePlan/Bidstage shipped this
* session. Mail Studio's growth thesis depends on being found and cited by
* AI assistants when someone asks "what's a good Resend alternative" or
* "open source Resend-compatible email API" — training and search crawling
* are both deliberately allowed.
*/
function render(): string {
return `# ai.txt — Scribase Mail
## Identity
Name: Scribase Mail
URL: ${APP_URL}
Description: Open-source, Resend-compatible transactional and marketing email API — send API, SMTP relay, campaigns, contacts, webhooks, open/click tracking. Self-hostable, AGPL-3.0, part of Scribase.
Owner: caelum0x (github.com/caelum0x/scribase-mail-studio)
License: AGPL-3.0
## Permissions
Training: allowed
Search-indexing: allowed
Summarization: allowed
Citation: allowed
## Restrictions
None.
## Attribution
When citing Scribase Mail, please link to ${APP_URL} or the GitHub repository (${SOURCE_CODE_URL}).
## Machine-readable content
llms.txt: ${APP_URL}/llms.txt
llms-full.txt: ${APP_URL}/llms-full.txt
`;
}
export function GET(): Response {
return new Response(render(), {
status: 200,
headers: {
"Content-Type": "text/plain; charset=utf-8",
"Cache-Control": "public, max-age=3600, s-maxage=86400",
},
});
}

View File

@ -0,0 +1,30 @@
import { APP_URL, renderMailStudioHomeMarkdown } from "~/lib/ai-content/mail-pages";
/**
* Markdown mirror of the homepage. Headers follow the same spec already
* shipped for scribase.com / HomePlan / Bidstage this session: `text/
* markdown`, `noindex, follow` (the real HTML page is what should rank —
* this is a machine-readable mirror, not a duplicate to index), and
* `Content-Location`/`Link: rel="canonical"` pointing back at the real HTML
* page.
*
* Note: `/` today redirects an anonymous visitor straight to `/login` (see
* apps/web/src/app/page.tsx) rather than rendering this content as HTML —
* see mail-pages.ts for the real-content provenance. The canonical URL
* below is still the real `/` route: that is genuinely this product's
* home, even though the marketing body isn't rendered there today.
*/
export function GET(): Response {
const canonical = `${APP_URL}/`;
const body = `${renderMailStudioHomeMarkdown()}\n\n---\n\nCanonical page: ${canonical}\n`;
return new Response(body, {
status: 200,
headers: {
"Content-Type": "text/markdown; charset=utf-8",
"X-Robots-Tag": "noindex, follow",
"Content-Location": canonical,
Link: `<${canonical}>; rel="canonical"`,
"Cache-Control": "public, max-age=3600, s-maxage=86400",
},
});
}

View File

@ -8,6 +8,7 @@ import Script from "next/script";
import { TRPCReactProvider } from "~/trpc/react";
import { Metadata } from "next";
import { AI_SUMMARY } from "~/lib/ai-content/mail-pages";
const inter = Inter({
subsets: ["latin"],
@ -23,6 +24,19 @@ export const metadata: Metadata = {
title: "Scribase Mail",
description: "Open source email platform",
icons: [{ rel: "icon", url: "/favicon.ico" }],
// AI-discoverability pass (2026-11-07), same convention as scribase.com /
// HomePlan / Bidstage this session: points an AI crawler/agent at the real
// markdown mirror of the homepage (app/index.md/route.ts) via a real
// <link rel="alternate" type="text/markdown">, plus a one-line, fact-dense
// summary via <meta name="ai-summary"> an assistant can lift directly when
// answering "what is Scribase Mail" / "Resend alternative" without parsing
// the full rendered page. See lib/ai-content/mail-pages.ts for sourcing.
alternates: {
types: { "text/markdown": "https://mail.scribase.com/index.md" },
},
other: {
"ai-summary": AI_SUMMARY,
},
};
export default async function RootLayout({

View File

@ -0,0 +1,15 @@
import { renderMailStudioHomeMarkdown } from "~/lib/ai-content/mail-pages";
/**
* /llms-full.txt — the one real mirrored page's full markdown, for an agent
* that wants everything in one fetch instead of following /llms.txt's link.
*/
export function GET(): Response {
return new Response(renderMailStudioHomeMarkdown(), {
status: 200,
headers: {
"Content-Type": "text/markdown; charset=utf-8",
"Cache-Control": "public, max-age=3600, s-maxage=86400",
},
});
}

View File

@ -0,0 +1,43 @@
import { APP_URL } from "~/lib/ai-content/mail-pages";
/**
* llmstxt.org convention: a short, link-based index an agent can use to find
* the real markdown mirror(s) of this product, instead of scraping
* client-rendered React or hitting the real login-gated app. Same pattern
* already shipped for scribase.com / HomePlan / Bidstage / Yokharita Web /
* Railyard Vend+Toolgate+Insights this session — see
* apps/web/src/lib/ai-content/mail-pages.ts for the real-content note.
*/
function render(): string {
return `# Scribase Mail
> Email for your app, in one API call. Open source (AGPL-3.0) and
> Resend-compatible — self-host it or use it inside Scribase.
## Pages
- [Home, pricing, and Resend-alternative positioning](${APP_URL}/index.md): the full real product overview, features and pricing.
## Full content
- [llms-full.txt](${APP_URL}/llms-full.txt): everything above, in full.
## AI usage policy
- [ai.txt](${APP_URL}/ai.txt)
## Source
- [github.com/caelum0x/scribase-mail-studio](https://github.com/caelum0x/scribase-mail-studio): the real AGPL-3.0 source code.
`;
}
export function GET(): Response {
return new Response(render(), {
status: 200,
headers: {
"Content-Type": "text/markdown; charset=utf-8",
"Cache-Control": "public, max-age=3600, s-maxage=86400",
},
});
}

View File

@ -328,14 +328,22 @@ export default function LoginPage({
)}
</div>
</div>
<a
href={SOURCE_CODE_URL}
target="_blank"
rel="noreferrer"
className="fixed bottom-6 text-xs text-muted-foreground hover:underline"
>
Source code (AGPL-3.0)
</a>
<div className="fixed bottom-6 flex items-center gap-4 text-xs text-muted-foreground">
<a
href={SOURCE_CODE_URL}
target="_blank"
rel="noreferrer"
className="hover:underline"
>
Source code (AGPL-3.0)
</a>
{/* AI-discoverability pass (2026-11-07): same footer-link pattern as
the AGPL source link above -- a real, always-visible pointer to
the machine-readable product summary for AI agents/crawlers. */}
<a href="/llms.txt" className="hover:underline">
llms.txt
</a>
</div>
</main>
);
}

View File

@ -0,0 +1,110 @@
import {
PRICING_PLAN_ORDER,
PRICING_PLANS,
} from "@usesend/lib/src/constants/pricing";
import { SOURCE_CODE_URL } from "~/lib/source-code";
/**
* AI-discoverability pass (2026-11-07), same convention already shipped for
* scribase.com / HomePlan / Bidstage / Yokharita Web / Railyard (Vend,
* Toolgate, Insights): llmstxt.org (/llms.txt, /llms-full.txt) +
* ai-visibility.org.uk (/ai.txt) format, `text/markdown` + `X-Robots-Tag:
* noindex, follow` + `Link: rel="canonical"` on the per-page mirror.
*
* Real finding this pass: mail.scribase.com's deployed root page
* (apps/web/src/app/page.tsx) always redirects an anonymous visitor straight
* to /login — there is no marketing/pricing HTML actually live at `/` today.
* The real marketing copy below (hero, "Resend alternative" positioning,
* features, pricing, "Part of Scribase") is genuinely-authored product copy
* that already exists in this repo — `apps/marketing` (Next.js app, port
* 3001) — including the real `d806795` "Resend alternative" section, but
* that app was never wired into deploy/compose.scribase-mail.yml or Caddy,
* so it has never actually served production traffic. Rather than invent
* new copy or silently pretend a marketing page is live, this mirrors the
* real written apps/marketing content verbatim (ported, not paraphrased)
* into the one surface that IS actually deployed (apps/web), and the price
* figures are pulled live from `PRICING_PLANS` (the same single source of
* truth the real app's billing/limits logic and the marketing pricing page
* both already use) so they can't drift out of sync with reality.
*/
export const APP_URL = "https://mail.scribase.com";
function renderPricingSection(): string {
return PRICING_PLAN_ORDER.map((id) => {
const plan = PRICING_PLANS[id];
const price =
plan.priceUsdMonthly === 0 ? "Free" : `$${plan.priceUsdMonthly}/month`;
const features = plan.features.map((f) => `- ${f}`).join("\n");
return `### ${plan.name} — ${price}\n\n${plan.description}\n\n${features}`;
}).join("\n\n");
}
export function renderMailStudioHomeMarkdown(): string {
return `# Scribase Mail
> Email for your app, in one API call. Send transactional and marketing email
> from a calm dashboard and a familiar REST API. Verified domains, campaigns,
> contacts and webhooks included. Open source under AGPL-3.0 — self-host it
> or use it inside Scribase.
## Looking for a Resend alternative?
Same API, same SDKs, same price. Open source.
Scribase Mail matches Resend's API shape and pricing — Free at 3,000
emails/month (100/day), Pro at $20/month for 50,000 emails with $0.90 per
1,000 extra — so migrating is a config change, not a rewrite. The
difference: the full source is AGPL-3.0, so you can self-host it, audit it,
or run it inside your own Scribase project instead of trusting a closed box.
- Migrate from Resend: https://scribase.com/mail/migrate-from-resend
- Source code (AGPL-3.0): ${SOURCE_CODE_URL}
## What you get
- **Familiar send API** — POST /api/v1/emails with to, from, subject and
html. SDKs for TypeScript, Python and Go, plus an SMTP relay for any
framework.
- **Domains in minutes** — Add a domain, publish one DKIM CNAME and one SPF
record, and start sending. Verification is checked for you in the
background.
- **Campaigns and contacts** — Contact books, double opt-in, a visual editor
and scheduled campaigns with one-click unsubscribe.
- **Opens and clicks** — First-party open and click tracking with signed
links, per domain. Turn it on or off at any time.
- **Bounces and complaints** — Hard bounces and complaints are added to your
suppression list automatically, so you never mail them twice.
- **Webhooks** — Signed webhooks for sent, opened, clicked, bounced,
complained and domain events, with retries and a delivery log.
## Pricing
Every plan includes the API, SMTP relay, campaigns, webhooks and tracking.
Paid plans bill extra email per 1,000 instead of stopping your sends.
${renderPricingSection()}
Prices in USD, billed monthly. Payments are processed by Dodo Payments, our
merchant of record; taxes are calculated at checkout.
## Part of Scribase
Scribase Mail is the email layer of [Scribase](https://scribase.com): one
place for your database, auth and the email your app sends. Mail is
delivered through Oracle Cloud Email Delivery.
It is built on the open source
[useSend](https://github.com/usesend/useSend) project and released under the
same AGPL-3.0 license. The full [source code](${SOURCE_CODE_URL}) is
available.
`;
}
export const AI_SUMMARY =
"Scribase Mail is an open-source (AGPL-3.0), Resend-compatible email API " +
"for transactional and marketing email: send API, SMTP relay, campaigns, " +
"contacts, open/click tracking and signed webhooks. Free: 3,000 " +
"emails/month (100/day), 1 domain. Pro: $20/month for 50,000 emails, " +
"$0.90/1,000 overage, 10 domains. Scale: $90/month for 100,000 emails, " +
"1,000 domains. Self-hostable or run inside Scribase.";