Within this tutorial, you will learn about what I personally consider to be the best 8 open-source .NET packages within the marketplace today. Instead of just recommending the standard packages that you will find in all generic best of .NET lists online, instead, I am focusing more on the fringe.

To make this list more useful, I am only going to include open-source packages within my recommendations. Consequently, this means that everything within this list is free to use and free for you to inspect how the code works under the hood!

I have personally used each package within this list within an enterprise-level project, so I know firsthand that each package can make life a little easier. Why waste time re-inventing the wheel, when you can just take advantage of pre-made open-source packages instead?

I'm hoping that by the end you will learn about a few new packages that are not currently on your radar 🔥🔥🔥

Rebus

If you are working on a project and you need to send messages to other services, Rebus can help. Rebus is a free, open-source service bus that can help alleviate messaging and integration challenges!

In plain talk, a service bus is a middleware that facilitates communication and coordination between different services. Rebus will allow you to send, receive, and route messages more easily between different services. Using a service bus instead of manually implementing this communication code will not only prevent you from writing more code than needed, but it will also help you to promote looser coupling within your architecture as well as increase message reliability!

Next, let us consider why Rebus? First, it has been downloaded over 20 million times, it's feature-rich and it offers extensive documentation and community support to help you get up to speed. Rebus supports various transport providers and frameworks like RabbitMQ, Azure Service Bus, and SQL Server. It also supports serialization using JSON and XML, allowing you to tailor the messaging infrastructure to your specific requirements.

Implementing a bus using #Revus is fairly simple. The code snippet below shows you some of the basics that you will need to master:

If you need to implement a free service bus, this is a great option!

⬇️ Rebus Github ⬇️ Rebus Nuget ⬇️ Rebus Docs


Quartz.NET

Quartz.NET is a scheduling library for managing tasks and job scheduling. If you need to execute jobs at specific times, create recurring tasks, or define complex cron-like expressions, Quartz.NET has you covered. Quartz.NET is built on .NET Core/.Net Standard 2.0 and has been downloaded over 57 million times.

Quartz.NET provides a similar service to Hangfire and some readers might be wondering how this compares. First, Hangfire is only free for non-commercial projects, however, it can cost up to $4,500 per year for a license on a commercial project. Another way to potentially think about the differences is that Quartz.NET is built around a scheduler, while HangFire is built on top of a message queue.

This means that in terms of scheduling options, Quartz.NET wins. The Quartz.NET API provides more advanced scheduling capabilities compared to Hangfire, giving you more fine-grained control over when and how jobs are executed. For a majority of projects, you may never need these more advanced features, as for most jobs a simple fire-and-forget service will Hangfire will meet your minimum requirements, so it is something to be mindful about. See the code snippet below for an example of how simple it can be to implement a job using Quartz:

Hangfire definitely wins on setup simplicity. Hangfire creates its own database tables which it uses to store and schedule jobs. Quartz.NET on the other hand will allow you to connect to different data store providers either using your own code or, using its plug-ing architecture. It has native integrations for stores like Redis, and RavenDB

⬇️ Quartz.NET Github ⬇️ Quartz.NET Nuget ⬇️ Quartz.NET Docs


Polly

If you are working within an architecture where you need to make lots of mission-critical API calls and you consistently encounter connection issues, Polly can help. Polly is a transient-fault-handling library that will allow you to define additional policies and rules when your code needs to make HTTP requests.

Let us say you make an HTTP call to update a remote API, if that call fails, what happens? Using Polly you can add additional rules in these worst-case scenarios, hopefully, making your service more resilient when things go wrong. In production this can be an essential mechanism, to ensure businesses don't lose money and customers are not impacted by technology failures!

Polly has been downloaded over 430.7M times. It supports .NET 6.0, .NET Standard, and 2.0 .NET Framework 4.6.2. In terms of code, Polly supports policies including Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback. Polly uses a fluent syntax meaning it's easier to understand any code that implements it. Another important factor is that Polly operates in a thread-safe manner. The snippet below shows you how easy it is to wrapper a HttpClient call within a Polly policy:

If you need to build a robust application that calls other services, use Polly!

⬇️ Polly Github ⬇️ Polly Nuget ⬇️ Polly Docs


