{"id":20471391,"url":"https://github.com/statewalker/webrun-http-browser","last_synced_at":"2025-07-25T23:32:42.650Z","repository":{"id":144678802,"uuid":"582452938","full_name":"statewalker/webrun-http-browser","owner":"statewalker","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-06T11:20:04.000Z","size":68,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T02:21:54.282Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/statewalker.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2022-12-26T22:09:05.000Z","updated_at":"2023-10-16T14:10:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac3cc6df-0ace-4e75-b90d-d1d818b14c24","html_url":"https://github.com/statewalker/webrun-http-browser","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statewalker%2Fwebrun-http-browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statewalker%2Fwebrun-http-browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statewalker%2Fwebrun-http-browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statewalker%2Fwebrun-http-browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statewalker","download_url":"https://codeload.github.com/statewalker/webrun-http-browser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242039023,"owners_count":20061922,"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-11-15T14:15:58.304Z","updated_at":"2025-03-05T13:42:29.178Z","avatar_url":"https://github.com/statewalker.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @statewalker/webrun-http-browser\n\nThis module simulates HTTP server using Service Workers.\nIt allows to develop, test, run and debug server-side code directly in the browser.\nAfter that the same code can be deployed in Deno / Deno Deploy / Cloudflare / Node JS environments (with adapters).\n\n## Demo\n\n* [https://observablehq.com/@kotelnikov/webrun-http-service](https://observablehq.com/@kotelnikov/webrun-http-service) - an Observable page demonstrating how it works. You can play with the code here.\n* [Demo 1](https://unpkg.com/@statewalker/webrun-http-browser@0.3/demo/demo-1.html) - a dynamic web site with a server-side API, a HTML page and a CSS file\n* [Demo 2](https://unpkg.com/@statewalker/webrun-http-browser@0.3/demo/demo-2.html) - a virtual file server exposing your local disk content\n\n## Features \n\nThis module provides a lightweight full-stack development environment in the browser:\n* Code, execute and debug the whole stack in the browser. Even without internet connection.\n* Your data and code don’t leave your browser\n* Instant reproducable environment without installation\n* Easily embeddable in your code\n* Client and server-side code in the browser based on standards:\n  - Use module imports for scripts \n  - Send requests with fetch\n  - Handle HTTP queries with the Request/Response API\n\n\n## UseCases\n\n* Create rich documentations, tutorials, demos\n* Embed in your rich application - in the new generation Notion, Airtable or Figma\n* Deliver self-contained prototype environments to your clients\n\n## How It Works\n\nThe core of this module is based on the following native browser technologies: ServiceWorker and MessageChannels.\n\nA ServiceWorker is used as the \"server\", intercepting HTTP calls and delegating their handling to registered modules via MessageChannels. \nSo in the same browser-based application you can register a standard HTTP endpoint and call it. \n\nExample:\n```js\nimport { httpService, endpointUrl } from \"...\";\n\n// Server-side code:\nhttpService.register(async (request) =\u003e { // request: Request\n  return new Response(\"Hello, world!\", {\n    headers: {\n      \"Content-Type\": \"text/plain\"\n    }\n  })\n})\n\n// Client-side code:\n\nconst res = await fetch(endpointUrl);\nconst text = await res.text();\nconsole.log(text);\n\n```\n\n## They Play Well Together...\n\nThis in-browser HTTP Server allows to implement the following functionalities:\n- Serve your content from your Local Disk:\n  - using [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API)\n  - using [Origin Private File System API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API)\n- Add version control with Git - using [IsomorphicGit](https://isomorphic-git.org/)\n- Provide direct P2P sharing with others – via [WebRTC](https://webrtc.org/)\n- Implement client/server applications using persistent SQLite on Origin Private File System - using [SQLite Wasm](https://developer.chrome.com/blog/sqlite-wasm-in-the-browser-backed-by-the-origin-private-file-system/)\n- Deploy your local site on Edge - via [Deno Deploy](https://deno.com/deploy)\n- Distribute your work in any browser via IPFS / [LibP2P](https://github.com/libp2p/js-libp2p)\n- Integration with existing powerful APIs like https://trpc.io/\n\n...and everything in the browser!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatewalker%2Fwebrun-http-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatewalker%2Fwebrun-http-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatewalker%2Fwebrun-http-browser/lists"}