{"id":14155355,"url":"https://github.com/zarfjs/zarf","last_synced_at":"2025-07-29T10:44:13.090Z","repository":{"id":56975643,"uuid":"525458727","full_name":"zarfjs/zarf","owner":"zarfjs","description":"Fast, Bun-first Web API framework with full Typescript support.","archived":false,"fork":false,"pushed_at":"2022-10-12T17:32:44.000Z","size":1357,"stargazers_count":82,"open_issues_count":6,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-22T23:36:50.253Z","etag":null,"topics":["bun","framework","http","typescript","web"],"latest_commit_sha":null,"homepage":"https://zarf.netlify.app","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/zarfjs.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}},"created_at":"2022-08-16T16:25:59.000Z","updated_at":"2025-05-13T23:16:01.000Z","dependencies_parsed_at":"2022-08-21T11:50:46.211Z","dependency_job_id":null,"html_url":"https://github.com/zarfjs/zarf","commit_stats":null,"previous_names":["bun-tea/bun-tea"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/zarfjs/zarf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarfjs%2Fzarf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarfjs%2Fzarf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarfjs%2Fzarf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarfjs%2Fzarf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zarfjs","download_url":"https://codeload.github.com/zarfjs/zarf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarfjs%2Fzarf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266775354,"owners_count":23982273,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["bun","framework","http","typescript","web"],"created_at":"2024-08-17T08:02:56.736Z","updated_at":"2025-07-29T10:44:13.040Z","avatar_url":"https://github.com/zarfjs.png","language":"TypeScript","funding_links":[],"categories":["Extensions","web"],"sub_categories":["Frameworks"],"readme":"# Zarf\nFast, Bun-powered, and Bun-only(for now) Web API framework with full Typescript support.\n\n## Quickstart\nStarting with `Zarf` is as simple as instantiating the `Zarf` class, attaching route handlers and finally starting the server\n```ts\nimport { Zarf } from \"@zarfjs/zarf\"\n\nconst app = new Zarf()\n\napp.get(\"/hello\", (ctx) =\u003e {\n    return ctx.json({\n        hello: \"hello\"\n    })\n})\n\napp.get(\"/\", (ctx) =\u003e {\n    return ctx.html(`Welcome to Zarf App server`)\n})\n\napp.listen({\n    port: 3000\n}, (server) =\u003e {\n    console.log(`Server started on ${server.port}`)\n})\n```\n## App and Routing\nRoutes are how you tell where/when/what to respond when somebody visits your app's URLs, and `@zarfjs/zarf` lets you easily register routes, with all the commonly used HTTP verbs like `GET`, `POST`, `PUT`, `DELETE`, etc.\n\nHere's how you'd define your app routes -\n\n```ts\n// GET\napp.get(\"/posts\", (ctx) =\u003e {\n    return ctx.json({\n        posts: [/* all of the posts */]\n    })\n})\n\n// POST\napp.post(\"/posts\", async(ctx) =\u003e {\n    const { request } = ctx\n    const body = await request?.json()\n    // ... validate the post body\n    // ... create a post entry\n    return ctx.json(body)\n})\n\n// PUT\napp.put(\"/posts/:id\", async(ctx, params) =\u003e {\n    const { request } = ctx\n    const id = params.id\n    const body = await request?.json()\n    // ... validate the post body\n    // ... upadte the post entry\n    return ctx.json(body)\n})\n\n// DELETE\napp.del(\"/posts/:id\", async(ctx, params) =\u003e {\n    const id = params.id\n    // ... validate the del op\n    // ... delete the post entry\n    return ctx.json({ deleted: 1 })\n})\n\n```\n## Routing: Context\n`Context` available as the first argument to your route handlers is a special object made available to all the route handlers which\n- lets you access vaious details w.r.t `Request` object\n- provides convenience methods like `json`, `text`, `html` to send `Response` to the client\n\nThe most accessed/useful object could be the `Request` object itself(available at `ctx.request`), but it offers few other methods too\n- `setHeader`\n- `setType`\n- `setVary`\n- `isType`\n- `accepts`\nto determine things about the current request, or change few things about the response that's send to the client.\n\n## Routing: Params\n`Params` is the second argument available to your route handlers, that lets you access the route parameters easily.\n```ts\napp.get(\"/products/:id\", (ctx, params) =\u003e {\n    // params.id ? //\n    // Pull the details\n    return ctx.json({\n        product: {/* all of the posts */}\n    })\n})\n```\n`@zarfjs/zarf` supports all the common URL patterns you'd expect in a Web-App/API framework\n```ts\napp.get(\"/user/:name/books/:title\", (ctx, params) =\u003e {\n    const { name, title } = params\n    return ctx.json({\n        name,\n        title\n    })\n})\n\napp.get(\"/user/:name?\", (ctx, params) =\u003e {\n    return ctx.json({\n        name: params.name || 'No name found'\n    })\n})\n\n// /admin/feature/path/goes/here\napp.get(\"/admin/*all\", (ctx, params) =\u003e {\n    return ctx.json({\n        supPath: params.all // -\u003e /feature/path/goes/here\n    })\n})\n\n// /v1/nike/shop/uk\n// /v1/nike/uk/shop/shop-at...\napp.get(\"/v1/*brand/shop/*name\", (ctx, params) =\u003e {\n    return ctx.json({\n        params // -\u003e { brand: 'nike', ...},  { brand: 'nike/uk', ...}\n    })\n})\n```\n\n## RoadMap\nA lot of great stuff is actually planned for the project. The Alpha version is majorly focussing on making the core stable and provide all the essential features. Here's snapshot of the [roadmap](https://github.com/users/one-aalam/projects/3/views/1).(private)\n\n\u003cimg src=\"./assets/code/roadmap.png\" alt=\"Zarf Roadmap\" /\u003e\n\n\n\n## Meta\nThe project is developed on\n- OS - MacOS Monterey\n- Bun - v0.1.13\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzarfjs%2Fzarf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzarfjs%2Fzarf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzarfjs%2Fzarf/lists"}