{"id":15368064,"url":"https://github.com/anonrig/electron-server","last_synced_at":"2025-04-15T12:53:13.196Z","repository":{"id":45101864,"uuid":"513205788","full_name":"anonrig/electron-server","owner":"anonrig","description":"Use Fastify inside an Electron app without consuming a port","archived":false,"fork":false,"pushed_at":"2022-07-13T21:43:37.000Z","size":30,"stargazers_count":27,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-15T12:52:50.852Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/electron-server","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anonrig.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-12T15:58:17.000Z","updated_at":"2025-01-06T02:43:13.000Z","dependencies_parsed_at":"2022-07-13T15:30:39.513Z","dependency_job_id":null,"html_url":"https://github.com/anonrig/electron-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Felectron-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Felectron-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Felectron-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Felectron-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anonrig","download_url":"https://codeload.github.com/anonrig/electron-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249076542,"owners_count":21208811,"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":[],"created_at":"2024-10-01T13:28:06.882Z","updated_at":"2025-04-15T12:53:13.177Z","avatar_url":"https://github.com/anonrig.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Electron Server\n\nA super-fast and easy-to-use library to use Fastify, and it's ecosystem inside an Electron application without the need of exposing (and consuming) a port.\n\n### Use-cases\n\n- Running GraphQL in your Electron application.\n- Running Next.js using `fastify-nextjs` to create `chrome://extensions` like pages for your Electron app\n- Communication between main and renderer process using HTTP methods\n- Static file (assets) sharing between renderer process and the main process\n\n\n### Install\n\nTo install `electron-server` in an existing project as a dependency:\n\nInstall with npm:\n```sh\nnpm i electron-server\n```\nInstall with pnpm:\n```sh\npnpm add electron-server\n```\n\n### Example\n\n```js\n// Require fastify and instantiate it.\nconst Fastify = require('fastify')\nconst server = Fastify({ ignoreTrailingSlash: true })\nserver.get('/hello-world', () =\u003e ({ hello: 'world' }))\n\n// Require registerProtocol and call it on your root file.\nconst { registerProtocol } = require('electron-server')\n\n// Register custom scheme to Electron\nregisterProtocol({\n  scheme: 'my-scheme',\n  server,\n})\n\napp.whenReady().then(() =\u003e {\n  const win = new BrowserWindow({\n    width: 800,\n    height: 600,\n  });\n  \n  // Visit the custom scheme\n  win.loadURL(\"my-protocol://hello-world\");\n});\n```\n\nDo you want to run the example? Head to the \u003ca\nhref=\"./test/playground.js\"\u003e\u003ccode\u003e\u003cb\u003ePlayground\u003c/b\u003e\u003c/code\u003e\u003c/a\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanonrig%2Felectron-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanonrig%2Felectron-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanonrig%2Felectron-server/lists"}