{"id":13468782,"url":"https://github.com/vercel/hazel","last_synced_at":"2025-05-14T06:13:29.434Z","repository":{"id":40746257,"uuid":"99232656","full_name":"vercel/hazel","owner":"vercel","description":"Lightweight update server for Electron apps","archived":false,"fork":false,"pushed_at":"2024-06-10T09:41:41.000Z","size":427,"stargazers_count":2929,"open_issues_count":60,"forks_count":389,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-05-05T23:37:45.501Z","etag":null,"topics":["electron","github-releases","updates"],"latest_commit_sha":null,"homepage":"https://twitter.com/notquiteleo/status/893547786255421441","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/vercel.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":"2017-08-03T12:57:55.000Z","updated_at":"2025-05-05T15:40:46.000Z","dependencies_parsed_at":"2024-01-13T17:10:53.307Z","dependency_job_id":"49b3df11-e9e9-4998-947a-8c4165cbf126","html_url":"https://github.com/vercel/hazel","commit_stats":{"total_commits":146,"total_committers":18,"mean_commits":8.11111111111111,"dds":"0.20547945205479456","last_synced_commit":"7f9c763f7652f8edbf0b2a9af76915474dfdae75"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fhazel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fhazel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fhazel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fhazel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vercel","download_url":"https://codeload.github.com/vercel/hazel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254082776,"owners_count":22011747,"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":["electron","github-releases","updates"],"created_at":"2024-07-31T15:01:18.996Z","updated_at":"2025-05-14T06:13:29.389Z","avatar_url":"https://github.com/vercel.png","language":"JavaScript","readme":"# Hazel\n\n[![CircleCI](https://circleci.com/gh/vercel/hazel/tree/master.svg?style=svg)](https://circleci.com/gh/vercel/hazel/tree/master)\n[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n\nThis project lets you deploy an update server for [Electron](https://www.electronjs.org) apps with ease: You only need to click a button.\n\nThe result will be faster and more lightweight than any other solution out there! :rocket:\n\n- Recommended by Electron [here](https://www.electronjs.org/docs/tutorial/updates#deploying-an-update-server)\n- Built on top of [micro](https://github.com/zeit/micro), the tiniest HTTP framework for Node.js\n- Pulls the latest release data from [GitHub Releases](https://help.github.com/articles/creating-releases/) and caches it in memory\n- Refreshes the cache every **15 minutes** (custom interval [possible](#options))\n- When asked for an update, it returns the link to the GitHub asset directly (saves bandwidth)\n- Supports **macOS** and **Windows** apps\n- Scales infinitely on [Vercel](https://vercel.com) Serverless Functions\n\n## Usage\n\nOpen this link in a new tab to deploy Hazel on [Vercel](https://vercel.com):\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fhazel\u0026env=ACCOUNT,REPOSITORY\u0026envDescription=Enter%20your%20GitHub%20user%2Forg%20slug%20and%20the%20name%20of%20the%20repository%20that%20contains%20your%20Electron%20app.\u0026envLink=https%3A%2F%2Fgithub.com%2Fvercel%2Fhazel%23usage\u0026repo-name=hazel-update-server)\n\nOnce it's deployed, paste the deployment address into your code (please keep in mind that updates should only occur in the production version of the app, not while developing):\n\n```js\nconst { app, autoUpdater } = require('electron')\n\nconst server = \u003cyour-deployment-url\u003e\nconst url = `${server}/update/${process.platform}/${app.getVersion()}`\n\nautoUpdater.setFeedURL({ url })\n```\n\nThat's it! :white_check_mark:\n\nFrom now on, the auto updater will ask your Hazel deployment for updates!\n\n## Options\n\nThe following environment variables can be used optionally:\n\n- `INTERVAL`: Refreshes the cache every x minutes ([restrictions](https://developer.github.com/changes/2012-10-14-rate-limit-changes/)) (defaults to 15 minutes)\n- `PRE`: When defined with a value of `1`, only pre-releases will be cached\n- `TOKEN`: Your GitHub token (for private repos)\n- `URL`: The server's URL (for private repos - when running on [Vercel](https://vercel.com), this field is filled with the URL of the deployment automatically)\n\n## Statistics\n\nSince Hazel routes all the traffic for downloading the actual application files to [GitHub Releases](https://help.github.com/articles/creating-releases/), you can use their API to determine the download count for a certain release.\n\nAs an example, check out the [latest Hyper release](https://api.github.com/repos/vercel/hyper/releases/latest) and search for `mac.zip`. You'll find a release containing a sub property named `download_count` with the amount of downloads as its value.\n\n## Routes\n\n### /\n\nDisplays an overview page showing the cached repository with the different available platforms and file sizes. Links to the repo, releases, specific cached version and direct downloads for each platform are present.\n\n### /download\n\nAutomatically detects the platform/OS of the visitor by parsing the user agent and then downloads the appropriate copy of your application.\n\nIf the latest version of the application wasn't yet pulled from [GitHub Releases](https://help.github.com/articles/creating-releases/), it will return a message and the status code `404`. The same happens if the latest release doesn't contain a file for the detected platform.\n\n### /download/:platform\n\nAccepts a platform (like \"darwin\" or \"win32\") to download the appropriate copy your app for. I generally suggest using either `process.platform` ([more](https://nodejs.org/api/process.html#process_process_platform)) or `os.platform()` ([more](https://nodejs.org/api/os.html#os_os_platform)) to retrieve this string.\n\nIf the cache isn't filled yet or doesn't contain a download link for the specified platform, it will respond like `/`.\n\n### /update/:platform/:version\n\nChecks if there is an update available by reading from the cache.\n\nIf the latest version of the application wasn't yet pulled from [GitHub Releases](https://help.github.com/articles/creating-releases/), it will return the `204` status code. The same happens if the latest release doesn't contain a file for the specified platform.\n\n### /update/win32/:version/RELEASES\n\nThis endpoint was specifically crafted for the Windows platform (called \"win32\" [in Node.js](https://nodejs.org/api/process.html#process_process_platform)).\n\nSince the [Windows version](https://github.com/Squirrel/Squirrel.Windows) of Squirrel (the software that powers auto updates inside [Electron](https://www.electronjs.org)) requires access to a file named \"RELEASES\" when checking for updates, this endpoint will respond with a cached version of the file that contains a download link to a `.nupkg` file (the application update).\n\n## Programmatic Usage\n\nYou can add Hazel to an existing HTTP server, if you want. For example, this will allow you to implement custom analytics on certain paths.\n\n```js\nconst hazel = require('hazel-server')\n\nhttp.createServer((req, res) =\u003e {\n  hazel(req, res)\n})\n```\n\n## Contributing\n\n1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device\n2. Move into the directory of your clone: `cd hazel`\n3. Install [Vercel CLI](https://vercel.com/cli) and run the development server: `vercel dev`\n\n## Credits\n\nHuge thanks to my ([@leo](https://github.com/leo)'s) friend [Andy](http://twitter.com/andybitz_), who suggested the name \"Hazel\" (since the auto updater software inside [Electron](https://www.electronjs.org) is called \"Squirrel\") and [Matheus](https://twitter.com/matheusfrndes) for collecting ideas with me.\n\n## Author\n\nLeo Lamprecht ([@leo](https://x.com/leo)) - [Vercel](https://vercel.com)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel%2Fhazel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvercel%2Fhazel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel%2Fhazel/lists"}