AGENTS.MD
Welcome to the Etherpad project. This guide provides essential context and instructions for AI agents and developers to effectively contribute to the codebase.
Etherpad is a real-time collaborative editor designed to be lightweight, scalable, and highly extensible via plugins.
src/static), Modern React UI (ui/), Admin UI (admin/)ui and admin), esbuild, tsxsrc/node/ - Backend logic, API handlers, database models, hookssrc/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 toolsbin/plugins/ - Plugin maintenance scripts (checkPlugin.ts, updateCorePlugins.sh)doc/ - Documentation (VitePress + Markdown/AsciiDoc)local_plugins/ - Directory for developing and testing plugins locallyvar/ - Runtime data (logs, dirtyDB, etc. - ignored by git)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
develop branch. Never PR directly to master.submodule: description.WARN log.johnmclear/etherpad-lite fork on a new branch, then PR to ether/etherpad. For plugins (ep_* repos), committing directly is acceptable.pnpm run lintpnpm --filter ep_etherpad-lite run ts-checkpnpm run build:etherpad before production deploymentBackend tests use Mocha with tsx and run against a real server instance (started automatically by the test harness). No separate server process is needed.
# Run ALL backend tests (includes plugin tests)
pnpm --filter ep_etherpad-lite run test
# Run only utility tests (faster, ~5s timeout)
pnpm --filter ep_etherpad-lite run test-utils
# Run a single test file directly
cd src && cross-env NODE_ENV=production npx mocha --import=tsx --timeout 120000 tests/backend/specs/YOUR_TEST.ts
# Run unit tests (Vitest)
cd src && npx vitest
NODE_ENV=production.src/tests/backend/specs/.node_modules/ep_*/static/tests/backend/specs/ (at repo root) and are included automatically by the test script.Frontend tests use Playwright. You must have a running Etherpad server before launching them — the Playwright config does not auto-start the server.
Before running frontend or admin tests, ensure Playwright browsers are installed. Check and install if needed:
# Check which browsers are installed
cd src && npx playwright install --dry-run
# Install all browsers and their system dependencies (must run from src/)
cd src && npx playwright install
cd src && sudo npx playwright install-deps
If sudo is unavailable, install system dependencies for webkit manually:
# Check which system libraries are missing for webkit
ldd ~/.cache/ms-playwright/webkit-*/minibrowser-wpe/MiniBrowser 2>&1 | grep "not found"
If browsers or system dependencies are missing, tests will fail silently or timeout — always verify browser installation before debugging test failures.
# 1. Start the dev server in a separate terminal
pnpm --filter ep_etherpad-lite run dev
# 2. Run frontend E2E tests
pnpm --filter ep_etherpad-lite run test-ui
# 3. Run with interactive Playwright UI (useful for debugging)
pnpm --filter ep_etherpad-lite run test-ui:ui
# Run a single test file
cd src && cross-env NODE_ENV=production npx playwright test tests/frontend-new/specs/YOUR_TEST.spec.ts
localhost:9001.src/tests/frontend-new/specs/.src/playwright.config.ts.# Requires a running server and Playwright browsers installed (same as frontend tests)
pnpm --filter ep_etherpad-lite run test-admin
# Interactive UI mode
pnpm --filter ep_etherpad-lite run test-admin:ui
--workers 1 (sequential) on chromium and firefox only.src/tests/frontend-new/admin-spec/.Tests use JWT authentication, not API keys. Pattern:
import * as common from 'ep_etherpad-lite/tests/backend/common';
const agent = await common.init(); // Starts server, returns supertest agent
const token = await common.generateJWTToken();
agent.get('/api/1/endpoint').set('authorization', token);
Do not use APIKEY.txt — it may not exist in the test environment.
The real-time synchronization engine. It is complex; refer to doc/public/easysync/ before modifying core synchronization logic.
Most functionality should be implemented as plugins (ep_*). Avoid modifying the core unless absolutely necessary.
Plugin structure:
ep_myplugin/
├── ep.json # Hook declarations (server_hooks, client_hooks)
├── index.js # Server-side hook implementations
├── package.json
├── static/
│ ├── js/ # Client-side code
│ ├── css/
│ └── tests/
│ ├── backend/specs/ # Backend tests (Mocha)
│ └── frontend-new/ # Frontend tests (Playwright)
├── templates/ # EJS templates
└── locales/ # i18n files
Plugin management:
pnpm run plugins i ep_plugin_name # Install from npm
pnpm run plugins i --path ../plugin # Install from local path
pnpm run plugins rm ep_plugin_name # Remove
pnpm run plugins ls # List installed
Plugin installation internals: Plugins are installed to src/plugin_packages/ via live-plugin-manager, which stores them at src/plugin_packages/.versions/ep_name@version/. Symlinks are created: src/node_modules/ep_name → src/plugin_packages/ep_name → .versions/ep_name@ver/.
ether/ether-plugins contains 80+ plugins with shared CI/publishingether/ep_* repos still exist for many pluginsbin/plugins/lib/ contains workflow templates pushed to standalone plugin repos via checkPlugin.tsether/ether-pipelines contains reusable GitHub Actions workflows for plugin CIConfigured via settings.json. A template is available at settings.json.template. Environment variables can override any setting using "${ENV_VAR}" or "${ENV_VAR:default_value}".
This project uses pnpm workspaces. The workspaces are:
src/ - Core Etherpad (package: ep_etherpad-lite)bin/ - CLI tools and plugin scriptsui/ - Login UIadmin/ - Admin paneldoc/ - DocumentationRoot-level commands operate across all workspaces. Use pnpm --filter <package> to target specific workspaces.
AI/Agent contributions are explicitly welcomed by the maintainers, provided they strictly adhere to the guidelines in CONTRIBUTING.md and this guide. Always prioritize stability, readability, and compatibility.