{"id":20513866,"url":"https://github.com/webreflection/mini-coi","last_synced_at":"2025-09-12T23:30:58.870Z","repository":{"id":183971718,"uuid":"671096559","full_name":"WebReflection/mini-coi","owner":"WebReflection","description":"A minimalistic version of coi-serviceworker.","archived":false,"fork":false,"pushed_at":"2025-07-14T08:47:12.000Z","size":23,"stargazers_count":28,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-14T11:36:53.761Z","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/WebReflection.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2023-07-26T14:27:54.000Z","updated_at":"2025-07-14T08:47:16.000Z","dependencies_parsed_at":"2024-02-01T17:10:29.883Z","dependency_job_id":"9010419e-ca9d-45b4-b38a-7633add6eb55","html_url":"https://github.com/WebReflection/mini-coi","commit_stats":{"total_commits":24,"total_committers":3,"mean_commits":8.0,"dds":0.08333333333333337,"last_synced_commit":"dc1f539a92e072d892236d59413961aa1044ec99"},"previous_names":["webreflection/mini-coi"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/WebReflection/mini-coi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fmini-coi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fmini-coi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fmini-coi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fmini-coi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebReflection","download_url":"https://codeload.github.com/WebReflection/mini-coi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fmini-coi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274893250,"owners_count":25369278,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-15T21:13:33.149Z","updated_at":"2025-09-12T23:30:58.580Z","avatar_url":"https://github.com/WebReflection.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mini-coi\n\nThis project ensures your browser's\n[complicated Cross Origin Isolation (COI) settings](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements)\n\"just work\"\u0026#8482; for web workers. This is especially useful when you have no\ncontrol over the HTTP headers returned by the server.\n\nThe simplest way to use mini-coi is to **place the `mini-coi.js` file in the\nroot of your website (i.e. `/`), and reference it as the first child tag in the\n`\u003chead\u003e` of your HTML documents**:\n\n```html\n\u003cscript src=\"/mini-coi.js\" scope=\"./\"\u003e\u003c/script\u003e\n```\n\nFor more complete technical details, read on...\n\n## What is mini-coi?\n\nA minimalistic *CLI* utility or a simplified version of [coi-serviceworker](https://github.com/gzuidhof/coi-serviceworker), with an optional `scope` attribute to define where Cross Origin Isolation should happen.\n\n## CLI\n\nBootstrap a local server with all headers enforced:\n\n```sh\nnpx mini-coi .\n\n# the third argument is a path so ...\n# npx mini-coi ./public/\n# npx mini-coi ./test/\n# ...\n```\n\nThe *CLI* brings in what's possible already to do with [static-handler](https://github.com/WebReflection/static-handler/tree/main) by passing `--coi` by default.\n\n\n## Service Worker\n\nAllow headers in places like GitHub pages or any other server where you cannot change current headers:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003cscript src=\"./mini-coi.js\" scope=\"./\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n\u003c/html\u003e\n```\n\n#### What's different from coi-serviceworker?\n\n  * no options at all: \"*it just works*\" ™\n  * always *require-corp* to have this working on Safari as well as Chrome or Firefox\n  * errors are just thrown in devtools\n\n- - -\n\n### How to use mini-coi as Service Worker\n\n  * the file **must be a local file**, you can't use any CDN or raw GitHub URL, you need to copy the file content locally [^1]\n  * the script *must not be a module*, it has to be exactly a `\u003cscript src=\"./mini-coi.js\"\u003e\u003c/script\u003e` at the top of your `\u003chead\u003e` tag in your page (or in general before any other `script` or `link` or `style` is used, it can be after `meta` and `title` though)\n\n[^1]: You can either use the *CLI* utility:\n\n    ```sh\n    npx mini-coi -sw public/mini-coi.js\n\n    // or ...\n    npx mini-coi --service-worker public/mini-coi.js\n    ```\n\n    Or you can grab the file from a CDN and save it locally:\n\n    ```sh\n    # grab mini-coi.js and save it locally as mini-coi.js\n    curl -LO https://raw.githubusercontent.com/WebReflection/mini-coi/main/mini-coi.js\n    ```\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fmini-coi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebreflection%2Fmini-coi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fmini-coi/lists"}