Development
Prerequisites
Section titled “Prerequisites”- Node.js v22+
- npm
git clone https://github.com/hannesill/gatelet.gitcd gateletnpm installDevelopment server
Section titled “Development server”npm run devThis starts both the API and the dashboard (Vite dev server) with hot reload.
Testing
Section titled “Testing”npm test # Run all testsnpm run test:watch # Watch modeThe test suite includes 590 tests across 43 files covering:
- Admin API routes and authentication
- Database operations and encryption
- Policy engine (constraints, mutations, parsing)
- Provider implementations (Google Calendar, Outlook Calendar, Gmail, Outlook Mail)
- MCP server pipeline (tool registry, parameter filtering, error sanitization)
- Security edge cases (auth bypass, prototype pollution, rate limiting, audit integrity)
- Content filters (subject blocking, domain blocking, PII redaction)
Building
Section titled “Building”npm run build # Build dashboard + API (tsup → dist/)npm start # Run production buildDocker
Section titled “Docker”npm run docker:builddocker compose up -dProject structure
Section titled “Project structure”src/ admin/ Admin API + routes (Hono on :4001) db/ SQLite + encrypted credential storage doctor/ Health checks mcp/ MCP server (Streamable HTTP on :4000) policy/ Policy engine (pure functions) providers/ Provider implementations config.ts Environment configuration index.ts Server entry point cli.ts CLI entry pointdashboard/ React + Vite + Tailwind admin dashboardwebsite/ Astro + Starlight documentation sitetests/ Vitest test suiteArchitecture notes
Section titled “Architecture notes”- Policy engine is pure functional — no side effects, easy to test
- Admin API uses Hono —
createAdminApp()is exported separately fromstartAdminServer()so tests can useapp.request()without starting HTTP - Config uses getter/setter —
config.ADMIN_TOKENis backed by a private_adminTokenvariable because vitest module caching can cause stale values across test files - Providers implement a common interface —
Providerwithexecute(),refreshCredentials(), tools array, and default policy - Database uses WAL mode — better concurrent read performance for audit queries