{"id":26649986,"url":"https://github.com/redraskal/gateway","last_synced_at":"2025-06-22T03:38:34.330Z","repository":{"id":179279095,"uuid":"662976071","full_name":"redraskal/gateway","owner":"redraskal","description":"Experimental Bun web framework.","archived":false,"fork":false,"pushed_at":"2024-08-21T03:19:29.000Z","size":90,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-22T03:39:52.801Z","etag":null,"topics":["bun","framework","http-server","typescript","web"],"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/redraskal.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2023-07-06T09:35:28.000Z","updated_at":"2024-08-21T03:19:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"e3b24f13-423d-4fde-9144-671f9a346820","html_url":"https://github.com/redraskal/gateway","commit_stats":null,"previous_names":["redraskal/gateway"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redraskal%2Fgateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redraskal%2Fgateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redraskal%2Fgateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redraskal%2Fgateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redraskal","download_url":"https://codeload.github.com/redraskal/gateway/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245383042,"owners_count":20606265,"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","framework","http-server","typescript","web"],"created_at":"2025-03-25T01:50:45.792Z","updated_at":"2025-03-25T01:50:46.388Z","avatar_url":"https://github.com/redraskal.png","language":"TypeScript","readme":"# Gateway\n\n**This is a work in progress. The API is subject to change until a stable version is released.**\n\n## Features:\n\n- Server-side rendered HTML (SSR)\n- [Next.js-style filesystem router](https://bun.sh/docs/api/file-system-router) (pages/)\n- Class-based routes\n- JSON responses on all routes via application/json Accept header\n- JSON file routes (example: /articles/bun.json)\n- Automatic JSON error responses\n- Zod Request body parsing (zod())\n- Static file serving \u0026 caching (public/)\n- Optional entrypoint (src/index.ts)\n- Optional 404 page (pages/404.ts)\n- Route file generator via CLI (bun gen)\n\n```ts\nimport { type Data, Route, html, parse } from \"gateway\";\n\nexport default class implements Route {\n\tasync data(req: Request) {\n\t\t// parse JSON or form Request body\n\t\tconst data = await parse\u003c{\n\t\t\tname: string;\n\t\t}\u003e(req);\n\t\treturn {\n\t\t\ttime: new Date(Date.now()).toLocaleString(),\n\t\t\tname: data?.name || \"world\",\n\t\t\t_secret: \"yes\", // omitted in JSON responses\n\t\t};\n\t}\n\n\thead(data: Data\u003cthis\u003e) {\n\t\treturn html`\u003ctitle\u003eHello ${data.name}!\u003c/title\u003e`;\n\t}\n\n\tbody(data: Data\u003cthis\u003e) {\n\t\treturn html`\n\t\t\t\u003ch1\u003eHello ${data.name} at ${data.time}!\u003c/h1\u003e\n\t\t\t\u003cform method=\"post\"\u003e\n\t\t\t\t\u003clabel for=\"name\"\u003eName\u003c/label\u003e\n\t\t\t\t\u003cinput type=\"text\" id=\"name\" name=\"name\" autofocus required /\u003e\n\t\t\t\t\u003cinput type=\"submit\" value=\"Submit\" /\u003e\n\t\t\t\u003c/form\u003e\n\t\t`;\n\t}\n}\n```\n\n## To install Bun:\n\n```bash\ncurl -fsSL https://bun.sh/install | bash\n```\n\n## To create a project:\n\n```bash\nbun create redraskal/gateway-template {dir}\n```\n\n## To run a development server:\n\n```bash\nbun dev\n```\n\n## To run a production server:\n\n```bash\nbun start\n```\n\n## Environmental variables:\n\n| Name                | Description                                | Default                                       |\n| ------------------- | ------------------------------------------ | --------------------------------------------- |\n| GATEWAY_HOSTNAME    | HTTP server hostname                       | 0.0.0.0                                       |\n| GATEWAY_PORT        | HTTP server port                           | 3000                                          |\n| GATEWAY_ENV         | Environment                                | prod with `bun start`, dev with `bun run dev` |\n| GATEWAY_DEBUG       | console.debug output                       | false                                         |\n| GATEWAY_CACHE_TTL   | Cache-Control max age                      | 3600                                          |\n| GATEWAY_JSON_ERRORS | Whether to output errors in JSON responses | true                                          |\n\n## To generate a route:\n\n```bash\nbun gen {name}\n\nbun gen test\n# or\nbun gen test.ts\n# 📝 pages/test.ts created.\n```\n\nThe new route will automatically open in Visual Studio Code.\n\nThis project was created using `bun init` in bun v0.6.13. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredraskal%2Fgateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredraskal%2Fgateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredraskal%2Fgateway/lists"}