{"id":15011446,"url":"https://github.com/y0x54a/bunda","last_synced_at":"2025-04-12T03:43:22.020Z","repository":{"id":58033992,"uuid":"529723493","full_name":"y0x54a/bunda","owner":"y0x54a","description":"Bunda (Mother) - A lightweight web framework for the Bun javascript runtime.","archived":false,"fork":false,"pushed_at":"2023-06-04T09:25:01.000Z","size":45,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T23:23:02.856Z","etag":null,"topics":["app","application","bun","bunjs","framework","http","middleware","router","server","web"],"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/y0x54a.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":"2022-08-28T00:04:59.000Z","updated_at":"2024-01-12T18:36:09.000Z","dependencies_parsed_at":"2024-09-24T19:51:47.526Z","dependency_job_id":null,"html_url":"https://github.com/y0x54a/bunda","commit_stats":{"total_commits":25,"total_committers":1,"mean_commits":25.0,"dds":0.0,"last_synced_commit":"0a582d895f4b4ecf3cc1d778b0063756316e06b9"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y0x54a%2Fbunda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y0x54a%2Fbunda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y0x54a%2Fbunda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y0x54a%2Fbunda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/y0x54a","download_url":"https://codeload.github.com/y0x54a/bunda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514222,"owners_count":21116899,"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":["app","application","bun","bunjs","framework","http","middleware","router","server","web"],"created_at":"2024-09-24T19:41:06.729Z","updated_at":"2025-04-12T03:43:22.002Z","avatar_url":"https://github.com/y0x54a.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bunda\n[![NPM Version](https://img.shields.io/npm/v/@y0x54a/bunda)](https://www.npmjs.com/package/@y0x54a/bunda)\n[![CI](https://github.com/y0x54a/bunda/workflows/ci/badge.svg?branch=main)](https://github.com/y0x54a/bunda/actions)\n\nBunda (Mother) - A lightweight web framework for the [Bun](https://bun.sh) javascript runtime.\n\n## Installing\n```sh\nbun add @y0x54a/bunda\n```\n\n## Example\n```ts\nimport {Bunda} from \"@y0x54a/bunda\";\n\nconst app = await Bunda.serve();\n\napp.router.get(\"/\", ctx =\u003e ctx.text(\"Hi!\"));\n```\n\nUsing **StackRouter**\n```ts\nimport {Bunda, StackRouter} from \"@y0x54a/bunda\";\n\nconst app = await Bunda.serve({\n  services: {\n    router: Bunda.classService(StackRouter)\n  }\n});\n\napp.router.use(ctx =\u003e ctx.text(\"Hi!\"));\n```\n\nUsing **PathnameRouter**\n```ts\nimport {Bunda, PathnameRouter} from \"@y0x54a/bunda\";\n\nconst app = await Bunda.serve({\n  services: {\n    router: Bunda.classService(PathnameRouter)\n  }\n});\n\napp.router.use((ctx, next) =\u003e next(ctx));\n\napp.router.get(\"/\", ctx =\u003e ctx.text(\"Hi!\"), [(ctx, next) =\u003e next(ctx)]);\n\napp.router.get(\"/ping\", ctx =\u003e ctx.text(\"Pong!\"));\n```\n\nUsing **FetchHandler**\n```ts\nimport {Bunda, FetchHandler} from \"@y0x54a/bunda\";\n\nconst app = await Bunda.serve({\n  services: {\n    fetchHandler: Bunda.rawService(new FetchHandler({status: 403, message: \"Forbidden\"}))\n  }\n});\n\napp.router.get(\"/ping\", ctx =\u003e ctx.text(\"Pong!\"));\n```\n\nUsing **ErrorHandler**\n```ts\nimport {Bunda, ErrorHandler} from \"@y0x54a/bunda\";\n\nconst app = await Bunda.serve({\n  services: {\n    errorHandler: Bunda.rawService(new ErrorHandler({message: \"Please see your server logs!\"}))\n  }\n});\n\napp.router.get(\"/\", () =\u003e Promise.reject(new Error()));\n```\n\n## API\n\n- ### Bunda\n\n  - **Props**\n\n  - `router`\n\n  - `fetchHandler`\n\n  - `errorHandler`\n\n  - `isServed`\n\n  - `isDevelopment`\n\n  \u003c!-- Container --\u003e\n\n  - `names`\n\n  - `services`\n\n  - **Methods**\n\n  - `constructor({services?})`\n\n  - `serve()`\n\n  - `stop()`\n\n  \u003c!-- Container --\u003e\n\n  - `has(name)`\n\n  - `get(name)`\n\n  - `getIf(name)`\n\n  - `raw(name, value)`\n\n  - `rawIf(name, value)`\n\n  - `class(name, value)`\n\n  - `classIf(name, value)`\n\n  - `factory(name, value)`\n\n  - `factoryIf(name, value)`\n\n  - `register(name, service)`\n\n  - `registers(services)`\n\n  - `registerIf(name, service)`\n\n  - `registersIf(services)`\n\n  - `unregister(name)`\n\n  - `unregisters(names)`\n\n  - `unregisterIf(name)`\n\n  - `unregistersIf(names)`\n\n  - `resolve(name, args?)`\n\n  - `resolveIf(name, args?, retval?)`\n\n  - `create(name, args?)`\n\n  - `createIf(name, args?, retval?)`\n\n  - **Static Methods**\n\n  - `create({services?})`\n\n  - `serve({services?})`\n\n  \u003c!-- Container --\u003e\n\n  - `rawService(value)`\n\n  - `classService(value)`\n\n  - `factoryService(value)`\n\n- ### Context\n\n  - **Props**\n\n  - `container`\n\n  - `request`\n\n  - `state`\n\n  - `url`\n\n  - `method`\n\n  - `headers`\n\n  - `path`\n\n  - `pathname`\n\n  - `query`\n\n  - `queryParams`\n\n  - `search`\n\n  - `searchParams`\n\n  - **Methods**\n\n  - `constructor({container, request, state?})`\n\n  - `redirect(url, status?, headers?, options?)`\n\n  - `response(body, status?, headers?, options?)`\n\n  - `json(json, status?, headers?, options?)`\n\n  - `text(text, status?, headers?, options?)`\n\n  - `html(html, status?, headers?, options?)`\n\n- ### Errinfo\n\n  - **Props**\n\n  - `code`\n\n  - `error`\n\n  - `context?`\n\n  - **Methods**\n\n  - `constructor({code, error, context?})`\n\n  - **Static Props**\n\n  - `FETCH`\n\n  - `ERROR`\n\n  - **Static Methods**\n\n  - `fetch(error, context)`\n\n  - `error(error)`\n\n- ### Url\n\n  - **Props**\n\n  - `scheme`\n\n  - `protocol`\n\n  - `username`\n\n  - `password`\n\n  - `host`\n\n  - `hostname`\n\n  - `port`\n\n  - `path`\n\n  - `pathname`\n\n  - `query`\n\n  - `queryParams`\n\n  - `search`\n\n  - `searchParams`\n\n  - `hash`\n\n  - `fragment`\n\n  - `origin`\n\n  - `href`\n\n  - **Methods**\n\n  - `constructor(url, base?)`\n\n  - `toString()`\n\n  - `toJSON()`\n\n- ### Container\n\n  - **Props**\n\n  - `names`\n\n  - `services`\n\n  - **Methods**\n\n  - `constructor(services?)`\n\n  - `has(name)`\n\n  - `get(name)`\n\n  - `getIf(name)`\n\n  - `raw(name, value)`\n\n  - `rawIf(name, value)`\n\n  - `class(name, value)`\n\n  - `classIf(name, value)`\n\n  - `factory(name, value)`\n\n  - `factoryIf(name, value)`\n\n  - `register(name, service)`\n\n  - `registers(services)`\n\n  - `registerIf(name, service)`\n\n  - `registersIf(services)`\n\n  - `unregister(name)`\n\n  - `unregisters(names)`\n\n  - `unregisterIf(name)`\n\n  - `unregistersIf(names)`\n\n  - `resolve(name, args?)`\n\n  - `resolveIf(name, args?, retval?)`\n\n  - `create(name, args?)`\n\n  - `createIf(name, args?, retval?)`\n\n  - **Static Methods**\n\n  - `rawService(value)`\n\n  - `classService(value)`\n\n  - `factoryService(value)`\n\n- ### Service\n\n  - **Props**\n\n  - `value`\n\n  - `exports`\n\n  - `isResolved`\n\n  - **Methods**\n\n  - `constructor(value)`\n\n  - `resolve(args?)`\n\n  - `create(args?)`\n\n- ### RawService\n\n  - **Props**\n\n  - `value`\n\n  - `exports`\n\n  - `isResolved`\n\n  - **Methods**\n\n  - `constructor(value)`\n\n  - `resolve(args?)`\n\n  - `create(args?)`\n\n- ### ClassService\n\n  - **Props**\n\n  - `value`\n\n  - `exports`\n\n  - `isResolved`\n\n  - **Methods**\n\n  - `constructor(value)`\n\n  - `resolve(args?)`\n\n  - `create(args?)`\n\n- ### FactoryService\n\n  - **Props**\n\n  - `value`\n\n  - `exports`\n\n  - `isResolved`\n\n  - **Methods**\n\n  - `constructor(value)`\n\n  - `resolve(args?)`\n\n  - `create(args?)`\n\n- ### FetchHandler\n\n  - **Props**\n\n  - `status`\n\n  - `message`\n\n  - **Methods**\n\n  - `constructor({status?, message?})`\n\n  - `handle(context)`\n\n- ### ErrorHandler\n\n  - **Props**\n\n  - `status`\n\n  - `message`\n\n  - `fallback`\n\n  - **Methods**\n\n  - `constructor({status?, message?, fallback?})`\n\n  - `handle(errinfo)`\n\n- ### StackRouter\n\n  - **Props**\n\n  - `length`\n\n  - `factories`\n\n  - **Methods**\n\n  - `constructor(factories?)`\n\n  - `use(factory)`\n\n  - `uses(factories)`\n\n  - `unuse(factory)`\n\n  - `unuses(factories)`\n\n  - `handle(context, next)`\n\n- ### PathnameRouter\n\n  - **Props**\n\n  - `path`\n\n  - `routes`\n\n  - `middleware`\n\n  - **Methods**\n\n  - `constructor({path?, routes?, middleware?})`\n\n  - `use(factory)`\n\n  - `uses(factories)`\n\n  - `unuse(factory)`\n\n  - `unuses(factories)`\n\n  - `get(path, factory, middleware?)`\n\n  - `head(path, factory, middleware?)`\n\n  - `post(path, factory, middleware?)`\n\n  - `put(path, factory, middleware?)`\n\n  - `delete(path, factory, middleware?)`\n\n  - `connect(path, factory, middleware?)`\n\n  - `options(path, factory, middleware?)`\n\n  - `trace(path, factory, middleware?)`\n\n  - `patch(path, factory, middleware?)`\n\n  - `register(route)`\n\n  - `registers(routes)`\n\n  - `unregister(route)`\n\n  - `unregisters(routes)`\n\n  - `handle(context, next)`\n\n- ### PathnameRoute\n\n  - **Props**\n\n  - `path`\n\n  - `method`\n\n  - `factory`\n\n  - `middleware`\n\n  - **Methods**\n\n  - `constructor({path, method, factory, middleware?})`\n\n  - `use(factory)`\n\n  - `uses(factories)`\n\n  - `unuse(factory)`\n\n  - `unuses(factories)`\n\n  - `handle(context)`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy0x54a%2Fbunda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fy0x54a%2Fbunda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy0x54a%2Fbunda/lists"}