{"id":13452535,"url":"https://github.com/Odi-ts/odi","last_synced_at":"2025-03-23T19:34:25.837Z","repository":{"id":33183770,"uuid":"152342083","full_name":"Odi-ts/odi","owner":"Odi-ts","description":"🌪🌌 Opinionated, Declarative, Idiomatic framework for building scalable, supportable and reliable enterprise applications. ","archived":true,"fork":false,"pushed_at":"2023-11-22T05:11:38.000Z","size":3165,"stargazers_count":264,"open_issues_count":51,"forks_count":13,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-18T10:51:33.341Z","etag":null,"topics":["declarative","enterprise","es6","esnext","http","node","nodejs","typescript","typescript-framework","webserver","websockets"],"latest_commit_sha":null,"homepage":"https://odi.gitbook.io","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/Odi-ts.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-10-10T01:04:02.000Z","updated_at":"2024-11-02T08:23:55.000Z","dependencies_parsed_at":"2024-06-21T14:10:15.736Z","dependency_job_id":"60c397fc-a036-40d4-ab0e-f4b4b0f26da7","html_url":"https://github.com/Odi-ts/odi","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Odi-ts%2Fodi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Odi-ts%2Fodi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Odi-ts%2Fodi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Odi-ts%2Fodi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Odi-ts","download_url":"https://codeload.github.com/Odi-ts/odi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245159454,"owners_count":20570390,"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":["declarative","enterprise","es6","esnext","http","node","nodejs","typescript","typescript-framework","webserver","websockets"],"created_at":"2024-07-31T07:01:26.857Z","updated_at":"2025-03-23T19:34:25.248Z","avatar_url":"https://github.com/Odi-ts.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","typescript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e \u003cimg src=\"https://i.imgur.com/4Zf3O35.png\" height=\"94\"/\u003e \u003c/p\u003e\n\n\u003cp align=\"center\"\u003e \n\t\u003ca href=\"https://codeclimate.com/github/Odi-ts/odi/maintainability\"\u003e\n\t\t\u003cimg src=\"https://api.codeclimate.com/v1/badges/5c736ec0fc59f431128c/maintainability\" /\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://codeclimate.com/github/Odi-ts/odi/test_coverage\"\u003e\n\t\t\u003cimg src=\"https://api.codeclimate.com/v1/badges/5c736ec0fc59f431128c/test_coverage\" /\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e \n\t\u003cimg src=\"https://img.shields.io/npm/v/odi.svg\" /\u003e \n\t\u003cimg src=\"https://img.shields.io/github/license/Odi-ts/Odi.svg\" /\u003e \n\t\u003cimg src=\"https://img.shields.io/depfu/Odi-ts/odi.svg\" /\u003e\n\t\u003cimg src=\"https://img.shields.io/github/last-commit/Odi-ts/Odi.svg\" /\u003e\n\t\u003cimg src=\"https://travis-ci.com/Odi-ts/odi.svg?branch=master\" /\u003e\n\t\u003ca href=\"https://gitter.im/odiland/community\" target=\"_blank\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/gitter/room/nwjs/nw.js.svg\" /\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\nTypeScript framework for creating enterprise-grade (web) applications with simple and minimalistic API, that allows you to focus on business logic. Based on declarative and imperative programming, inspiried by [ASP.NET](https://www.asp.net/) / [Spring](https://spring.io/). \n\n**Check [Docs](https://odi.gitbook.io/core/basics/getting-started) for more details.**\n\nOdi provides feature set for creation of easy supportable and scalable web applications.\n\nFeatures Overview:\n - [x] MVC\n - [x] Full-typed DI / IoT\n - [x] Authentication\n - [x] WebSockets\n - [x] TypeORM integration\n - [ ] GraphQL\n - [ ] AOP\n - [ ] SSR\n \nFor future updates check [Roadmap](https://github.com/Odi-ts/Odi/wiki/Roadmap) \u003cbr\u003e\nGot an idea, proposal or feature request? Feel free to [Submit](https://odi.nolt.io/) it!\n\n[![Edit Odi](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/pjov89947x)\n  \n## 🚀 Getting Started \n1. Install npm package\u003cbr/\u003e\n  `npm install odi --save`\n\n2. Install reflect-metadata \u003cbr/\u003e\n\t `npm install reflect-metadata --save`\n\t\n3. Import reflect-metadata (for example in  `index.ts`):\u003cbr/\u003e\n\t `import \"reflect-metadata\";`\n\t\n4. Enabled the following settings in `tsconfig.json`\n\t```json\n\t\"emitDecoratorMetadata\":  true, \n\t\"experimentalDecorators\":  true\n\t```\n\n## 🌪 Overview\n\n### Controller\nControllers serve as a simple yet powerful routing mechanism in a minimalistic style.\n\n```typescript\n@Controller('foo') \nexport class FooController extends IController {      \n        \n    @RoutePatch('{id}')     \n    bar(id: string, payload: FooDTO) {         \n        ...some updates..          \n        return Ok();     \n    } \n\n    @Get index() {\n        return 'Foo';\n    }\n} \n```\n\nSo, as you see, there no need to provide any additional param decorators for injection data from the HTTP request. It's just a small controller overview, there are a lot of other possibilities.You can read more in [docs](https://odi.gitbook.io/core/basics/controller).\n\n\n### Dependency Injection\nOdi has powerful dependency injection mechanism out of the box. \n(Let's imagine that we already have `FooRepository`)\n\n```typescript\n//foo.service.ts\n@Service()\nexport class FooService {\n​\n    @Autowired()\n    repository: FooRepository;\n​\n    public getFoo(id: string) {\n        return this.repository.findOne(id);\n    }​\n}\n\n\n//foo.controller.ts\n@Controller('foo')\nexport class OrderController extends IController {\n​\n    @Autowired()\n    fooService: OrderService;\n    \n    @Get async '{id}' (id: string) {\n        const foo = this.fooService.getFoo(id);\n        \n        if(!foo)\n            return NotFound();\n\n        return foo;\n    }​\n} \n```\n\nAs you can see, all dependencies will be automatically provided to all application components.\n\nCurrently, Odi support 3 ways of injection: \n* By constructor\n* By property\n* By method\n\nClasses that are not Odi components can participate in DI. You can simply define behaviour with preset properties and constructor args.\n\n```typescript\nclass Pet {\n    ...\n}\n\n​define(Pet)\n    .set('default', {\n        constructorArgs: [...],        \n        props: {...},\n        type: 'singleton'\n    })\n    .set('special', {\n        constructorArgs: [...],        \n        props: {...},\n        type: 'scoped'\n    });\n```\n### DTO\nIt's a common scenario when web server should validate data before processing. DTO can optimize and automate this process.\n\n```typescript\n@Data()\nexport class TodoDTO {\n   \n    @MaxLength(80)\n    title: string;\n    \n    @IsOptional()\n    @MaxLength(255)\n    desctiption: string;\n}\n```\n\nThen, DTO class should be added as an argument for the controller method\n\n```typescript\n@Controller('todo')\nexport class TodoController extends IController {\n\n    @Autowired()\n    todoService: TodoService;   \n     \n    @Post async index(payload: TodoDTO) {\n        ...\n    }​\n}\n```\nAnd it's all! Odi will automatically inject the validated request body in this argument. If there are some errors during validation, 400 status code will be sent with errors description.\n\nOdi provides a wide set for DTO description, supporting nested DTOs, arrays, enums and etc.\n\n### To Sum up\nIt was a small overview of some features. If you interested in more, check the [Docs](https://odi.gitbook.io/core/).\n\n \n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOdi-ts%2Fodi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOdi-ts%2Fodi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOdi-ts%2Fodi/lists"}