{"id":14989555,"url":"https://github.com/koatty/koatty","last_synced_at":"2025-04-05T16:07:15.718Z","repository":{"id":38408343,"uuid":"131427005","full_name":"Koatty/koatty","owner":"Koatty","description":"Koa2 + Typescript = Koatty. Use Typescript's decorator implement IOC and AOP.","archived":false,"fork":false,"pushed_at":"2024-10-30T01:51:30.000Z","size":3749,"stargazers_count":124,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T04:00:47.713Z","etag":null,"topics":["aop","auto-injection","grpc","grpc-server","http","http2","https","ioc","koa","koa2","middleware","rpc","springboot","typescript","typescript-decorator","websocket","ws"],"latest_commit_sha":null,"homepage":"https://koatty.org/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Koatty.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":"2018-04-28T16:44:15.000Z","updated_at":"2024-10-15T10:17:29.000Z","dependencies_parsed_at":"2023-02-10T07:35:16.580Z","dependency_job_id":"fe09ae38-5ee7-4871-b197-fab5a7448458","html_url":"https://github.com/Koatty/koatty","commit_stats":{"total_commits":1411,"total_committers":4,"mean_commits":352.75,"dds":"0.017717930545712246","last_synced_commit":"2b4d1e052de529789f98f56c56aa7729fbd18965"},"previous_names":["thinkkoa/koatty"],"tags_count":110,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Koatty%2Fkoatty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Koatty%2Fkoatty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Koatty%2Fkoatty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Koatty%2Fkoatty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Koatty","download_url":"https://codeload.github.com/Koatty/koatty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361687,"owners_count":20926643,"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":["aop","auto-injection","grpc","grpc-server","http","http2","https","ioc","koa","koa2","middleware","rpc","springboot","typescript","typescript-decorator","websocket","ws"],"created_at":"2024-09-24T14:18:33.715Z","updated_at":"2025-04-05T16:07:15.697Z","avatar_url":"https://github.com/Koatty.png","language":"TypeScript","readme":"# Koatty 🚀\n\n[![npm version](https://img.shields.io/npm/v/koatty)](https://www.npmjs.com/package/koatty)\n[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n\nKoa2 + Typescript + IOC = koatty. **Koatty** is a progressive Node.js framework for building efficient and scalable server-side applications. Perfect for crafting enterprise-level APIs, microservices, and full-stack applications with TypeScript excellence.\n\n## Why Koatty? 💡\n\n- 🚄 **High Performance**: Built on top of Koa2 with optimized architecture\n- 🧩 **Full-Featured**: Supports gRPC, HTTP, WebSocket, Schedule tasks, and more\n- 🧠 **TypeScript First**: Native TypeScript support with elegant OOP design\n- 🌀 **Spring-like IOC Container**: Powerful dependency injection system with autowiring\n- ✂️ **AOP Support**: Aspect-oriented programming with decorator-based interceptors\n- 🔌 **Extensible Architecture**: Plugin system with dependency injection\n- 📦 **Modern Tooling**: CLI scaffolding, testing utilities, and production-ready configs\n- 🌐 **Protocol Agnostic**: Write once, deploy as HTTP/gRPC/WebSocket services\n\n\n## New features ✨\n\n* HTTP、HTTPS、HTTP2、gRPC、WebSocket server.✔️\n* Support loading configurations based on the environment, support command-line argument parsing(process.argv), and support environment variable parsing(process.env).✔️\n* `@ExceptionHandler()` Register global exception handling.✔️\n* Graceful shutdown and pre-exit event.✔️\n* Supports custom decorators, bound to app events for execution.✔️\n* GraphQL supporting. ✔️\n* OpenTelemetry . 💪\n\n\n## Core Features ✨\n\n### 📡 Multi-Protocol Support\n```typescript\n// config/config.ts\nexport default {\n  ...\n  protocol: \"grpc\", // Server protocol 'http' | 'https' | 'http2' | 'grpc' | 'ws' | 'wss'\n  ...\n}\n```\n\n### 💉 Dependency Injection\n```typescript\n@Service()\nexport class UserService {\n  async findUser(id: number) {\n    return { id, name: 'Koatty User' };\n  }\n}\n\n@Controller()\nexport class IndexController {\n    app: App;\n    ctx: KoattyContext;\n    ...\n\n    @Autowired()\n    private userService: UserService;\n\n    async test(id: number) {\n        const info = await this.userService.findUser(id);\n        ...\n    }\n}\n```\n\n### ✂️ Aspect-Oriented Programming\n```javascript\n@Aspect()\nexport class LogAspect implements IAspect {\n  app: App;\n\n  run() {\n    console.log('LogAspect');\n  }\n}\n\n// Apply aspect to controller\n@Controller()\n@BeforeEach(LogAspect)\nexport class UserController {}\n```\n\n### 🔌 Plugin System\n```javascript\n// plugin/logger.ts\nexport class LoggerPlugin implements IPlugin {\n  app: App;\n\n  run() {\n    // todo something or hook on app.event\n    Logger.Debug(\"LoggerPlugin\");\n    return Promise.resolve();\n  }\n}\n```\n\n\n## Benchmarks 📊\n\n| Framework  | Requests/sec | Latency | Memory Usage |\n| ---------- | ------------ | ------- | ------------ |\n| **Koatty** | 13,321       | 1.43ms  | 54MB         |\n| Express    | 12,456       | 1.45ms  | 52MB         |\n| NestJS     | 11,892       | 1.51ms  | 63MB         |\n\n*Tested on AWS t3.micro with 100 concurrent connections*\n\n## Documentation 📚\n\n- [中文文档](https://koatty.org/)\n- [Getting Started Guide](https://github.com/Koatty/koatty_doc/blob/master/docs/README-en.md)\n- [API Reference](https://koatty.org/#/?id=api)\n- [Recipes \u0026 Best Practices](https://github.com/Koatty/koatty_awesome)\n- [Example](https://github.com/Koatty/koatty_demo)\n\n\n## Quick Start ⚡\n\n1. **Install CLI**:\n```bash\nnpm install -g koatty_cli\n```\n\n2. **Create Project**:\n```bash\nkoatty new awesome-app\n```\n\n3. **Run Development Server**:\n```bash\ncd awesome-app\nnpm run dev\n```\n\n\n## Community 🌍\n\n- [GitHub Discussions](https://github.com/Koatty/koatty/discussions)\n\n## Contributors ✨\n\nThanks to these amazing developers:\n\n\u003c!-- Add contributor list here --\u003e\n\n\n## License 📄\n\nBSD-3 © [Koatty Team](https://github.com/Koatty)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoatty%2Fkoatty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoatty%2Fkoatty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoatty%2Fkoatty/lists"}