{"id":15440211,"url":"https://github.com/trieloff/universal-serverless","last_synced_at":"2025-12-11T19:40:39.481Z","repository":{"id":56140030,"uuid":"313619867","full_name":"trieloff/universal-serverless","owner":"trieloff","description":null,"archived":false,"fork":false,"pushed_at":"2020-11-24T18:18:53.000Z","size":53,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-19T10:43:02.703Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trieloff.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}},"created_at":"2020-11-17T12:57:02.000Z","updated_at":"2020-11-24T18:18:56.000Z","dependencies_parsed_at":"2022-08-15T13:30:44.687Z","dependency_job_id":null,"html_url":"https://github.com/trieloff/universal-serverless","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trieloff%2Funiversal-serverless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trieloff%2Funiversal-serverless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trieloff%2Funiversal-serverless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trieloff%2Funiversal-serverless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trieloff","download_url":"https://codeload.github.com/trieloff/universal-serverless/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243267181,"owners_count":20263798,"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-10-01T19:11:27.474Z","updated_at":"2025-12-11T19:40:34.430Z","avatar_url":"https://github.com/trieloff.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Universal Serverless Experiment\n\n\u003e Is write once, run everywhere possible for serverless computing?\n\nThis experiment tries to do two things:\n\n1. create a package that can be deployed to as many serverless platforms as possible\n2. provide adapter code so that all serverless platforms can execute one single, platform-agnostic function\n\nWith following limitations:\n\n- Assumes that the runtime is node.js (version 10+)\n- The only supported trigger is HTTP\n- None of the outbound platform APIs will be abstracted\n\nCompared to other approaches like [Serverless `@multicloud`](https://github.com/serverless/multicloud) this project:\n\n- does not require any code changes to adapt code from one runtime to another\n- does not depend on a framework\n\n## Try it\n\n```bash\n$ curl https://serverless.project-helix.dev/hello\n```\n\nYou will get the same function results, from a randomly selected runtime.\n\n## Supported Runtimes\n\n- Apache OpenWhisk\n- AWS Lambda\n- Azure Functions\n- Google Cloud Functions\n\n## API\n\n```javascript\n// we use the fetch API, and node-fetch is a good approximation\nconst { Response } = require(\"node-fetch\");\n\nmodule.exports.main = async function(request, context) {\n  let body = \"hello world!\\n\\n\";\n  \n  try {\n    body += JSON.stringify(context, null, \"  \");\n  } catch {\n    body += context.toString();\n  }\n  \n  body += \"\\n\" + request.url;\n  body += \"\\n\" + request.method;\n  body += \"\\n\" + request.headers.get('user-agent');\n  body += \"\\n\" + await request.text();\n  \n  return new Response(body, {\n    status: 201,\n    headers: {\n      'Content-Type': 'text/plain',\n      'X-Generator': 'hello world'\n    }\n  });\n}\n```\n\n### `request`\n\nIs a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) object.\n\n### `context`\n\nIs an object with following properties:\n\n- `runtime.name`: name of the runtime, e.g. `aws-lambda`\n- `runtime.region`: where the function is executed, e.g. `us-east1` – the names are not consistent across runtimes\n- `func.name`: name of the function, e.g. `hello`\n- `func.version`: version of the function, e.g. `0.0.53` – the versioning schemes are not consistent across runtimes\n- `func.app`: name of the application, project, namespace, or other container of the function\n- `invocation.id`: a request ID as generated by the runtime. Formats differ dramatically\n- `invocation.deadline`: timestamp (milliseconds till epoch) when the runtime will terminate the execution and time out. Not available for Azure\n- `env`: environment variables and other runtime-managed parameters (e.g. default parameters in OpenWhisk)\n\n### `return`\n\nReturn something that looks like a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Request) object.\nWe honor: `status`, `headers`, `body`\n\n# Known Limitations \n\n- no unit or integration tests, no CI\n\n# Next Steps\n\n- A service that deploys function from a zip file\n\n# Developing\n\n```bash\n# create a zip file\n$ sh build.sh\n\n# deploy it everywhere\n$ sh deploy.sh\n\n# fetch the results\n$ sh test.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrieloff%2Funiversal-serverless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrieloff%2Funiversal-serverless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrieloff%2Funiversal-serverless/lists"}