{"id":21636350,"url":"https://github.com/sangtran-127/kompact","last_synced_at":"2025-09-02T15:03:43.091Z","repository":{"id":250484401,"uuid":"812598266","full_name":"SangTran-127/kompact","owner":"SangTran-127","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-24T16:23:07.000Z","size":2043,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-03T09:43:31.791Z","etag":null,"topics":["backend","decorators","express","metadata","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/SangTran-127.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2024-06-09T10:58:33.000Z","updated_at":"2024-12-24T16:23:11.000Z","dependencies_parsed_at":"2024-09-06T18:16:04.231Z","dependency_job_id":"03d2fe9f-5923-407e-9674-9dc6484703f0","html_url":"https://github.com/SangTran-127/kompact","commit_stats":null,"previous_names":["sangtran-127/kompact","sangtran-127/kompact-js"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SangTran-127/kompact","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SangTran-127%2Fkompact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SangTran-127%2Fkompact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SangTran-127%2Fkompact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SangTran-127%2Fkompact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SangTran-127","download_url":"https://codeload.github.com/SangTran-127/kompact/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SangTran-127%2Fkompact/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273301876,"owners_count":25081105,"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-09-02T02:00:09.530Z","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":["backend","decorators","express","metadata","nodejs","typescript"],"created_at":"2024-11-25T03:32:40.911Z","updated_at":"2025-09-02T15:03:43.068Z","avatar_url":"https://github.com/SangTran-127.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kompact\n\nKompact is a TypeScript backend library for Express that leverages metadata programming using decorators. Inspired by NestJS, it provides a clean and declarative way to define routes, middleware, and request handlers, without using an Inversion of Control (IoC) container.\n\n## Features\n\n- **Decorators for Routes**: Define your Express routes using decorators.\n- **Middleware Support**: Easily attach middleware to your routes.\n- **Request Handlers**: Simplify the process of handling requests and responses.\n- **Metadata Programming**: Utilize metadata to manage route configurations and middleware.\n\n## Installation\n\nYou can install Kompact via cli:\n\n```bash\nnpm install -g kompact-cli\nkompact create \u003cproject-name\u003e\n```\n\n## Usage\n\nHere's an example of how to create a simple Express server using Kompact.\n\n1. Setting Up Your Project\n\nFirst, ensure your tsconfig.json has the following settings enabled:\n\n```json\n{\n  \"compilerOptions\": {\n    \"experimentalDecorators\": true,\n    \"emitDecoratorMetadata\": true,\n    \"target\": \"ES6\",\n    \"module\": \"commonjs\",\n    \"strict\": true,\n    \"esModuleInterop\": true\n  }\n}\n```\n\n2. Example \n   \nController \n\n```ts\nimport {\n  Auth,\n  Controller,\n  CurrentUser,\n  Get,\n  Post,\n  Request,\n  Response,\n} from \"kompact\";\n\n@Controller(\"cat\")\nexport class CatController {\n  @Get()\n  getCat(req: Request, res: Response) {\n    res.send(\"hello, I sent you a cat\");\n  }\n\n  @Auth\n  @Post()\n  addCat(req: Request, res: Response, @CurrentUser user: any) {\n    console.log(user);\n  }\n}\n```\n\nIn app.ts\n\n```ts\nimport { KompactApp } from \"kompact\";\nimport { CatController } from \"@controllers/cat.controller\";\n\nconst app = new KompactApp({\n  controllers: [CatController],\n  authenticator: (req, res, next) =\u003e {\n    // const accessToken = req.headers[\"authorization\"];\n    // if (!accessToken) res.status(401);\n    req.user = {\n      name: \"Sang tran\",\n    };\n    return next();\n  },\n});\n\napp.start(3001, () =\u003e {\n  console.log(`running at ${3001}`);\n});\n```\n\nSorry 😢😢😢😢 I will update the docs later 🙏🙏🙏🙏\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License.\n\nThis `README.md` provides a clear overview of Kompact, including installation instructions, usage examples, and information on how to set up and run the project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsangtran-127%2Fkompact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsangtran-127%2Fkompact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsangtran-127%2Fkompact/lists"}