{"id":19926601,"url":"https://github.com/microlinkhq/function","last_synced_at":"2025-06-12T05:07:04.041Z","repository":{"id":38183338,"uuid":"349124878","full_name":"microlinkhq/function","owner":"microlinkhq","description":"Browser functions as Service. Interacting with browser pages, remotely.","archived":false,"fork":false,"pushed_at":"2024-08-18T20:46:53.000Z","size":216,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-24T06:12:17.835Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://functions.microlink.io","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/microlinkhq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2021-03-18T15:29:39.000Z","updated_at":"2025-03-09T05:29:43.000Z","dependencies_parsed_at":"2023-10-30T22:29:46.188Z","dependency_job_id":"51eb9699-cb68-4569-9428-07f7ae93db12","html_url":"https://github.com/microlinkhq/function","commit_stats":{"total_commits":63,"total_committers":2,"mean_commits":31.5,"dds":0.07936507936507942,"last_synced_commit":"f5138b8319b96961c6d516b60113cc2c79d95a4e"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/microlinkhq/function","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Ffunction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Ffunction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Ffunction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Ffunction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microlinkhq","download_url":"https://codeload.github.com/microlinkhq/function/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Ffunction/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259402010,"owners_count":22851867,"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-12T22:29:53.807Z","updated_at":"2025-06-12T05:07:04.021Z","avatar_url":"https://github.com/microlinkhq.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/microlinkhq/cdn/raw/master/dist/logo/banner.png#gh-light-mode-only\" alt=\"microlink logo\"\u003e\n  \u003cimg src=\"https://github.com/microlinkhq/cdn/raw/master/dist/logo/banner-dark.png#gh-dark-mode-only\" alt=\"microlink logo\"\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003cp style=\"max-width: 400px;\"\u003e\u003cb\u003eMicrolink Function\u003c/b\u003e allows you to run JavaScript Serverless functions with \u003ca target=\"_blank\" href=\"https://browserless.js.org\"\u003eHeadless Chromium\u003c/a\u003e programmatic access.\u003c/p\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://i.imgur.com/4PWrzx2.png\" width=\"700px\"\u003e\n\u003c/div\u003e\n\n## Highlights\n\n- Starts from \\$0/mo.\n- Run Serverless Javascript functions (also [locally](https://github.com/microlinkhq/local)).\n- Ability to require to require any of the [allowed](#npm-packages) NPM packages.\n- Headless Chromium browser access in the same request cycle.\n- No servers to maintain, no hidden cost or infrastructure complexity.\n\n## Contents\n\n- [How it works](#how-it-works)\n- [Installation](#installation)\n  - [from NPM](#from-npm)\n  - [from CDN](#from-cdn)\n- [Get Started](#get-started)\n  - [Input](#input)\n    - [NPM packages](#npm-packages)\n  - [Output](#output)\n- [Examples](#examples)\n- [Pricing](#pricing)\n- [API](#api)\n- [License](#license)\n\n## How it works\n\nEvery time you call a **Microlink Function**, the code function will be compiled and executed remotely in a safe V8 sandbox.\n\nIt's pretty similar to AWS Lambda, but rather than bundle your code, all the code will be executed remotely, giving the result of the execution back to you.\n\n**Microlink Function** can be invoked in frontend or backend side. There is nothing to deploy or hidden infrastructure cost associated.\n\n## Installation\n\n### from NPM\n\nIt's available as [npm package](https://www.npmjs.com/package/@microlink/function):\n\n```bash\n$ npm install @microlink/function --save\n```\n\n### from CDN\n\nLoad directly in the browser from your favorite CDN:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@microlink/function/dist/microlink-function.min.js\"\u003e\u003c/script\u003e\n```\n\n## Get Started\n\n### Input\n\nLet say you have a JavaScript like this:\n\n```js\nconst ping = ({ statusCode, response }) =\u003e\n  statusCode ? response.status() : response.statusText()\n```\n\nTo run the previous code as **Microlink Function**, all you need to do is wrap the function with the `microlink` decorator:\n\n```js\nconst microlink = require('@microlink/function')\n\nconst ping = microlink(({ response }) =\u003e\n  statusCode ? response.status() : response.statusText()\n)\n```\n\nThen, just call the function as you would normally:\n\n```js\nconst result = await ping('https://example.com', { statusCode: true })\n\nconsole.log(result)\n\n// {\n//   isFullfilled: true,\n//   isRejected: false,\n//   value: 200\n// }\n```\n\nWhen a function is wrapped by **Microlink Function** the function execution is done remotely, giving back the result.\n\nAny **Microlink Function** will receive the following parameters:\n\n- `html`: When [meta](https://microlink.io/docs/api/parameters/meta) is enabled, the HTML markup of the website is provided.\n- `page`: The [`puppeteer#page`](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#class-page) instance to interact with the headless browser.\n- `response`: The [`puppeteer#response`](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#class-httpresponse) as result of the implicit [`page.goto`](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagegotourl-options).\n\n#### NPM packages\n\nAdditionally, you can require a allowed list of common NPM packages inside your code blocks:\n\n```js\nconst microlink = require('@microlink/function')\n\nconst ping = microlink(({ statusCode, response }) =\u003e {\n  const { result } = require('lodash')\n  return result(response, statusCode ? 'status' : 'statusText')\n})\n```\n\nThe list of allowed NPM packages are:\n\n- [`path`](https://nodejs.org/api/path.html)\n- [`url`](https://nodejs.org/api/url.html)\n- [`@aws-sdk/client-s3`](https://npm.im/@aws-sdk/client-s3)\n- [`@metascraper`](https://npm.im/@metascraper)\n- [`@mozilla/readability`](https://npm.im/@mozilla/readability)\n- [`async`](https://npm.im/async)\n- [`cheerio`](https://npm.im/cheerio)\n- [`extract-email-address`](https://npm.im/extract-email-address)\n- [`got`](https://npm.im/got)\n- [`ioredis`](https://npm.im/ioredis)\n- [`jsdom`](https://npm.im/jsdom)\n- [`lodash`](https://npm.im/lodash)\n- [`metascraper`](https://npm.im/metascraper)\n- [`p-reflect`](https://npm.im/p-reflect)\n- [`p-retry`](https://npm.im/p-retry)\n- [`p-timeout`](https://npm.im/p-timeout)\n\nDo you miss any NPM modules there? open a [new issue](/issues/new) and we make it available.\n\n### Output\n\nWhen a **Microlink Function** is executed, the result response object has the following interface:\n\n- `isFulfilled`\n- `isRejected`\n- `value` or `reason`, depending on whether the promise fulfilled or rejected.\n\n## Testing\n\nCheck [`@microlink/local`](https://github.com/microlinkhq/local) for executing your Microlink Functions locally.\n\n## Examples\n\nCheck [examples](/examples).\n\n## Pricing\n\n**Microlink Function** has been designed to be cheap and affordable.\n\nThe first 50 [uncached](https://microlink.io/blog/edge-cdn/) requests of every day are **free**. If you need more, you should to buy a [pro plan](https://microlink.io/#pricing).\n\nFor [authenticating](https://microlink.io/docs/api/basics/authentication) your requests, you should to provide your API key:\n\n```js\nconst microlink = require('@microlink/function')\n\nconst code = ({ statusCode, response }) =\u003e {\n  const { result } = require('lodash')\n  return result(response, statusCode ? 'status' : 'statusText')\n}\n\nconst ping = microlink(code, { apiKey: process.env.MICROLINK_API_KEY })\n```\n\n## API\n\n### microlink(fn, [mqlOpts], [gotoOpts])\n\n#### fn\n\n_Required_\u003cbr\u003e\nType: `function`\n\nThe function that be executed inside Microlink API browser.\n\n#### mqlOpts\n\nType: `object`\n\nThe function that be executed inside Microlink API browser.\n\nAny option passed here will bypass to [mql](https://github.com/microlinkhq/mql).\n\n#### gotoOpts\n\nType: `object`\n\nAny option passed here will bypass to [browserless#goto](https://browserless.js.org/#/?id=options-5).\n\n## License\n\n**microlink-function** © [Microlink](https://microlink.io), released under the [MIT](https://github.com/microlink/microlink-function/blob/master/LICENSE.md) License.\u003cbr\u003e\nAuthored and maintained by [Kiko Beats](https://kikobeats.com) with help from [contributors](https://github.com/microlink/microlink-function/contributors).\n\n\u003e [microlink.io](https://microlink.io) · GitHub [@MicrolinkHQ](https://github.com/microlinkhq) · X [@microlinkhq](https://x.com/microlinkhq)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrolinkhq%2Ffunction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrolinkhq%2Ffunction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrolinkhq%2Ffunction/lists"}