Skip to content
Allay

WikiAllay Server

Development

#Tech stack

  • TypeScript on Bun: the language, the runtime, and the package manager.
  • Mastra: the agent, tools, streaming, and observability, on top of the AI SDK.
  • @openrouter/ai-sdk-provider and @ai-sdk/openai-compatible: OpenRouter and any OpenAI-compatible API.
  • zod: request and tool schemas.
  • MongoDB with Mongoose: memories, licenses, settings, statistics, and traces.
  • Redis: chat sessions, through Bun's own client.
  • math.js: exact calculations in a worker.
  • tslog: structured logging.
  • React, Vite, shadcn/ui, TanStack Router and Query, Recharts, and react-i18next: the admin panel.
  • Docker: the image that ships.

#Code style

  • TypeScript, ES modules, 2-space indent, small files per feature as in the existing layout. Comments explain why.
  • Validate every request body. Answer errors as { "error": { "code", "message" } } before a stream starts and as an error event after.
  • Tool results and web pages are data, never instructions.
  • docs/protocol-v2.md changes only additively, and the plugin (allay-ai/minecraft) changes to match.
  • Panel strings go through admin/src/locales/en.json.
  • Commits are short one-line imperative English messages, one logical change each.

#Checking a change

  1. bun test and bun run typecheck.
  2. Build the image and start it with MongoDB and Redis; GET /api/health answers with the version.
  3. For a change to the agent or its tools, ask one real question through the plugin's protocol.
  4. For a panel change, run bunx tsc -b && bunx vite build in admin/, then sign in through the image in a browser: setup, a settings change, sign-out, and the 360 px width.

#AI participation

AI tools were used selectively at first: optimizing prompts for OpenRouter, generating part of the documentation, and refactoring some TypeScript types. The main architecture, business logic, and critical components were developed by hand. Commits were written by an AI agent.

The move to Mastra and protocol v2 (the agent with tools, streaming, new prompts, tests) was done entirely by the Claude AI agent from my brief. Claude also keeps the project current every week: see Releasing.