{"id":27700884,"url":"https://github.com/dallasg/tony","last_synced_at":"2025-04-25T19:07:19.166Z","repository":{"id":289552097,"uuid":"971643236","full_name":"dallasg/tony","owner":"dallasg","description":"A lightweight, DI-powered, MediatR-style framework for building modular, message-driven apps on Cloudflare Workers.","archived":false,"fork":false,"pushed_at":"2025-04-23T21:27:17.000Z","size":98,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-25T19:07:18.575Z","etag":null,"topics":["clean-architecture","cloudflare-workers","dependency-injection","edge","framework","message-bus","modular","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/dallasg.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2025-04-23T20:48:18.000Z","updated_at":"2025-04-23T21:24:53.000Z","dependencies_parsed_at":"2025-04-23T21:46:47.749Z","dependency_job_id":null,"html_url":"https://github.com/dallasg/tony","commit_stats":null,"previous_names":["dallasg/tony"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dallasg%2Ftony","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dallasg%2Ftony/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dallasg%2Ftony/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dallasg%2Ftony/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dallasg","download_url":"https://codeload.github.com/dallasg/tony/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250878875,"owners_count":21501742,"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":["clean-architecture","cloudflare-workers","dependency-injection","edge","framework","message-bus","modular","typescript"],"created_at":"2025-04-25T19:07:15.058Z","updated_at":"2025-04-25T19:07:19.161Z","avatar_url":"https://github.com/dallasg.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tony\n\n\u003e Your edge-native message guy.\n\n**Tony** is a minimalist, message-driven, dependency-injected backend framework built to run on Cloudflare Workers. More coming soon.\n\n## 🚀 Usage\n\nCreate a service\n```TypeScript\n// src/services/MathService.ts\nexport interface IMathService {\n  double(value: number): number;\n}\n\nexport class MathService implements IMathService {\n  double(value: number): number {\n    return value * 2;\n  }\n}\n```\n\nCreate a handler\n```TypeScript\n// src/features/math/DoubleNumberHandler.ts\nimport type { IMathService } from '../../services/MathService';\n\nexport class DoubleNumberHandler {\n  constructor(private math: IMathService) {}\n\n  async handle(input: { value: number }): Promise\u003c{ result: number }\u003e {\n    return { result: this.math.double(input.value) };\n  }\n}\n```\n\n\nCreate an endpoint\n```TypeScript\n// src/features/math/double.endpoint.ts\n\nimport type { Router } from '../../core/router';\nimport type { Bus } from '../../core/bus';\n\nexport function registerDoubleEndpoint(router: Router) {\n  router.register('post', '/double', async (req, bus: Bus) =\u003e {\n    const body = await req.json();\n    return bus.send('DoubleNumber', body);\n  });\n}\n```\n\n\nInject them\n```TypeScript\n// src/index.ts\ncontainer.addSingleton(IMathService, new MathService());\ncontainer.addSingleton('DoubleNumberHandler', new DoubleNumberHandler(container.resolve(IMathService)));\nbus.register('DoubleNumber', 'DoubleNumberHandler');\n\nregisterDoubleEndpoint(router);\n```\n\n\nUse it\n```bash\nnpx wrangler dev\nhttp POST http://localhost:8787/greet name=Tony\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdallasg%2Ftony","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdallasg%2Ftony","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdallasg%2Ftony/lists"}