{"id":27629994,"url":"https://github.com/lionhat-collective/cobain","last_synced_at":"2026-04-21T05:32:32.055Z","repository":{"id":45195955,"uuid":"376491704","full_name":"lionhat-collective/cobain","owner":"lionhat-collective","description":"A (micro) web-framework for Deno. Utilizing function composition and proxies to create a cohesive and fluent web-framework.","archived":false,"fork":false,"pushed_at":"2022-01-01T19:01:11.000Z","size":36,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-11T21:33:02.768Z","etag":null,"topics":["deno","web-framework"],"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/lionhat-collective.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":"2021-06-13T09:07:03.000Z","updated_at":"2023-12-15T22:55:20.000Z","dependencies_parsed_at":"2022-08-30T08:30:49.804Z","dependency_job_id":null,"html_url":"https://github.com/lionhat-collective/cobain","commit_stats":null,"previous_names":["lionhat-collective/slatt"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lionhat-collective/cobain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionhat-collective%2Fcobain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionhat-collective%2Fcobain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionhat-collective%2Fcobain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionhat-collective%2Fcobain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lionhat-collective","download_url":"https://codeload.github.com/lionhat-collective/cobain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionhat-collective%2Fcobain/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264940386,"owners_count":23686243,"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":["deno","web-framework"],"created_at":"2025-04-23T16:17:07.781Z","updated_at":"2026-04-21T05:32:27.024Z","avatar_url":"https://github.com/lionhat-collective.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![cobain](./cobain.svg)\n## A web-framework for Deno\nUtilizing function composition and proxies to create a cohesive and fluent web-framework.\n\n### Todo:\n - [ ] Routing\n   - [ ] Use Proxy for route function\n        ```javascript\n        route(/*...*/).get.post.put\n        // or\n        route(/*...*/).get(/* additional middleware/compositions */).post.put\n        // or\n        route(/*...*/) // =\u003e defaults to \"get\"\n        ```\n - [ ] Custom App State/Context\n - [x] Middleware/Function Composition\n - [x] Server bootstrapping\n - [ ] First-class [Peep](https://github.com/lionhat-collective/peep) support\n\n### Usage:\n```typescript\nimport { pipe } from 'https://deno.land/x/rambda@v6.7.0/pipe.js'\nimport { cobain, router, mount } from './cobain.ts'\nimport type { CobainMiddleware, CobainRequestHandler } from './cobain.ts'\n\nconst middleware: CobainMiddleware = (handler) =\u003e (ctx) =\u003e {\n    console.log(`middleware called`)\n    if (typeof handler !== 'undefined') {\n        console.log(`handler`)\n        return handler(ctx)\n    }\n    ctx.req.respond({ status: 200, body: `MIDDLEWARE` })\n}\n\nconst fallthroughMiddleware: CobainMiddleware = handler =\u003e async ctx =\u003e {\n    if (handler) {\n        console.log(`before:TEST`)\n        await handler(ctx)\n        console.log(`after:Test`)\n    }\n}\n\nconst allUsers: CobainRequestHandler = (ctx) =\u003e {\n    console.log(ctx.local)\n    console.log(`useriso`)\n    ctx.req.respond({ status: 200, body: `hello world ${ctx?.local?.x ?? -1}, ${ctx?.local?.y ?? -1}` })\n}\n\nconst authApp = cobain(\n    fallthroughMiddleware(ctx =\u003e {\n        ctx.req.respond({ status: 200, body: `auth` })\n    })\n)\n\nconst usersRouter = router(route =\u003e [\n    route('/', pipe(\n        fallthroughMiddleware,\n        fallthroughMiddleware,\n    )(allUsers))\n])\n\nconst app = cobain(\n    usersRouter,\n    mount(authApp()),\n)({ port: 3333, hostname: '127.0.0.1' })\n\nawait app.start()\n```\n\n### Attribution:\n[KoaJS](https://github.com/koajs/koa) — Heavily inspired by their work, a lot of the design decisions came from the design of Koa.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionhat-collective%2Fcobain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flionhat-collective%2Fcobain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionhat-collective%2Fcobain/lists"}