{"id":20251740,"url":"https://github.com/osdevisnot/sorvor","last_synced_at":"2025-04-10T23:15:40.183Z","repository":{"id":49427728,"uuid":"315525642","full_name":"osdevisnot/sorvor","owner":"osdevisnot","description":"extremely fast, zero config server for modern web applications.","archived":false,"fork":false,"pushed_at":"2022-01-12T01:29:38.000Z","size":161,"stargazers_count":82,"open_issues_count":5,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-10T23:15:34.085Z","etag":null,"topics":["asset-pipeline","entrypoint","esbuild","html","primitives"],"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/osdevisnot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-24T05:14:25.000Z","updated_at":"2025-01-28T09:56:41.000Z","dependencies_parsed_at":"2022-08-29T11:30:25.099Z","dependency_job_id":null,"html_url":"https://github.com/osdevisnot/sorvor","commit_stats":null,"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osdevisnot%2Fsorvor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osdevisnot%2Fsorvor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osdevisnot%2Fsorvor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osdevisnot%2Fsorvor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osdevisnot","download_url":"https://codeload.github.com/osdevisnot/sorvor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312134,"owners_count":21082638,"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":["asset-pipeline","entrypoint","esbuild","html","primitives"],"created_at":"2024-11-14T10:12:35.088Z","updated_at":"2025-04-10T23:15:40.163Z","avatar_url":"https://github.com/osdevisnot.png","language":"Go","readme":"# sørvør\n\n\u003e lightning fast, zero config build tool for modern Javascript and Typescript.\n\n## Introduction\n\n`sørvør` is a lightweight replacement for heavier, more complex build tools such as webpack or parcel. It is an opinionated take on [`esbuild`](https://esbuild.github.io/) with sane default and plugins to enhance your development workflow.\n\n## Major Features\n\n- **Instant Startup**: `sørvør` is authored in [golang](https://golang.org/), which offers the best startup time for command line applications. Often times, `sørvør` will finish bundling your project by the time a `node.js` bundler starts loading.\n- **Easy Installation**: `sørvør` is distributed as a single binary for all major platforms. It's just one command to install `sørvør` using installation method of your choice.\n- **Optimize for Production**: Build for production with built-in optimizations and Asset Pipeline.\n\n## Installation\n\nThe easiest method to install sørvør is using `npm` or `yarn`:\n\n```bash\nnpm install sorvor\n# or\nyarn add sorvor\n```\n\nAlternatively, if you have [go](https://golang.org/) installed, use `go get` to install sørvør:\n\n```bash\ngo get github.com/osdevisnot/sorvor\n```\n\nOnce installed, verify your installation using `version` flag\n\n```bash\nsorvor --version\n```\n\n## Quickstart\n\nYou can always refer [example projects](examples) for fully integrated setup using `sørvør`. To get started, let's set up a simple Preact application using `sørvør`. First, create a minimal scaffold using `degit`:\n\n```bash\nnpx degit osdevisnot/sorvor-minimal preact-hello\n```\n\nThe minimal scaffold comes with a README.md file with short description of available commands. Let's start the live reloading server using the command from README.md:\n\n```bash\nsorvor --serve\n```\n\nThis should bundle your project and start a live reloading server at [http://localhost:1234](http://localhost:1234).\n\nNow, let's add a simple Preact Component which renders Hello World.\n\n```js\nimport { h, render } from \"preact\";\n\nconst Counter = () =\u003e \u003cdiv\u003eHello World\u003c/div\u003e;\n\nrender(\u003cCounter /\u003e, document.body);\n```\n\nYou should notice an error on terminal which should look like this:\n\n```log\n2021/02/23 09:55:58 Warn: Unexpected \"\u003c\"\n```\n\nThis error indicates sørvør was unable to parse JSX syntax we just entered. Let's restart sørvør to be able to parse JSX Syntax:\n\n```bash\nsorvor --serve --loader:.js=jsx --jsx-factory=h\n```\n\nOn restart, your browser should display Hello World rendered using preact.\n\n## Node.js Usage\n\nYou can use `sørvør` to bundle browser based applications, but it is equally suitable for node.js applications as well. Let's try to build a simple express server using `sørvør` as build tool.\n\nFirst of, create a project directory and install `express` as a dependency:\n\n```bash\nmkdir hello-server\ncd hello-server\nnpm init --yes\nnpm install express\n```\n\nNow, let's create a `server.js` file in src directory, and paste below code in it:\n\n```js\nimport express from \"express\";\n\nconst app = express();\nconst port = 3000;\n\napp.get(\"/\", (req, res) =\u003e {\n  res.send(\"Hello World !!\");\n});\n\napp.listen(port, () =\u003e {\n  console.log(`App Ready on http://localhost:${port}`);\n});\n```\n\nNow, let's start the build using\n\n```bash\nsorvor src/server.js --serve --platform=node\n```\n\nThe platform node automatically adds all the dependencies from `package.json` as external. The `serve` when combined with node platform, builds the entry file and starts running it once the build is complete. Try visiting [http://localhost:3000](http://localhost:3000) to see \"Hello World\" rendered in the browser.\n\n## Asset Pipeline\n\nThe asset pipeline for `sørvør` is partially inspired by HUGO pipes. To use the asset pipeline, use below annotations in your HTML entrypoint.\n\n### Live Reload\n\n`sørvør` supports live reloading connected browsers based on [SSE Web API](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).\n\nTo use this feature, include the livereload annotation in your HTML entrypoint like this:\n\n```html\n\u003chtml\u003e\n  ...\n  \u003cbody\u003e\n    {{ livereload }}\n  \u003c/body\u003e\n  ...\n\u003c/html\u003e\n```\n\n### Bundle with `esbuild`\n\nTo run an entrypoint through `esbuild`, use `esbuild` annotation in your HTML entrypoint like this:\n\n```html\n\u003cscript type=\"module\" src=\"{{ esbuild \"index.js\" }}\"\u003e\u003c/script\u003e\n```\n\n### Copy static files\n\nTo copy a file from source to outdir, use `copy` annotation in your HTML entrypoint like this:\n\n```html\n\u003clink rel=\"shortcut icon\" href='{{ copy \"assets/favicon.ico\" }}' type=\"image/x-icon\" /\u003e\n```\n\n## Plugins\n\n`sørvør` enhances esbuild with few quality of life plugins. These plugins are enabled by default and require no configuration for usage.\n\n### env plugin\n\nThe env plugin imports the current environment variables at build time. You can use the environment variables like this:\n\n```js\nimport { PATH } from \"env\";\nconsole.log(`PATH is ${PATH}`);\n```\n\n## Configuration\n\nFor most part, `sørvør` tries to use sensible defaults, but you can configure the behaviour using command line arguments below:\n\n| cli argument | description                | default value |\n| ------------ | -------------------------- | ------------- |\n| `--host=...` | host for sørvør            | `localhost`   |\n| `--port=...` | port for sørvør            | `1234`        |\n| `--serve`    | enable development mode    | `false`       |\n| `--secure`   | use https with `localhost` | `false`       |\n\n\u003e `sørvør` forwards all the other command line arguments to `esbuild`.\n\n\u003e `--secure` automatically creates a self-signed certificate for provided host.\n\n\u003e to disable chrome warnings, open chrome://flags/#allow-insecure-localhost and change the setting to \"Enabled\".\n\nPlease refer documentation for [simple esbuild options](https://esbuild.github.io/api/#simple-options) or [advance options](https://esbuild.github.io/api/#advanced-options) to further customize the bundling process.\n\n`sørvør` configures below values for esbuild as defaults which you can override using command line arguments:\n\n| cli argument   | description                         | default value |\n| -------------- | ----------------------------------- | ------------- |\n| `--outdir=...` | target directory for esbuild output | `dist`        |\n\n`sørvør` configures below values for esbuild which can not be changed:\n\n| cli argument | description                          | default value                                 |\n| ------------ | ------------------------------------ | --------------------------------------------- |\n| `--bundle`   | enables bundling output files        | `true`                                        |\n| `--write`    | enables writing built output to disk | `true`                                        |\n| `--define`   | value for `process.env.NODE_ENV`     | `production` and `development` with `--serve` |\n\n## Inspirations\n\nThis project is inspired by [servør](https://www.npmjs.com/package/servor) from [Luke Jackson](https://twitter.com/lukejacksonn), which provides similar zero dependency development experience but lacks integration with a bundler/build tools.\n\n## License\n\n**sørvør** is licensed under the [MIT License](http://opensource.org/licenses/MIT).\n\nDocumentation is licensed under [Creative Commons License](http://creativecommons.org/licenses/by/4.0/).\n\nCreated with ❤️ by [@osdevisnot](https://github.com/osdevisnot) and [all contributors](https://github.com/osdevisnot/sorvor/graphs/contributors).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosdevisnot%2Fsorvor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosdevisnot%2Fsorvor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosdevisnot%2Fsorvor/lists"}