Anvil Desktop / Engineering
Extending Anvil Desktop
New features should follow the app's local-first Electron architecture.
Implementation path
- Define or extend domain objects in
src/shared/types.ts. - Add the renderer-facing API shape in
src/shared/ipc-api.d.ts. - Implement orchestration and side effects in
src/main/services/<feature>.service.ts. - Add a thin IPC module in
src/main/ipc/<feature>.ipc.ts. - Register IPC handlers from
src/main/index.ts. - Expose methods on
window.anvilinsrc/preload/index.ts. - Build renderer UI under
src/renderer/components/<feature>/. - Wire top-level routes in
src/renderer/App.tsxand sidebar entries insrc/renderer/components/layout/Sidebar.tsx. - If persistence is needed, add a new migration version in
src/main/db/schema.ts. Do not rewrite old migrations in place. - Add focused tests around services, parsing, persistence, IPC-adjacent behaviour, or renderer utilities based on risk.
Boundary rules
The main process owns side effects: filesystem access, Git, SQLite, connector calls, shell commands, browser automation, PTYs, and LLM-facing work.
IPC handlers should validate input, call services, and translate results. Business logic in IPC files ages about as well as milk on a radiator.
Renderer code should respect workspace state, feature availability, and role-gated navigation instead of inventing a parallel universe.