{"id":16283020,"url":"https://github.com/angelmunoz/bix","last_synced_at":"2025-03-16T13:31:24.928Z","repository":{"id":45816828,"uuid":"514729945","full_name":"AngelMunoz/Bix","owner":"AngelMunoz","description":"Bix, an F# micro-framework for cross-runtime JavaScript backends","archived":false,"fork":false,"pushed_at":"2024-05-22T03:36:57.000Z","size":94,"stargazers_count":32,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-10T07:01:44.785Z","etag":null,"topics":["bun","cloudflare","cloudflare-workers","deno","fable","fable-compiler","framework","fsharp","javascript","node"],"latest_commit_sha":null,"homepage":"","language":"F#","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/AngelMunoz.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":"2022-07-17T02:39:50.000Z","updated_at":"2024-11-12T01:39:00.000Z","dependencies_parsed_at":"2024-10-27T11:09:53.829Z","dependency_job_id":null,"html_url":"https://github.com/AngelMunoz/Bix","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngelMunoz%2FBix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngelMunoz%2FBix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngelMunoz%2FBix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngelMunoz%2FBix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AngelMunoz","download_url":"https://codeload.github.com/AngelMunoz/Bix/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243817094,"owners_count":20352499,"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","cloudflare","cloudflare-workers","deno","fable","fable-compiler","framework","fsharp","javascript","node"],"created_at":"2024-10-10T19:12:20.648Z","updated_at":"2025-03-16T13:31:24.922Z","avatar_url":"https://github.com/AngelMunoz.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[bun.sh]: https://bun.sh\n[deno]: https://deno.land\n[giraffe]: https://giraffe.wiki\n[saturn]: https://github.com/SaturnFramework/Saturn\n[fable]: https://fable.io\n[fable.bun]: https://github.com/AngelMunoz/fable-bun\n[fable.deno]: https://github.com/AngelMunoz/fable-deno\n[cloudflare workers]: https://developers.cloudflare.com/workers/\n\n# Bix\n\n\u003e the \"**_Bix_**\" name is just a _codename_ for now (until I decide it's good to go).\n\n\u003e ## Templates\n\u003e\n\u003e `dotnet new --install Bix.Templates::*`\n\u003e\n\u003e - `dotnet new bix.bun -o BunProject`\n\u003e - `dotnet new bix.cloudflare -o CloudFlareWorker`\n\u003e - `dotnet new bix.deno -o DenoProject`\n\nAn F# microframework that provides a router and http handler abstractions for web frameworks that work with a `Request -\u003e Response` http server model.\n\nExamples of runtimes that work with this model:\n\n- [Bun.sh] -\u003e [Fable.Bun] + Bix.Bun\n- [Deno] -\u003e [Fable.Deno] + Bix.Deno\n- Service Workers\n  - [Cloudflare Workers] -\u003e Bix.Cloudflare\n  - Browser Service Worker\n\nThis microframework is heavily inspired by [Giraffe], and [Saturn] frameworks from F# land so if you have ever used that server model then Bix will feel fairly similar.\n\nAn hypotetical example could be like the following code:\n\n```fsharp\n// define a function that takes HttpHandlers to satisfy existing handler constrains\nlet authenticateOrRedirect (authenticatedRoute: HttpHandler, notAuthenticatedRoute: HttpHandler) =\n    Handlers.authenticateUser\n        authenticatedRoute\n        notAuthenticatedRoute\n\n// compose different handlers for code reusability\n// and granular control of handler execution\nlet checkAdminCredentials successRoute =\n    authenticateOrRedirect (successRoute, Admin.Login)\n    \u003e=\u003e Handlers.requiresAdmin\n\nlet checkUserCredentials successRoute =\n    authenticateOrRedirect (successRoute, Views.Login)\n    \u003e=\u003e Handlers.requiresUserOrAbove\n\n// define routes for this application\nlet routes =\n    // check the Cloud flare Worker sample/tempalte to see other router options\n    // basic, giraffe, and saturn like\n    Router.Empty\n    |\u003e Router.get(\"/\", authenticateOrRedirect \u003e=\u003e Views.Landing)\n    |\u003e Router.get (\"/login\", authenticateOrRedirect \u003e=\u003e Views.Login)\n    |\u003e Router.get (\"/me\", checkUserCredentials(Views.Login))\n    |\u003e Router.get (\"/portal\", checkUserCredentials(Views.Portal))\n    |\u003e Router.get (\"/admin\", checkAdminCredentials(Admin.Portal))\n    |\u003e Router.post (\"/users\", checkAdminCredentials(Api.Users.Create \u003e=\u003e negotiateContent))\n    |\u003e Router.patch (\"/users/:id\", checkAdminCredentials(Api.Users.Update \u003e=\u003e negotiateContent))\n\n// Start the web server\nServer.Empty\n|\u003e Server.withPort 5000\n|\u003e Server.withDevelopment true\n|\u003e Server.withRouter routes\n|\u003e Server.run\n```\n\nThe idea is to create simple and single purposed functions that work like middleware so you can organize and re-use\n\n## Adapters\n\nBix currently has two adapters\n\n- Bix.Deno\n- Bix.Bun\n\nAdapters under investigation:\n\n- Bix.ServiceWorker\n- Bix.CloudflareWorker\n\n# Development\n\nThis project is developed with VSCode in Linux/Windows/WSL but either rider, and visual studio should work just fine.\n\n## Requirements\n\n- .NET6 and above - https://get.dot.net\n- Bun - [bun.sh] - (in case of running bun)\n- Deno - [deno] - (in case of running deno)\n\n## Try the samples\n\nDepending on what you want to try change the directory to your selected sample, example: `cd samples/Bix.Bun.Sample` and run one of the following commands\n\n1. `dotnet tool restore` (run once per clone)\n2. start the project\n   - `bun start`\n   - `deno task start`\n\nboth commands will restore the projects and run fable, bun/deno in watch mode.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangelmunoz%2Fbix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangelmunoz%2Fbix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangelmunoz%2Fbix/lists"}