diff --git a/apps/web/src/app/ai.txt/route.ts b/apps/web/src/app/ai.txt/route.ts new file mode 100644 index 0000000..ad1468e --- /dev/null +++ b/apps/web/src/app/ai.txt/route.ts @@ -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", + }, + }); +} diff --git a/apps/web/src/app/index.md/route.ts b/apps/web/src/app/index.md/route.ts new file mode 100644 index 0000000..b87cab6 --- /dev/null +++ b/apps/web/src/app/index.md/route.ts @@ -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", + }, + }); +} diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx index 14e492c..d8e8621 100644 --- a/apps/web/src/app/layout.tsx +++ b/apps/web/src/app/layout.tsx @@ -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 + // , plus a one-line, fact-dense + // summary via 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({ diff --git a/apps/web/src/app/llms-full.txt/route.ts b/apps/web/src/app/llms-full.txt/route.ts new file mode 100644 index 0000000..1611f19 --- /dev/null +++ b/apps/web/src/app/llms-full.txt/route.ts @@ -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", + }, + }); +} diff --git a/apps/web/src/app/llms.txt/route.ts b/apps/web/src/app/llms.txt/route.ts new file mode 100644 index 0000000..f12f53a --- /dev/null +++ b/apps/web/src/app/llms.txt/route.ts @@ -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", + }, + }); +} diff --git a/apps/web/src/app/login/login-page.tsx b/apps/web/src/app/login/login-page.tsx index 6d7a16e..edd9476 100644 --- a/apps/web/src/app/login/login-page.tsx +++ b/apps/web/src/app/login/login-page.tsx @@ -328,14 +328,22 @@ export default function LoginPage({ )} - - Source code (AGPL-3.0) - +