# Agent Guide - Etherpad Welcome to the Etherpad project. This guide provides essential context and instructions for AI agents and developers to effectively contribute to the codebase. ## Project Overview Etherpad is a real-time collaborative editor designed to be lightweight, scalable, and highly extensible via plugins. ## Technical Stack - **Runtime:** Node.js >= 22.12.0 - **Package Manager:** pnpm (>= 11.0.0) - **Languages:** TypeScript (primary for new code), JavaScript (legacy), CSS, HTML - **Backend:** Express.js 5, Socket.io 4 - **Frontend:** Legacy core (`src/static`), Modern React UI (`ui/`), Admin UI (`admin/`) - **Database:** ueberdb2 abstraction (supports dirtyDB, MySQL, PostgreSQL, Redis) - **Build Tools:** Vite (for `ui` and `admin`), esbuild, tsx - **Testing:** Mocha (backend), Playwright (frontend E2E), Vitest (unit) - **Auth:** JWT (jose library), OIDC provider ## Directory Structure - `src/node/` - Backend logic, API handlers, database models, hooks - `src/static/` - Core frontend logic (legacy jQuery-based editor) - `src/static/js/pluginfw/` - Plugin framework (installer, hook system) - `src/tests/` - Test suites (backend, frontend, container) - `ui/` - Modern React OIDC login UI (Vite + TypeScript) - `admin/` - Modern React admin panel (Vite + TypeScript + Radix UI) - `bin/` - CLI utilities, build scripts, plugin management tools - `bin/plugins/` - Plugin maintenance scripts (checkPlugin.ts, updateCorePlugins.sh) - `doc/` - Documentation (VitePress + Markdown/AsciiDoc) - `local_plugins/` - Directory for developing and testing plugins locally - `var/` - Runtime data (logs, dirtyDB, etc. - ignored by git) ## Quick Start ```bash pnpm install # Install all dependencies pnpm run build:etherpad # Build admin UI and static assets pnpm --filter ep_etherpad-lite run dev # Start dev server (port 9001) pnpm --filter ep_etherpad-lite run prod # Start production server ``` ## Core Mandates & Conventions ### Coding Style - **Indentation:** 2 spaces for all files (JS/TS/CSS/HTML). No tabs. - **TypeScript:** All new code should be TypeScript. Strict mode is enabled. - **Comments:** Provide clear comments for complex logic only. - **Backward Compatibility:** Always ensure compatibility with older versions of the database and configuration files. ### Internationalisation (i18n) — Mandatory - **Every user-facing string MUST go through i18n.** That means JSX text, `placeholder`, `title`, `aria-label`, `alt`, toast/alert titles, `