Pulumi

When working on any application within a team, you will need to deploy your code somewhere outside of your local machine. It's 2023, so we should all know the importance of creating automated scripts to create infrastructure as well as scripts to handle the Ci/Cd process automatically. Traditionally to write these scripts you might have used XML, JSON, or YAML to define a step script. Rather than being forced to define steps in config, it is obviously better to define things in code instead. Using code will make implementation easier and more secure. Using code, also allows you to unit-test your Ci/Cd pipeline!

As .NET developers, we will want to use C# code to write these scripts and this is where Pulumi comes into the equation. Pulumi is an open-source infrastructure-as-code package that has been downloaded over 5 million times. Pulumi will allow you to define your infrastructure set-up scripts in a language of your choice. Pulumi supports script creation with a lot of different languages, including C#, Python, GO, Javascript, and more.

In terms of pricing, Pulumi is free for individuals, however, does come with a cost for commercial use. As well as support for lots of programming languages, Pulmi also supports a lot of cloud hosting providers including AWS, Azure, Google Cloud, and Kubernetes. Using the Pulumi SDK means that you can abstract a lot of the specific cloud provider syntax from your set-up code. It also means you can deploy to multiple cloud host vendors pretty easily! Other noteworthy features include a preview mode. In "preview" mode Pulumi shows you what changes will be made to your infrastructure before applying them.

Personally, Pulumi is a must-have on any project, so if you are not using it, give it a try!

⬇️ Pulumi Github ⬇️ Pulumi Nuget ⬇️ Pulumi Docs

Bogus

If you want to increase the odds that you ship bug-free software, you will need to write unit tests. In order to write the best tests possible, you should use as accurate dummy data as possible. This is where Bogus comes into the equation. Bogus is based on an amazing Javascript library called Faker. Bogus provides a bunch of utils that can support generating pretty much any type of test data that you need. Bogus ahs been downloaded over 54 million times and supports C#, F#, and VB.NET.

The reason why Bogus is so amazing is that it ships with such an extensive collection of APIs. You can generate fake data for pretty much any data format you can think of. Its support ranges from the basics like names, addresses, phone numbers, and email addresses. It also supports more obscure data creation like IP addresses, pet names, and even random Lorem Ipsum text. You can see how to generate some of this dummy data within the snippet below:

On top of all this, Bogus has really good documentation, making it easy to find the API call you need. The thing I really like about the docs is that they provide clear examples so you can copy a lot of the code when you need to implement a new API. Bogus is open-source, it has no cost, what is not to live 😊

⬇️ Bogus Github


Dapper

When you need to write code that talks to a database, most developers will automatically opt to use Entity Framework. Entity Framework is extremely useful, however, it is also extremely comprehensive. Comprehensive is good when you have big, complex needs, however, comprehensive also means bloated and overkill for simpler needs,

Whenever you are working on applications with simple data access needs, an alternative option is Dapper.NET. Dapper.NET is a simple Object-Relational Mapping (ORM) library. As Dapper is simpler it's typically a little more performant compared to entity-framework. Dapper.NET supports a variety of database systems, including SQL Server, MySQL, PostgreSQL, and Oracle.

A final note is that if you opt to use Dapper, you will likely want to install Dapper-Extensions as well 😊

⬇️ Download here


FluentValidation and FluentAssertions

I can't finish this post without mentioning these two packages. Over the years I have blogged about these two packages (here and I bring it up here as I really do have used these packages on every project I work on for the last 15 years.

It's a fact that developers spend more time reading code than writing it. No one likes wasting time trying to decipher what a unit test does, so using these packages allows you to structure your validation code and your unit test code in a more human-readable format makes life much easier.

Let's say you shipped some code a year ago. Someone raises a bug and you need to understand what tests have been written for it. Being able to scan your unit tests and your validation code quickly is so much easier when you can read them in sentence format. For proof, check out the two examples below:

Both extensions will take you about 15 minutes to master, and save you countless hours of unneeded confusion. Try it!

⬇️ FluentValidation Github ⬇️ FluentValidation Docs

⬇️ FluentAssertions Github ⬇️ Download here


Happy Coding 🤘