{"id":17194418,"url":"https://github.com/mauris/madtom","last_synced_at":"2025-08-30T09:06:49.174Z","repository":{"id":146247542,"uuid":"185011532","full_name":"mauris/madtom","owner":"mauris","description":"Minimalistic JSON over TCP/TLS server framework (Express.js without the HTTP)","archived":false,"fork":false,"pushed_at":"2019-05-05T09:43:25.000Z","size":4,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-30T09:06:45.479Z","etag":null,"topics":["api","framework","server","tcp","tls","web"],"latest_commit_sha":null,"homepage":"","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/mauris.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-05T09:43:17.000Z","updated_at":"2023-03-08T21:12:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"2a45eca3-5b75-437e-b765-07df32d1e96b","html_url":"https://github.com/mauris/madtom","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mauris/madtom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauris%2Fmadtom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauris%2Fmadtom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauris%2Fmadtom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauris%2Fmadtom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mauris","download_url":"https://codeload.github.com/mauris/madtom/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauris%2Fmadtom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272827489,"owners_count":24999813,"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-30T02:00:09.474Z","response_time":77,"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":["api","framework","server","tcp","tls","web"],"created_at":"2024-10-15T01:46:57.553Z","updated_at":"2025-08-30T09:06:49.133Z","avatar_url":"https://github.com/mauris.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Madtom JSON over TCP Framework\n\nInspired by the [json-over-tcp](https://github.com/turn/json-over-tcp) project and [Express.js Web Framework](https://expressjs.com/), Madtom is a TCP server framework that can process requests and responses in a middleware fashion similar to Express.js.\n\nOptionally, Madtom also supports TCP with TLS out of the box.\n\n````javascript\nconst madtom = require('madtom');\n\nconst app = madtom({\n  /* Enable server-side TLS identity */\n  tls: {\n    key: './server-key.pem',\n    cert: './server-cert.pem',\n  },\n});\n\n/* use JSON as the parser for request body */\napp.use(madtom.parsers.json);\n\napp.tryCatch((err, req, res, next) =\u003e {\n  console.log(`Error occurred:\\n\\t${err.message}`);\n});\n\n/*\n  Add a router to the\n */\nconst router = madtom.Router();\napp.use(router);\n\n/*\n  Executes only when request document has\n  the key \"fruit\" in it.\n */\nrouter\n  .filter(doc =\u003e doc.fruit)\n  .execute((req, res, next) =\u003e {\n    if (req.body.fruit === 'tomato') {\n      // handle the error\n      next(new Error('I think tomato is considered vegetable'));\n      return;\n    }\n    res.json({ status: 'ok' });\n  });\n\n/*\n  Executes only when request document is an object\n  and has the key \"consume\".\n\n  emitKeyValue() will transform the request document into an\n  array of key-value.\n */\nrouter\n  .isObject()\n  .hasKey('consume')\n  .emitKeyValue()\n  .execute((req, res, next) =\u003e {\n    req.body.forEach((tuple) =\u003e {\n      console.log(`${tuple.key}: ${tuple.value}`);\n    });\n    res.json({ status: 'ok' });\n  });\n\n/*\n  Start listening\n */\napp.listen(8001, 'madtom.test', () =\u003e {\n  console.log('listening!');\n});\n````\n\nSource code open sourced under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauris%2Fmadtom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmauris%2Fmadtom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauris%2Fmadtom/lists"}