{"id":36676051,"url":"https://github.com/kapetacom/sdk-nodejs-server","last_synced_at":"2026-01-12T10:49:14.168Z","repository":{"id":204333833,"uuid":"193269282","full_name":"kapetacom/sdk-nodejs-server","owner":"kapetacom","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-15T13:07:28.000Z","size":297,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-25T22:42:52.896Z","etag":null,"topics":["nodejs-sdk"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/kapetacom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-06-22T18:55:19.000Z","updated_at":"2024-07-15T13:07:31.000Z","dependencies_parsed_at":"2023-12-15T15:42:40.833Z","dependency_job_id":"6996b3e5-5f02-42fc-b06e-c45c0bb0c6b2","html_url":"https://github.com/kapetacom/sdk-nodejs-server","commit_stats":{"total_commits":103,"total_committers":7,"mean_commits":"14.714285714285714","dds":0.6504854368932038,"last_synced_commit":"c19959e14a248f8c2688d8d91951cec143bf37ea"},"previous_names":["kapetacom/sdk-nodejs-server"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/kapetacom/sdk-nodejs-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetacom%2Fsdk-nodejs-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetacom%2Fsdk-nodejs-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetacom%2Fsdk-nodejs-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetacom%2Fsdk-nodejs-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kapetacom","download_url":"https://codeload.github.com/kapetacom/sdk-nodejs-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetacom%2Fsdk-nodejs-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:40:25.642Z","status":"ssl_error","status_checked_at":"2026-01-12T10:39:27.820Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["nodejs-sdk"],"created_at":"2026-01-12T10:49:14.061Z","updated_at":"2026-01-12T10:49:14.151Z","avatar_url":"https://github.com/kapetacom.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kapeta NodeJS Server\n\nThis provides an HTTP server for Kapeta blocks.\n\nIt wraps the express server and provides plumbing for the blocks.\n\nThe Server class is implemented in [index.ts](index.ts).\n\n## Features\n\n### Frontend\nServes the frontend assets for the block when applicable.\n\nUses webpack to build the frontend assets and serves them from memory in dev mode - with hot reloading.\nWill serve the assets from the dist folder in production mode.\n\nSee the ```Server.configureFrontend()``` method for details.\n\nThe webpack server is implemented in [src/webpack.ts](src/webpack.ts).\n\n#### Templates\nThe templates are managed via [express template engine](https://expressjs.com/en/guide/using-template-engines.html).\nIn short, express needs to know where the views live, and which renderer to use.\n\nMake sure to include all parameters in the template, otherwise the block will not work as expected.\n\n```typescript\n// Set up webpack middleware and render methods\nconst DIST_DIR = Path.resolve(__dirname, \"../dist\");\nconst webpackConfig = require(\"../webpack.development.config\");\nserver.configureFrontend(DIST_DIR, webpackConfig);\n\n// Set up templating\nconst hbs = createHandlebars({\n    extname: '.hbs',\n    defaultLayout: false,\n    helpers: {\n        // Recommended helper to serialize values in handlebars\n        toJSON: (obj: any) =\u003e JSON.stringify(obj),\n    },\n});\nserver.express().engine('hbs', hbs.engine);\nserver.express().set('views', Path.resolve(__dirname, \"../templates\"));\nserver.express().set('view engine', 'hbs');\n\nserver.get('/', async (req, res, next) =\u003e {\n    // render the main template e.g. templates/main.hbs\n    await res.renderPage('main');\n});\n```\n\nTemplate parameters include:\n\n- `baseURL` usually sets the HTML [base tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) in the template\n- `scripts` is a list of `\u003cscript\u003e` tags to load the app JS bundle.\n- `styles` is a list of `\u003cstyle\u003e` tags to load the app CSS bundle.\n\n### Healthcheck\nThe server provides a standard Kapeta healthcheck endpoint at `/.kapeta/health`.\n\nYou can disable this using the `disableHealthcheck` option.\n\nYou can also override the default health check by subclassing the Server and overriding the `configureHealthCheck` method.\n\n### Catch-all Handler\n\nWill add a catch-all route that will return a 418 for any request that does not match a route.\n\nThis makes it easier to determine if a request is not being handled by the server.\n\nYou can disable the catch-all route using the `disableCatchAll` option.\n\nYou can also override the default catch all by subclassing the Server and overriding the `configureCatchAll` method.\n\n### Error handling\n\nThe server will catch any errors thrown by the routes and return a consistent response.\nIf the error contains a \"statusCode\" property it will be used as the response status code.\n\nYou can disable this using the `disableErrorHandling` option.\n\nYou can also override the default error handling by subclassing the Server and overriding the `configureErrorHandler` method.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapetacom%2Fsdk-nodejs-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkapetacom%2Fsdk-nodejs-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapetacom%2Fsdk-nodejs-server/lists"}