diff --git a/DESIGN.md b/DESIGN.md index 7b1a830..a4702b2 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -184,10 +184,13 @@ of the typographic work: names and section titles are 700, everything else is 400 to 600. Expression mode is where a more characterful display face belongs. BotKit's own -sites may pair Inter with an expressive display typeface for headlines. That -face is a brand asset for those surfaces and is not bundled with the library. +sites pair Inter with [Space Grotesk] for headlines, used with restraint. Space +Grotesk is loaded only on those surfaces, self-hosted as woff2 rather than +pulled from a font CDN so a visitor's IP is never handed to a third party; it is +not bundled with the library and never reaches a hosted bot's pages. [Inter]: https://rsms.me/inter/ +[Space Grotesk]: https://fonts.google.com/specimen/Space+Grotesk ### Space and geometry @@ -354,13 +357,23 @@ Expression mode is BotKit's own voice, for BotKit's own surfaces. It is not part of the shipped library; it is recorded here so BotKit-branded work stays consistent. - - *Mark.* BotKit's mark is a bracketed node: a small circular node held - between two brackets, evoking an addressable actor on the network. It is a - brand element for BotKit's surfaces and does not appear on hosted bot pages. - - - *Type.* Expression mode may pair Inter with an expressive display typeface - for headlines, used with restraint. Where Canvas mode keeps a single quiet - face, Expression mode is allowed one confident one. + - *Mark.* BotKit's mascot is a dinosaur, and the logo presents that dinosaur + as an unassembled plastic model kit: the character sits inside a sprue + frame, still attached to the runner by small gates, with a labeled tab in + one corner. The “Kit” in BotKit is literal: it is a kit of parts you + assemble into a bot. The frame doubles as the bracketed node of the earlier + mark, evoking an addressable actor on the network. It is a brand element + for BotKit's own surfaces and does not appear on hosted bot pages. + + - *Type.* Expression mode pairs Inter with Space Grotesk for headlines, used + with restraint. Where Canvas mode keeps a single quiet face, Expression mode + is allowed one confident one. + + - *Motif.* The sprue frame is the repeating device on BotKit's own surfaces. + A hero presents the dinosaur on its runner as the one bold element, and a + small gate node sitting on a hairline separates sections, echoing parts held + on a runner (and, loosely, the edges between actors on the network). The + project site's landing page is built from this motif. - *Color.* Expression mode still draws from the same twenty-name palette, but may use it more boldly, including BotKit's own signature accent. diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 0668c9e..a50b84d 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -114,9 +114,12 @@ export default defineConfig({ ariaLabel: "npm", }, { - icon: "discord", - link: "https://discord.gg/bhtwpzURwd", - ariaLabel: "Discord", + icon: { + svg: + '', + }, + link: "https://matrix.to/#/#fedify:matrix.org", + ariaLabel: "Matrix", }, { icon: { @@ -155,14 +158,25 @@ export default defineConfig({ href: "/favicon-32x32.png", }, ], + [ + "meta", + { property: "og:image", content: "https://botkit.fedify.dev/og.png" }, + ], + ["meta", { property: "og:image:width", content: "1200" }], + ["meta", { property: "og:image:height", content: "630" }], + ["meta", { property: "og:image:type", content: "image/png" }], [ "meta", { - property: "og:image", - content: - "https://repository-images.githubusercontent.com/913141583/852a1091-14d5-46a0-b3bf-8d2f45ef6e7f", + property: "og:image:alt", + content: "BotKit: fediverse bots, as standalone servers.", }, ], + ["meta", { name: "twitter:card", content: "summary_large_image" }], + [ + "meta", + { name: "twitter:image", content: "https://botkit.fedify.dev/og.png" }, + ], [ "meta", { diff --git a/docs/.vitepress/og-image.html b/docs/.vitepress/og-image.html new file mode 100644 index 0000000..5d56a80 --- /dev/null +++ b/docs/.vitepress/og-image.html @@ -0,0 +1,206 @@ + + +
+ + + + + + + ++ + A Fedify project · built by the Fedify team +
++ BotKit is a TypeScript framework for standalone ActivityPub bots. + No Mastodon account and no 500‑character limit: your bot runs as a + complete fediverse server, and it fits in a single file. +
+ +{{ current().cmd }}
+
+ No. 01 · some assembly required
++ Create the bot, answer events, and publish. This is the whole thing, + with no accounts to register and no platform to ask permission from. +
+import { createBot, MemoryKvStore, text } from "@fedify/botkit";
+
+const bot = createBot<void>({
+ username: "weatherbot",
+ name: "Seoul Weather Bot",
+ summary: text`I post daily weather updates for Seoul!`,
+ kv: new MemoryKvStore(),
+});
+
+// Reply when someone mentions the bot
+bot.onMention = async (session, message) => {
+ await message.reply(text`It's 18°C with clear skies in Seoul.`);
+};
+
+// Publish on a schedule
+setInterval(async () => {
+ const session = bot.getSession("https://weather.example.com");
+ await session.publish(text`Good morning! Today: 22°C, clear skies ☀️`);
+}, 1000 * 60 * 60 * 24);
+ Standalone
++ Each BotKit bot is a complete ActivityPub server, with its own + actor, inbox, and outbox. There's no Mastodon or Misskey account to + create or maintain, message length is yours to define, and you keep + direct control over the database and message queue. It still + federates with Mastodon, Misskey, and the rest of the fediverse. +
+ More on standalone bots → +Messages
+
+ Write posts with the
+ text`…`
+ template. It escapes HTML for you and understands
+ mentions,
+ hashtags,
+ links, and
+ custom emoji.
+ Attach images,
+ open polls,
+ collect emoji reactions,
+ and allow quote posts with
+ consent
+ (FEP‑044f). Choose each
+ post's visibility, then
+ edit or
+ delete it later.
+
await session.publish(
+ text`New chart is up! ${hashtag("BotKit")}`,
+ {
+ attachments: [new Image({ url, mediaType: "image/png" })],
+ visibility: "public",
+ },
+);
+ Events
++ Assign an async function to respond to activity: + mentions, + replies, + follows and + unfollows, + quotes, + poll votes, and + emoji reactions. Every + handler receives a session, so it can + publish, + reply, or + react + in return. +
+ See all events → +bot.onFollow = async (session, follower) => {
+ await session.publish(text`Thanks for the follow, ${follower}!`, {
+ visibility: "direct",
+ });
+};
+
+bot.onReact = async (session, reaction) => {
+ await reaction.message.reply(text`Glad you liked it!`);
+};
+ Instance
+
+ Need more than one bot?
+ createInstance()
+ owns the shared infrastructure (the key‑value store, queue,
+ repository, and HTTP handling), and each bot on it keeps its own
+ actor, handle, and event handlers. Declare
+ static bots up front, or
+ resolve a whole family of
+ bots from a database on
+ demand.
+
const instance = createInstance<void>({ kv: new MemoryKvStore() });
+
+const greetBot = instance.createBot("greet", {
+ username: "greetbot",
+ name: "Greeting Bot",
+});
+
+const echoBot = instance.createBot("echo", {
+ username: "echobot",
+ name: "Echo Bot",
+});
+
+export default instance;
+ Web
++ BotKit serves each bot's own + pages: a profile, + individual posts, the follower list, hashtag pages, and an Atom feed. + They render in the bot's accent color, adapt to light and dark, and + you can restyle them with the + color, theme, and css + options. Nothing extra to deploy. +
+ More on web pages → +I greet everyone who follows me. 👋
+ ++ Everything else that comes with the framework. +
+{{ c.body }}
++ BotKit is the sister project of + Fedify, built by the same team. + Fedify does the hard part of federation: the ActivityPub protocol, + compatibility with Mastodon, Misskey, and the rest of the fediverse, + signed message delivery, and retries. BotKit adds the bot on top: + events, sessions, messages, and storage. +
+ Learn about Fedify → +
+ BotKit keeps storage behind its own
+ Repository interface,
+ so switching backends never touches your bot code.
+
+ KvRepository
+ adapts any Fedify
+ KvStore
+ (Redis, PostgreSQL, Deno KV, or in‑memory);
+ SqliteRepository,
+ RedisRepository, and
+ PostgresRepository
+ store to those backends directly.
+
+ Install the package and follow the guide, and you'll have a bot on the + fediverse in minutes. +
+{{ current().cmd }}
+
+