{"id":16587769,"url":"https://github.com/daltonmenezes/interprocess","last_synced_at":"2025-05-09T00:05:38.499Z","repository":{"id":63387566,"uuid":"565017023","full_name":"daltonmenezes/interprocess","owner":"daltonmenezes","description":"💬 A scalable and type-safe Electron IPC management tool with enhanced DX","archived":false,"fork":false,"pushed_at":"2024-03-23T23:49:47.000Z","size":856,"stargazers_count":105,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-09T00:05:30.415Z","etag":null,"topics":["dx","electron","interprocess-communication","ipc","scalable","type-safe","typescript"],"latest_commit_sha":null,"homepage":"https://interprocess.daltonmenezes.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daltonmenezes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"daltonmenezes","patreon":"daltonmenezes","issuehunt":"daltonmenezes/interprocess?tab=idle"}},"created_at":"2022-11-12T04:26:14.000Z","updated_at":"2025-04-25T07:07:44.000Z","dependencies_parsed_at":"2024-03-24T00:25:23.799Z","dependency_job_id":"e46fe45b-c6f5-435e-b5d3-1c6617e4d2ce","html_url":"https://github.com/daltonmenezes/interprocess","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":"0.15384615384615385","last_synced_commit":"8e47d66cb84f5f631bdda189e08d7d4bd8d6c585"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daltonmenezes%2Finterprocess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daltonmenezes%2Finterprocess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daltonmenezes%2Finterprocess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daltonmenezes%2Finterprocess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daltonmenezes","download_url":"https://codeload.github.com/daltonmenezes/interprocess/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166518,"owners_count":21864476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dx","electron","interprocess-communication","ipc","scalable","type-safe","typescript"],"created_at":"2024-10-11T22:54:59.802Z","updated_at":"2025-05-09T00:05:38.437Z","avatar_url":"https://github.com/daltonmenezes.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"#interprocess\"\u003e\n    \u003cimg alt=\"preview\" src=\"https://github.com/daltonmenezes/interprocess/raw/main/apps/web/public/banner.svg\" width=\"100%\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003e\u003cstrong\u003einterprocess\u003c/strong\u003e: 💬 A scalable and type-safe Electron IPC management tool with enhanced DX\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003c!-- GitHub --\u003e\n  \u003ca href=\"https://github.com/sponsors/daltonmenezes\"\u003e\n    \u003cimg alt=\"github url\" src=\"https://img.shields.io/badge/support%20on-github-1C1E26?style=for-the-badge\u0026labelColor=1C1E26\u0026color=ff7ac8\"/\u003e\n  \u003c/a\u003e\n  \u003c!-- Patreon --\u003e\n  \u003ca href=\"https://www.patreon.com/daltonmenezes\"\u003e\n    \u003cimg alt=\"patreon url\" src=\"https://img.shields.io/badge/support%20on-patreon-1C1E26?style=for-the-badge\u0026labelColor=1C1E26\u0026color=50e1c7\"/\u003e\n  \u003c/a\u003e\n  \u003c!-- Version --\u003e\n  \u003ca href=\"https://github.com/daltonmenezes/interprocess/releases\"\u003e\n     \u003cimg alt=\"releases url\" src=\"https://img.shields.io/npm/v/interprocess.svg?style=for-the-badge\u0026labelColor=1C1E26\u0026color=ff7ac8\"/\u003e\n  \u003c/a\u003e  \n  \u003c!-- License --\u003e\n  \u003ca href=\"https://github.com/daltonmenezes/interprocess/blob/main/LICENSE\"\u003e\n    \u003cimg alt=\"license url\" src=\"https://img.shields.io/badge/license%20-MIT-1C1E26?style=for-the-badge\u0026labelColor=1C1E26\u0026color=50e1c7\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003e Electron IPC is good, but difficult to maintain and scale, either because of the numerous channels you have to remember, or because of the inconsistent API between processes and the absence of inferred types of your channels and handlers. These are some of the things that interprocess comes to solve!\n\n# 💬 Features\n- 🚀 Best-in-class DX with a fully-typed API\n- 🧠 Enchanced and consistent API\n- 🔥 Type-safe and scalable\n- 🪄 Code splitting support\n- 🕸️ All edges connected (APIs to handle all processes)\n- 💖 `invoke` and `handle` methods in both processes with the same expected behavior\n\n# Requirements\n- Node.js \u003e= 14.0.0\n- Electron \u003e= 12.0.0\n- TypeScript \u003e= 4.8.0\n\n# 💬 Installation\nIn your terminal, run:\n- npm\n    ```bash\n    npm i interprocess\n    ```\n- pnpm\n    ```bash\n    pnpm i interprocess\n    ```\n- yarn\n    ```bash\n    yarn add interprocess\n    ```\n\n# 💬 Usage\n\nLet's build something simple that can show you some of the interprocess's power!\n\nFirst, create the following folders at `src`:\n\n- `shared/ipcs` (this folder structure is optional)\n\nThen, create a file named as `index.ts` in the `ipcs` folder with the following content:\n\n```ts\nimport { createInterprocess } from 'interprocess'\n\nexport const { ipcMain, ipcRenderer, exposeApiToGlobalWindow } =\n  createInterprocess({\n    main: {\n      async getPing(_, data: 'ping') {\n        const message = `from renderer: ${data} on main process`\n        \n        console.log(message)\n\n        return message\n      },\n    },\n\n    renderer: {\n      async getPong(_, data: 'pong') {\n        const message = `from main: ${data} on renderer process`\n        \n        console.log(message)\n\n        return message\n      },\n    },\n  })\n```\n\nOn the **main process**:\n\n\u003e :warning: Don't forget to add `sandbox: false` to the BrowserWindow because it's required to load the preload script properly!\n\n```ts\nimport { BrowserWindow, app } from 'electron'\n\nimport { ipcMain } from 'shared/ipcs'\n\nconst { handle, invoke } = ipcMain\n\napp.whenReady().then(() =\u003e {\n  const mainWindow = new BrowserWindow({\n    webPreferences: {\n      preload: path.join(__dirname, '../preload/index.js'),\n      sandbox: false, // sandbox must be false\n    },\n  })\n\n  handle.getPing()\n\n  mainWindow.webContents.on('dom-ready', () =\u003e {\n    invoke.getPong(mainWindow, 'pong')\n  })\n})\n```\n\nIn the **preload script**:\n\n```ts\nimport { exposeApiToGlobalWindow } from 'shared/ipcs'\n\nconst { key, api } = exposeApiToGlobalWindow({\n  exposeAll: true, // expose handlers, invokers and removers\n})\n\ndeclare global {\n  interface Window {\n    [key]: typeof api\n  }\n}\n```\n\nOn the **renderer process**:\n\n```ts\nconst { invoke, handle } = window.api\n\ninvoke.getPing('ping')\nhandle.getPong()\n```\nThis is a simple way to work with interprocess, but there's a lot of more cool features you can take advantage, like overrides, code splitting, invoker's response (for renderer and main process 🎉) and more. See the [Knowledge section for more](#-knowledge)\n\n# 💬 Knowledge\n- [Docs](https://interprocess.daltonmenezes.com/docs/getting-started/overview)\n\n- Examples\n  - [Executable](https://github.com/daltonmenezes/interprocess/tree/main/apps/desktop)\n  - [CodeSandbox (simple)](https://codesandbox.io/s/simple-607b6h?file=/src/ipcs.ts)\n  - [CodeSandbox (advanced)](https://codesandbox.io/s/advanced-4qh0xb?file=/src/ipcs/index.ts)\n\n\n# 💬 Contributing\n\u003e **Note**: contributions are always welcome, but always **ask first**, — please — before work on a PR.\n\nThat said, there's a bunch of ways you can contribute to this project, like by:\n\n- :beetle: Reporting a bug\n- :page_facing_up: Improving the docs\n- :rotating_light: Sharing this project and recommending it to your friends\n- :dollar: Supporting this project on GitHub Sponsors or Patreon\n- :bug: Funding an issue on IssueHunt\n- :star2: Giving a star on this repository\n\n# License\n\n[MIT © Dalton Menezes](https://github.com/daltonmenezes/interprocess/blob/main/LICENSE)\n","funding_links":["https://github.com/sponsors/daltonmenezes","https://patreon.com/daltonmenezes","https://issuehunt.io/r/daltonmenezes/interprocess?tab=idle","https://www.patreon.com/daltonmenezes"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaltonmenezes%2Finterprocess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaltonmenezes%2Finterprocess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaltonmenezes%2Finterprocess/lists"}