{"id":13430522,"url":"https://github.com/giraffe-fsharp/Giraffe","last_synced_at":"2025-03-16T05:31:17.979Z","repository":{"id":39261597,"uuid":"78293270","full_name":"giraffe-fsharp/Giraffe","owner":"giraffe-fsharp","description":"A native functional ASP.NET Core web framework for F# developers.","archived":false,"fork":false,"pushed_at":"2024-11-29T21:11:44.000Z","size":2045,"stargazers_count":2128,"open_issues_count":48,"forks_count":266,"subscribers_count":66,"default_branch":"master","last_synced_at":"2024-12-02T00:41:51.666Z","etag":null,"topics":["aspnet-core","dotliquid","dotnet","dotnet-core","fsharp","giraffe","http-handler","micro-framework","middleware","model-view-presenter","template-engine","web-framework"],"latest_commit_sha":null,"homepage":"https://giraffe.wiki","language":"F#","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/giraffe-fsharp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-07T17:31:24.000Z","updated_at":"2024-12-01T15:39:29.000Z","dependencies_parsed_at":"2023-02-02T22:30:54.641Z","dependency_job_id":"af634b8d-5173-4540-82f2-ea2b8eec055b","html_url":"https://github.com/giraffe-fsharp/Giraffe","commit_stats":{"total_commits":1002,"total_committers":109,"mean_commits":9.192660550458715,"dds":0.4001996007984032,"last_synced_commit":"9770699b75f73ca662d95372aa0c2d71011ce0d3"},"previous_names":["dustinmoris/giraffe","dustinmoris/aspnetcore.lambda"],"tags_count":88,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraffe-fsharp%2FGiraffe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraffe-fsharp%2FGiraffe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraffe-fsharp%2FGiraffe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraffe-fsharp%2FGiraffe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giraffe-fsharp","download_url":"https://codeload.github.com/giraffe-fsharp/Giraffe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830912,"owners_count":20354848,"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":["aspnet-core","dotliquid","dotnet","dotnet-core","fsharp","giraffe","http-handler","micro-framework","middleware","model-view-presenter","template-engine","web-framework"],"created_at":"2024-07-31T02:00:54.873Z","updated_at":"2025-03-16T05:31:17.963Z","avatar_url":"https://github.com/giraffe-fsharp.png","language":"F#","readme":"![Giraffe](https://raw.githubusercontent.com/giraffe-fsharp/Giraffe/develop/giraffe.png)\n\n[![NuGet Info](https://img.shields.io/nuget/vpre/Giraffe?style=flat-square)](https://www.nuget.org/packages/Giraffe/)\n![GitHub Workflow Status (event)](https://img.shields.io/github/actions/workflow/status/giraffe-fsharp/Giraffe/build-and-test.yml?branch=master\u0026label=Build%20master\u0026style=flat-square)\n\n# Giraffe\n\nA functional ASP.NET Core micro web framework for building rich web applications.\n\nRead [this blog post on functional ASP.NET Core](https://dusted.codes/functional-aspnet-core) for more information.\n\n## Table of contents\n\n- [About](#about)\n- [Getting Started](#getting-started)\n- [Documentation](https://github.com/giraffe-fsharp/Giraffe/blob/master/DOCUMENTATION.md)\n- [Sample applications](#sample-applications)\n- [Benchmarks](#benchmarks)\n- [Building and developing](#building-and-developing)\n- [Contributing](#contributing)\n- [Nightly builds and NuGet feed](#nightly-builds-and-nuget-feed)\n- [Blog posts](#blog-posts)\n- [Videos](#videos)\n- [License](#license)\n- [Contact and Slack Channel](#contact-and-slack-channel)\n- [Support](#support)\n\n## About\n\n[Giraffe](https://www.nuget.org/packages/Giraffe) is an F# micro web framework for building rich web applications. It has been heavily inspired and is similar to [Suave](https://suave.io/), but has been specifically designed with [ASP.NET Core](https://www.asp.net/core) in mind and can be plugged into the ASP.NET Core pipeline via [middleware](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware). Giraffe applications are composed of so called `HttpHandler` functions which can be thought of a mixture of Suave's WebParts and ASP.NET Core's middleware.\n\nIf you'd like to learn more about the motivation of this project please read my [blog post on functional ASP.NET Core](https://dusted.codes/functional-aspnet-core) (some code samples in this blog post might be outdated today).\n\n\u003e [!TIP]\n\u003e Check the [release notes](./RELEASE_NOTES.md) document to know how the system is evolving, and to get more information about breaking changes.\n\n### Who is it for?\n\n[Giraffe](https://www.nuget.org/packages/Giraffe) is intended for developers who want to build rich web applications on top of ASP.NET Core in a functional first approach. ASP.NET Core is a powerful web platform which has support by Microsoft and a huge developer community behind it and Giraffe is aimed at F# developers who want to benefit from that eco system.\n\nIt is not designed to be a competing web product which can be run standalone like NancyFx or Suave, but rather a lean micro framework which aims to complement ASP.NET Core where it comes short for functional developers. The fundamental idea is to build on top of the strong foundation of ASP.NET Core and re-use existing ASP.NET Core building blocks so F# developers can benefit from both worlds.\n\nYou can think of [Giraffe](https://www.nuget.org/packages/Giraffe) as the functional counter part of the ASP.NET Core MVC framework.\n\n## Getting Started\n\n### Using dotnet-new\n\nThe easiest way to get started with Giraffe is by installing the [`giraffe-template`](https://www.nuget.org/packages/giraffe-template) package, which adds a new template to your `dotnet new` command line tool:\n\n```\ndotnet new install \"giraffe-template::*\"\n```\n\nAfterwards you can create a new Giraffe application by running `dotnet new giraffe`.\n\nIf you are using dotnet core 2.1.4, you will need to specify the language: `dotnet new giraffe -lang F#`\n\nFor more information about the Giraffe template please visit the official [giraffe-template repository](https://github.com/giraffe-fsharp/giraffe-template).\n\n### Doing it manually\n\nInstall the [Giraffe](https://www.nuget.org/packages/Giraffe) NuGet package*:\n\n```\nPM\u003e Install-Package Giraffe\n```\n\n*) If you haven't installed the ASP.NET Core NuGet package yet then you'll also need to add a package reference to `Microsoft.AspNetCore.App`:\n\n```\nPM\u003e Install-Package Microsoft.AspNetCore.App\n```\n\nAlternatively you can also use the .NET CLI to add the packages:\n\n```\ndotnet add package Microsoft.AspNetCore.App\ndotnet add package Giraffe\n```\n\nNext create a web application and plug it into the ASP.NET Core middleware:\n\n```fsharp\nopen System\nopen Microsoft.AspNetCore.Builder\nopen Microsoft.AspNetCore.Hosting\nopen Microsoft.Extensions.Hosting\nopen Microsoft.Extensions.Logging\nopen Microsoft.Extensions.DependencyInjection\nopen Giraffe\n\nlet webApp =\n    choose [\n        route \"/ping\"   \u003e=\u003e text \"pong\"\n        route \"/\"       \u003e=\u003e htmlFile \"/pages/index.html\" ]\n\ntype Startup() =\n    member __.ConfigureServices (services : IServiceCollection) =\n        // Register default Giraffe dependencies\n        services.AddGiraffe() |\u003e ignore\n\n    member __.Configure (app : IApplicationBuilder)\n                        (env : IHostEnvironment)\n                        (loggerFactory : ILoggerFactory) =\n        // Add Giraffe to the ASP.NET Core pipeline\n        app.UseGiraffe webApp\n\n[\u003cEntryPoint\u003e]\nlet main _ =\n    Host.CreateDefaultBuilder()\n        .ConfigureWebHostDefaults(\n            fun webHostBuilder -\u003e\n                webHostBuilder\n                    .UseStartup\u003cStartup\u003e()\n                    |\u003e ignore)\n        .Build()\n        .Run()\n    0\n```\n\nInstead of creating a `Startup` class you can also add Giraffe in a more functional way:\n\n```fsharp\nopen System\nopen Microsoft.AspNetCore.Builder\nopen Microsoft.AspNetCore.Hosting\nopen Microsoft.Extensions.Hosting\nopen Microsoft.Extensions.DependencyInjection\nopen Giraffe\n\nlet webApp =\n    choose [\n        route \"/ping\"   \u003e=\u003e text \"pong\"\n        route \"/\"       \u003e=\u003e htmlFile \"/pages/index.html\" ]\n\nlet configureApp (app : IApplicationBuilder) =\n    // Add Giraffe to the ASP.NET Core pipeline\n    app.UseGiraffe webApp\n\nlet configureServices (services : IServiceCollection) =\n    // Add Giraffe dependencies\n    services.AddGiraffe() |\u003e ignore\n\n[\u003cEntryPoint\u003e]\nlet main _ =\n    Host.CreateDefaultBuilder()\n        .ConfigureWebHostDefaults(\n            fun webHostBuilder -\u003e\n                webHostBuilder\n                    .Configure(configureApp)\n                    .ConfigureServices(configureServices)\n                    |\u003e ignore)\n        .Build()\n        .Run()\n    0\n```\n\nFor more information please check the official [Giraffe documentation](https://github.com/giraffe-fsharp/Giraffe/blob/master/DOCUMENTATION.md).\n\n## Sample applications\n\n### Demo apps\n\nThere is a few sample applications which can be found in the [`samples`](https://github.com/giraffe-fsharp/samples) GitHub repository. Please check the `README.md` there for further information.\n\n### Live apps\n\n#### dusted.codes\n\nMy personal blog [https://dusted.codes](https://dusted.codes) is also built with Giraffe and ASP.NET Core and all of the [source code is published on GitHub](https://github.com/dustinmoris/DustedCodes) for further reference.\n\nMore sample applications will be added in the future.\n\n## Benchmarks\n\nGiraffe is part of the [TechEmpower Web Framework Benchmarks](https://www.techempower.com/benchmarks/#section=test\u0026runid=a1843d12-6091-4780-92a6-a747fab77cb1\u0026hw=ph\u0026test=plaintext\u0026l=hra0hp-1\u0026p=zik0zj-zik0zj-zijocf-5m9r) and will be listed in the official results page in the upcoming Round 17 for the first time.\n\nUnofficial test results are currently available on the [TFB Status page](https://tfb-status.techempower.com/).\n\nAs of today Giraffe competes in the Plaintext, JSON and Fortunes categories and has been doing pretty well so far, even outperforming ASP.NET Core MVC in Plaintext and JSON at the time of writing.\n\nThe latest implementation which is being used for the benchmark tests can be seen inside the [TechEmpower repository](https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/FSharp/giraffe).\n\nGiraffe is also featured in [Jimmy Byrd](https://github.com/TheAngryByrd)'s [dotnet-web-benchmarks](https://github.com/TheAngryByrd/dotnet-web-benchmarks) where we've run earlier performance tests.\n\n## Building and developing\n\nGiraffe is built with the latest [.NET Core SDK](https://www.microsoft.com/net/download/core), which works on Windows, macOS and Linux out of the box.\n\nYou can either install [Microsoft Visual Studio](https://www.visualstudio.com/vs/) or [JetBrains Rider](https://www.jetbrains.com/rider/) which both come with the latest .NET Core SDK or manually download and install the [.NET Core SDK](https://www.microsoft.com/net/download/core) and use the .NET CLI or [Visual Studio Code]() with the [Ionide]() extension to build and develop Giraffe.\n\nThe easiest way to build Giraffe is via the .NET CLI.\n\nRun `dotnet build` from the root folder of the project to restore and build all projects in the solution:\n\n```\ndotnet build\n```\n\nRunning `dotnet test` from the root of the project will execute all test projects referenced in the solution:\n\n```\ndotnet test\n``` \n\n## Contributing\n\nHelp and feedback is always welcome and pull requests get accepted.\n\n### TL;DR\n\n- First open an issue to discuss your changes\n- After your change has been formally approved please submit your PR **against the master branch**\n- Please follow the code convention by examining existing code\n- Add/modify the `README.md` as required\n- Add/modify unit tests as required\n- Please document your changes in the upcoming release notes in `RELEASE_NOTES.md`\n- PRs can only be approved and merged when all checks succeed (builds on Windows and Linux)\n\n### Discuss your change first\n\nWhen contributing to this repository, please first discuss the change you wish to make via an [open issue](https://github.com/giraffe-fsharp/Giraffe/issues/new) before submitting a pull request. For new feature requests please describe your idea in more detail and how it could benefit other users as well.\n\nPlease be aware that Giraffe strictly aims to remain as light as possible while providing generic functionality for building functional web applications. New feature work must be applicable to a broader user base and if this requirement cannot be sufficiently met then a pull request might get rejected. In the case of doubt the maintainer might rather reject a potentially useful feature than adding one too many. This measure is to protect the repository from feature bloat and shall not be taken personally.\n\n### Code conventions\n\nWe use [Fantomas](https://fsprojects.github.io/fantomas/docs/index.html) to ensure consistent code formatting across the project. Before committing, format your code by running the following command:\n\n```bash\ndotnet fantomas src samples tests\n```\n\n### Keep documentation and unit tests up to date\n\nIf you intend to add or change an existing `HttpHandler` then please update the `README.md` file to reflect these changes there as well. If applicable unit tests must be added or updated and the project must successfully build before a pull request can be accepted.\n\n### Submit a pull request against master\n\nThe `master` branch is the main and only branch which should be used for all pull requests. A merge into `master` means that your changes are scheduled to go live with the very next release, which could happen any time from the same day up to a couple weeks (depending on priorities and urgency).\n\nOnly pull requests which pass all build checks and comply with the general coding guidelines can be approved.\n\nIf you have any further questions please let me know.\n\nYou can file an [issue on GitHub](https://github.com/giraffe-fsharp/Giraffe/issues/new), start a [discussion on GitHub](https://github.com/giraffe-fsharp/Giraffe/discussions), or contact me via [https://dusted.codes/about](https://dusted.codes/about).\n\n## NuGet feed\n\nAll official release packages are published to the official and public NuGet feed.\n\nBuilds triggered by pull requests produce a NuGet package which can be downloaded as an artifact from the individual GitHub action.\n\n## Blog posts\n\n### Blog posts by author\n\n- [Functional ASP.NET Core](https://dusted.codes/functional-aspnet-core)\n- [Functional ASP.NET Core part 2 - Hello world from Giraffe](https://dusted.codes/functional-aspnet-core-part-2-hello-world-from-giraffe)\n- [Evolving my open source project from a one man repository to an OSS organisation](https://dusted.codes/evolving-my-open-source-project-from-a-one-man-repository-to-a-proper-organisation)\n- [Extending the Giraffe template with different view engine options](https://dusted.codes/extending-the-giraffe-template-with-different-view-engine-options)\n- [Announcing Giraffe 1.0.0](https://dusted.codes/announcing-giraffe-100)\n- [Giraffe 1.1.0 - More routing handlers, better model binding and brand new model validation API](https://dusted.codes/giraffe-110-more-routing-handlers-better-model-binding-and-brand-new-model-validation-api)\n\n### Community blog posts\n\n- [Carry On! … Continuation over binding pipelines for functional web](https://medium.com/@gerardtoconnor/carry-on-continuation-over-binding-pipelines-for-functional-web-58bd7e6ea009) (by Gerard)\n- [A Functional Web with ASP.NET Core and F#'s Giraffe](https://www.hanselman.com/blog/AFunctionalWebWithASPNETCoreAndFsGiraffe.aspx) (by Scott Hanselman)\n- [Build a web service with F# and .NET Core 2.0](https://blogs.msdn.microsoft.com/dotnet/2017/09/26/build-a-web-service-with-f-and-net-core-2-0/) (by Phillip Carter)\n- [Giraffe brings F# functional programming to ASP.Net Core](https://www.infoworld.com/article/3229005/web-development/f-and-functional-programming-come-to-asp-net-core.html) (by Paul Krill from InfoWorld)\n- [JSON Web Token with Giraffe and F#](https://medium.com/@dsincl12/json-web-token-with-giraffe-and-f-4cebe1c3ef3b) (by David Sinclair)\n- [WebSockets with Giraffe and F#](https://medium.com/@dsincl12/websockets-with-f-and-giraffe-772be829e121) (by David Sinclair)\n- [Use appsettings in a Giraffe web app](https://www.devprotocol.com/2018/04/19/use-appsettings-in-a-giraffe-web-app.html) (by Jan Tourlamain)\n- [Integrate Azure AD in your Giraffe web app](https://www.devprotocol.com/2018/08/14/integrate-azure-ad-in-your-giraffe-web-app.html) (by Jan Tourlamain)\n- [Web development in F#: Getting started](https://samueleresca.net/2018/04/web-development-in-f-getting-started/) (by Samuele Resca)\n- [Build web service using F# and ASP.NET Core](https://samueleresca.net/2018/04/build-web-service-using-f-and-asp-net-core/) (by Samuele Resca)\n- [Build a Simple Markdown Blog with F# / Giraffe](https://hamy.xyz/labs/2023-12-fsharp-giraffe-markdown-blog) (by Hamilton)\n- [Deserialising JSON in Giraffe](https://www.compositional-it.com/news-blog/deserialising-json-in-giraffe/) (by Joost Kaptein)\n- [How to Build a Fullstack Webapp with F#](https://hamy.xyz/labs/2024-06_build-fsharp-webapp) (by Hamilton)\n- [Build a Simple F# WebAPI with a Data Repository (F# + Giraffe)](https://hamy.xyz/labs/2024-10_simple-fsharp-webapi-data-repo) (by Hamilton)\n\nIf you have blogged about Giraffe, demonstrating a useful topic or some other tips or tricks then please feel free to submit a pull request and add your article to this list as a reference for other Giraffe users. Thank you!\n\n## Videos\n\n- [Getting Started with ASP.NET Core Giraffe](https://www.youtube.com/watch?v=HyRzsPZ0f0k\u0026t=461s) (by Ody Mbegbu)\n- [Nikeza - Building the Backend with F#](https://www.youtube.com/watch?v=lANg1kn835s) (by Let's Code .NET)\n- [Build a Simple Web API with F# + Giraffe](https://www.youtube.com/watch?v=yDBpd07SdHE) (by HAMY LABS)\n- [Pipeline-oriented programming - Scott Wlaschin - NDC Porto 2023](https://www.youtube.com/watch?v=ipceTuJlw-M) (by Scott Wlaschin)\n- [Build a Simple F# WebAPI with a Data Repository (F# + Giraffe)](https://www.youtube.com/watch?v=ZrQtz566xCM) (by HAMY LABS)\n- [Build a Simple Single-File Web API with F# / Giraffe](https://www.youtube.com/watch?v=Q-ogJk1AMgA) (by HAMY LABS)\n- [Build a Simple Markdown blog with F# / Giraffe](https://www.youtube.com/watch?v=XdPiDfVZ6dk) (by HAMY LABS)\n\n## License\n\n[Apache 2.0](https://raw.githubusercontent.com/giraffe-fsharp/Giraffe/master/LICENSE)\n\n## Current maintainers\n\n- [@64J0](https://github.com/64J0)\n- [@dbrattli](https://github.com/dbrattli)\n- [@mrtz-j](https://github.com/mrtz-j)\n\n## Contact\n\nIf you have any further questions feel free to reach out to me via any of the mentioned social media on [https://dusted.codes/about](https://dusted.codes/about)\n\n## Support\n\nIf you've got value from any of the content which I have created, but pull requests are not your thing, then I would also very much appreciate your support by buying me a coffee. Thank you!\n\n\u003ca href=\"https://www.buymeacoffee.com/dustinmoris\" target=\"_blank\"\u003e\u003cimg src=\"https://gist.githubusercontent.com/dustinmoris/8159363be2297ea76333a8b1823fd23c/raw/d93977425ccef3c5de9aeb2852b6d8e93ed50e55/bmac.svg\" alt=\"Buy Me A Coffee\"\u003e\u003c/a\u003e\n","funding_links":["https://www.buymeacoffee.com/dustinmoris"],"categories":["Frameworks, Libraries and Tools","Web Frameworks","Web框架","NET Conf"],"sub_categories":["Functional Programming","GUI - other","Creating Type Providers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiraffe-fsharp%2FGiraffe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiraffe-fsharp%2FGiraffe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiraffe-fsharp%2FGiraffe/lists"}