{"id":25363890,"url":"https://github.com/meblum/serv","last_synced_at":"2026-02-03T05:35:10.052Z","repository":{"id":193191881,"uuid":"688302291","full_name":"meblum/serv","owner":"meblum","description":"A cross platform, zero-config, dependency free file server that serves a directory over HTTP and reloads HTML files in the browser when the document or its dependencies have changed.","archived":false,"fork":false,"pushed_at":"2024-08-21T20:18:21.000Z","size":50,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T17:11:09.497Z","etag":null,"topics":["developer-tools","file-server","go","golang","hot-reload","http"],"latest_commit_sha":null,"homepage":"","language":"Go","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/meblum.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-09-07T04:27:32.000Z","updated_at":"2024-08-21T20:11:33.000Z","dependencies_parsed_at":"2024-08-20T06:17:23.596Z","dependency_job_id":"aa8cde38-50fe-4a56-b250-37881e56dcb6","html_url":"https://github.com/meblum/serv","commit_stats":null,"previous_names":["meblum/serv"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/meblum/serv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meblum%2Fserv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meblum%2Fserv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meblum%2Fserv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meblum%2Fserv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meblum","download_url":"https://codeload.github.com/meblum/serv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meblum%2Fserv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262610746,"owners_count":23336942,"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":["developer-tools","file-server","go","golang","hot-reload","http"],"created_at":"2025-02-14T22:53:30.592Z","updated_at":"2026-02-03T05:35:05.016Z","avatar_url":"https://github.com/meblum.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# serv\n\nA cross platform, zero-config, dependency free, pure Go local file server that serves a directory on your file system over HTTP and automatically reloads HTML files in the browser when the document or any of its dependencies have changed.\n\n## Install\nThe simplest way to install this tool is by using the [Go command](https://go.dev/dl/). Simply run\n\n`go install github.com/meblum/serv@latest`\n\nIf you want to run the server without installing it, you can just run\n\n`go run github.com/meblum/serv@latest`\n\n## Overview\nRunning the `serv` command starts a local server that serves the current directory on port `8080` and automatically shuts down after 30 minutes of idle time (no request to the server).\n\nAuto shutdown can be configured with the `--shutdown-after` flag where you can pass any value that is understood by the Go [time.ParseDuration](https://pkg.go.dev/time#ParseDuration) function, for example `--shutdown-after=1.5h` (or `--shutdown-after=0` to disable shutdown).\n\nUse `serv path/to/directory` to specify a different directory to serve. Navigating to a directory in the browser will return an auto generated index of the directory, if an index.html file is present in the directory, it will be served instead. By default, all HTML documents will be injected with a tiny script which will tell the browser to reload when a change is detected.\n\nUse the `--no-reload` flag to simply serve the directory without reloading, and `--port` to use an alternative port.\n\n## Flags\nA main design goal was to keep this tool extremely simple. A few optional flags may be set.\n\nAs an example:\n\n```\nserv --no-reload --port=4200 --shutdown-after=2h path/to/dir\n```\n\nrun `serv --help` to display the following help message:\n```\nUsage (v0.0.11): serv [-options] [directory (default \".\")]\n  -no-reload\n        serve without reloading on file update\n  -port int\n        port to serve on (default 8080)\n  -shutdown-after duration\n        shutdown after idle time (\"0\" for no shutdown) (default 30m0s)\n```\n## How it works\nThe server adds a tiny script to served HTML files.\nThe script keeps a [long-running](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) HTTP connection between the document and the server, and the server keeps a mapping of files the HTML document depends on. The server notifies the script when a file has changed and the script reloads the page.\n\n## Use as a Go module\nYou can use and extend the functionality of this tool. The module exposes a single `FileServer` function that returns the file server as an `http.Handler`. Please refer to the [go doc](https://pkg.go.dev/github.com/meblum/serv/reload) for more information.\n\n## License\n```\nMIT License\n\nCopyright (c) 2023 Meir Blumenfeld\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeblum%2Fserv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeblum%2Fserv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeblum%2Fserv/lists"}