My Thoughts on Nancy Web Framework

About 2 months ago, I had a chance to experiment with Nancy (at that time it was version 0.10) for internal office app. In the end we didn’t use Nancy because we decided to integrate the function we want to build to existng web.

Nancy name is taken from Nancy Sinatra, Frank Sinatra’s daughter. So judging by its name we can guess that Nancy web framework is inspired by Sinatra web framework. It is designed to be a lightweight web framework.

Based on my experience with Nancy:

  • It has several hosting options, we can host it in windows service instead of ASP.NET.
  • It is extensible. We can see that there are a lot of Nancy extensions in NuGet repository.
  • It has a built in IoC container, TinyIoC. So far it serves my purpose.
  • It use “module” for registering route and its handler. Module is scanned at application’s start.
  • It supports Razor View. But it lacks of ASP.NET MVC’s HTML Helpers. It is not hard to build our own HTML Helpers but it certainly takes time.
  • It doesn’t have something like ASP.NET MVC’s child action yet.
  • It has Before and After hook for filtering request.
  • It supports “form authentications” mechanism via separate assembly (Nancy.Authentication.Forms). We don’t access it from HttpContext.Current.User but from NancyContext.CurrentUser property.
  • As of version 0.10, its Bind method cant bind complex model.

Overall it is a good alternative for ASP.NET MVC. I have to admit that ASP.NET MVC is more productive for me now, but for creating lightweight web app with .NET, Nancy certainly has appeal.