{"id":18828538,"url":"https://github.com/asenajs/asena","last_synced_at":"2025-09-10T08:08:59.839Z","repository":{"id":256191789,"uuid":"849374895","full_name":"AsenaJs/Asena","owner":"AsenaJs","description":"IoC web framework for bun","archived":false,"fork":false,"pushed_at":"2025-03-04T22:02:46.000Z","size":622,"stargazers_count":32,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T17:11:25.647Z","etag":null,"topics":["bun","hono","ioc","ioc-framework","typescript-framework","web-framework","websockets"],"latest_commit_sha":null,"homepage":"","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/AsenaJs.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":"2024-08-29T13:36:23.000Z","updated_at":"2025-03-13T16:37:43.000Z","dependencies_parsed_at":"2024-11-07T23:24:25.999Z","dependency_job_id":"81be31d8-df27-45a1-9668-5ece871cf9ea","html_url":"https://github.com/AsenaJs/Asena","commit_stats":null,"previous_names":["asenajs/asena"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsenaJs%2FAsena","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsenaJs%2FAsena/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsenaJs%2FAsena/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsenaJs%2FAsena/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AsenaJs","download_url":"https://codeload.github.com/AsenaJs/Asena/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813796,"owners_count":21165634,"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":["bun","hono","ioc","ioc-framework","typescript-framework","web-framework","websockets"],"created_at":"2024-11-08T01:30:41.650Z","updated_at":"2025-09-10T08:08:59.806Z","avatar_url":"https://github.com/AsenaJs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asena\n\nAsena is a NestJS-like IoC web framework built on top of Bun. It combines the power of dependency injection\nwith the performance of Bun runtime and the flexibility of Adapter design system.\n\n## Documentation\n\nFor detailed documentation, please visit [not ready yet](https://asena.sh). Documentation is still in progress, but updates are being made regularly. You can check this project [AsenaExample](https://github.com/LibirSoft/AsenaExample). I am always updating it to latest usages.\n\n## Key Features\n\n- **Dependency Injection**: Built-in IoC container for managing dependencies\n- **Decorator-based Development**: Similar to NestJS, using TypeScript decorators for routing and DI\n- **High Performance**: Leverages Bun runtime for optimal performance\n- **WebSocket Support**: Built-in WebSocket handling capabilities\n- **Middleware System**: Flexible middleware architecture\n- **HTTP Adapters**: Extensible adapter system with Hono as default\n- **Zero Dependencies**: Only uses reflect-metadata for dependency injection\n- **TypeScript Support**: Full TypeScript support with strict mode\n- **Modular Architecture**: Easy to extend and customize\n\n## Quick Start\n\nThe easiest way to create a new Asena project is using the CLI:\n\n```bash\n# Create a new project\nbun add -D @asenajs/asena-cli\nasena create\n```\n\nThis will create a new project with the following structure:\n\n```\n├── src/\n│ ├── controllers/\n│ │ └── AsenaController.ts\n│ └── index.ts\n├── package.json\n├── tsconfig.json\n├── .eslintrc.js\n├── .eslintignore\n└── .prettierrc.js\n```\n## Alternative start\n\n\nAlternatively, you can create a project manually:\n\nFirst, create a new project using Bun:\n\n```bash\nbun init\n```\n\nFor decorators working properly, you need to add some settings to your tsconfig. Here is a recommended file:\n\n```json\n{\n  \"compilerOptions\": {\n    // Enable latest features\n    \"lib\": [\"ESNext\", \"DOM\"],\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"moduleDetection\": \"force\",\n    \"jsx\": \"react-jsx\",\n    \"allowJs\": true,\n    \"experimentalDecorators\": true,\n    \"emitDecoratorMetadata\": true,\n\n    // Bundler mode\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": true,\n    \"noEmit\": true,\n\n    // Best practices\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"noFallthroughCasesInSwitch\": true,\n\n    // Some stricter flags\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noPropertyAccessFromIndexSignature\": true\n  }\n}\n```\nAfter that you need to make sure to edit your tsConfig.json it should look like this\nThen, install these packages:\n* `@asenajs/asena`: Base package\n* `@asenajs/hono-adapter`: For web-server. Asena currently only support hono adapter.\n* `@asenajs/asena-logger`: For better logs\n```bash\nbun install @asenajs/asena @asenajs/hono-adapter @asenajs/asena-logger\n```\n\n* `@asenajs/asena-cli`: This package provides a CLI for creating and managing Asena projects.\n\n```bash\nbun install -D @asenajs/asena-cli\n```\nAfter installation, you need to create asena-config.ts file you can create it with asena-cli\n\n```bash\nasena init\n```\nthis will create you asena-config file.\n\n`Note`: Built options directly copy of bun options, you can check bun documentation for more\noptions. [Bun Documentation](https://bun.sh/docs/bundler#reference)\n\nCreate index.ts file under your src folder:\n\n```typescript\n// src/index.ts\nimport {AsenaServer} from '@asenajs/asena';\nimport {createHonoAdapter} from '@asenajs/hono-adapter';\nimport {logger} from './logger/logger';\n\nconst [honoAdapter,asenaLogger] = createHonoAdapter(logger);\n\n\nawait new AsenaServer(honoAdapter, asenaLogger).port(3000).start();\n```\n\nTo run asena you need at least one controller. Create a new controller:\n\n```typescript\n// src/controllers/TestController.ts\nimport type { Context } from '@asenajs/hono-adapter';\nimport { Controller } from '@asenajs/asena/server';\nimport { Get } from '@asenajs/asena/web';\n\n@Controller('/hello')\nexport class TestController {\n  @Get('/world')\n  public async getHello(context: Context) {\n    return context.send('Hello World');\n  }\n}\n```\n\nFinally, run the project:\n\n```bash\n## only for fast developing purposes\nasena dev start\n```\n\n```bash\n## or you can simply build then run your bundled project\nasena build\n## then go to dist folder and run the project this way it will consume less memory and it will be faster.\nbun index.asena.js\n```\n\n## CLI Commands\n\nFor more information about CLI commands and usage, please visit:\n[Asena CLI Documentation](https://asena.sh/docs/cli/overview.html)\n\n## Project Structure\n\n```\nlib/\n├── adapter/     # HTTP adapter implementations\n├── server/      # Core server functionality\n├── ioc/         # Dependency injection container\n├── utils/       # Utility functions\n├── test/        # Test utilities\n```\n\n## Core Concepts\n\n- **Controllers**: Handle incoming requests using decorators\n- **Services**: Business logic containers that can be injected\n- **Middleware**: Request/Response interceptors\n- **WebSocket**: Built-in WebSocket support\n- **HTTP Status**: Standard HTTP status codes and utilities\n\n## Performance\n\nBuilt on Bun runtime, Asena provides:\n\n- Fast startup time\n- Low memory footprint\n- Quick request processing\n- Efficient WebSocket handling\n\nHere is the benchmark result of Asena with Hono adapter (Basic hello world example) in every test we used bun to run\nthe project:\n\n### Performance Comparison (Fastest to Slowest)\n\n| Framework                            | Requests/sec | Latency (avg) | Transfer/sec |\n| ------------------------------------ | ------------ | ------------- | ------------ |\n| Hono                                 | 147,031.08   | 2.69ms        | 18.09MB      |\n| Asena + Hono-adapter                 | 137,148.80   | 2.89ms        | 16.74MB      |\n| NestJS (Bun + Fastify)               | 81,652.05    | 6.01ms        | 13.78MB      |\n| NestJS (Bun)                         | 64,435.83    | 6.14ms        | 11.80MB      |\n| NestJS (Bun + kiyasov/platform-hono) | 45,082.27    | 8.79ms        | 5.55MB       |\n| NestJS (Node)                        | 17,649.89    | 24.43ms       | 4.02MB       |\n\n\u003e Benchmark conditions:\n\u003e\n\u003e - 12 threads\n\u003e - 400 connections\n\u003e - 120 seconds duration\n\u003e - Simple \"Hello World\" endpoint\n\u003e - Running on same hardware\n\n_Note: Lower latency and higher requests/sec indicate better performance_\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 - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\nIf you encounter any issues or have questions, please open an issue on the [GitHub repository](https://github.com/AsenaJs/Asena/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasenajs%2Fasena","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasenajs%2Fasena","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasenajs%2Fasena/lists"}