{"id":16226182,"url":"https://github.com/antony/hapda","last_synced_at":"2025-08-21T12:10:42.411Z","repository":{"id":40726230,"uuid":"247845983","full_name":"antony/hapda","owner":"antony","description":"Define Hapi route handlers for serverless endpoints on now / aws / sls / gcf","archived":false,"fork":false,"pushed_at":"2022-12-30T19:53:12.000Z","size":2394,"stargazers_count":7,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T07:38:20.451Z","etag":null,"topics":["bridge","functions","google-cloud-functions","hapi","http","lambda","node-http","now","serverless","sls","zeit"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antony.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-17T00:42:08.000Z","updated_at":"2022-03-12T04:51:24.000Z","dependencies_parsed_at":"2023-01-31T15:00:43.422Z","dependency_job_id":null,"html_url":"https://github.com/antony/hapda","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/antony/hapda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antony%2Fhapda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antony%2Fhapda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antony%2Fhapda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antony%2Fhapda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antony","download_url":"https://codeload.github.com/antony/hapda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antony%2Fhapda/sbom","scorecard":{"id":199781,"data":{"date":"2025-08-11","repo":{"name":"github.com/antony/hapda","commit":"90066ce560cbc4da8ef8050fb3052fed7f0bd4c9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/antony/hapda/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/antony/hapda/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/antony/hapda/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/antony/hapda/publish.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   2 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"17 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-w7rc-rwvf-8q5r","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T22:36:51.165Z","repository_id":40726230,"created_at":"2025-08-16T22:36:51.165Z","updated_at":"2025-08-16T22:36:51.165Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271477988,"owners_count":24766421,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bridge","functions","google-cloud-functions","hapi","http","lambda","node-http","now","serverless","sls","zeit"],"created_at":"2024-10-10T12:48:23.738Z","updated_at":"2025-08-21T12:10:42.355Z","avatar_url":"https://github.com/antony.png","language":"JavaScript","readme":"## Hapda\n\nDefine Hapi route handlers for serverless, lambda (req, res) endpoints.\n\n### Features\n\n* Full access to the Hapi API and ecosystem\n* Uses shot.inject rather than running a real Hapi instance, meaning no extra TCP overhead, no extra HTTP overhead\n* Clean and concise, doesn't get in your way\n* Leverage entire existing Hapi ecosystem, validation, plugins, caching, architecture\n* Build battle-tested serverless handlers instead of hacking together raw http endpoints\n\n### What is it?\n\nIf like me, you like the idea of serverless but dislike the lambda / node http / express / polka API format, and prefer Hapi's routing, this allows you to do the following:\n\n```js\nconst { hapda } = require('hapda')\n\nmodule.exports = hapda({\n  method: 'GET',\n  path: '/foo/bar',\n  handler: () =\u003e {\n    return { baz: 'qux' }\n  }\n})\n```\n\nand then publish your serverless function as normal.\n\n### How do I use plugins?\n\nYou can access the entire Hapi instance by passing a method which is given the Hapi instance as a parameter.\n\n```js\nconst myMethod = async server =\u003e {\n  server.plugins(...) // or routes, handlers, anything you can do with Hapi at all.\n}\n\nmodule.exports = hapda(myRoute, myMethod)\n```\n\n#### An example with some caching and auth\n\nThe following example does two things:\n\n* Sets up authentication in basic mode (with a super secure password ;))\n* Sets up a cached server-function whose value is cached for 15 seconds\n\n```js\nconst validate = async (request, username, password, h) =\u003e {\n  const isValid = username === 'admin' \u0026\u0026 password === 'admin123'\n  return { isValid, credentials: { id: 123, username } }\n}\n\nasync function setupServer (server) {\n  await server.register(require('@hapi/basic'))\n  server.auth.strategy('simple', 'basic', { validate })\n  server.auth.default('simple')\n\n  server.method(\n    'time',\n    () =\u003e new Date(),\n    {\n      cache: {\n        expiresIn: 15000,\n        generateTimeout: 100\n      }\n    }\n  )\n}\n\nconst route = {\n  method: 'PUT',\n  path: '/foo/bar',\n  handler: () =\u003e {\n    return { lastCachedTime: server.methods.time() }\n  }\n}\n\nmodule.exports = hapda(route, setupServer)\n```\n\n### Troubleshooting\n\n#### Caching / Plugin X doesn't work.\n\nFor reasons of speed, Hapda doesn't call `initialize()` on bootstrap. Normally, this function would be called by `server.start()` but because we don't call that, or bind to a port or listen for HTTP connections, it never gets called. If you find that you need to call `initialize()` to finalize plugin registration or start caching, you can do so using the server setup method:\n\n\n```js\nasync function setupServer (server) {\n  await server.register(someComplexPlugin)\n  await server.initialize()\n}\n\nconst route = {\n  method: 'GET',\n  path: '/foo/bar',\n  handler: () =\u003e {\n    return { foo: 'bar' }\n  }\n}\n\nmodule.exports = hapda(route, setupServer)\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantony%2Fhapda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantony%2Fhapda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantony%2Fhapda/lists"}