My modern development stack

One of the things I do outside of my day job is to build web applications for small businesses. I wanted to share the dev stack I do that in, and why I choose them

Platform

I use .NET Core as my development platform. It’s a modern cross platform framework for building applications. It runs on Windows, Linux, and was natively designed to run in Docker without a lot of effort, and actually has officially supported base Docker images.

Data Access

Data is a complicated piece of the puzzle in any application and can be split up into data storage and application level data access.

For applications that run on AWS or other Linux native environments, I generally go with Postgres for the database and on Windows I generally lean towards Microsoft SQL Server (the Express Edition for most projects since 10 GB is generally more than they’ll ever need)

Inside the application, most of the querying is done using Entity Framework Core, a new ORM developed by Microsoft that handles automatic change tracking and transaction management. If I need to, I’ll combine it with Dapper, which is a micro-ORM for mapping the inputs and outputs of raw SQL queries to models developed by the folks over at StackExchange.

Server-Side Framework

If you guessed ASP.net Core, you are a winner! Natively co-developed with .NET Core, its a powerful, high performance web framework. Shipping with the framework is native Identity management, Powerful MVC framework natively supporting REST, Powerful HTML template language when needed (Razor), and also native development and production support for SPA frameworks such as Angular, React, Vue.js, etc..

Inversion of Control / Dependency Injection

While .NET Core (and by proxy, ASP.net Core) has a built-in IoC container, it’s very simple. However, its designed to be replaced natively by a more powerful container, and supplies abstractions for applications (and libraries) to consume so they aren’t tied directly to the built in container

For new applications, I generally go with Lamar, which was built from the ground up on these abstractions. For older applications, I generally use StructureMap. I will probably try to move those applications to Lamar eventually, since Lamar fixed the memory issues that plagued it, and StructureMap is officially deprecated in favor of Lamar.

Server-Side Validations

ASP.net MVC actually has built in support for model validations (i.e., submitted data actually validates), but it’s not nearly as powerful as I’d like. Instead, I use FluentValidation, which actually integrates with ASP.net MVC and will run before the native validations by default. It’s flexible, integrates with the built in IoC abstractions, and supports async custom validators

CQRS (Command and Query Responsibility Separation)

This is a pattern that I fell in love with a few years back. The general idea is that instead of a bunch of services that combine querying data and commands to update data, you separate them into separate pieces, and potentially use models best suited for the task.

For that, I use MediatR, which is a great little lightweight project.

 

 

 

Leave a Reply

Your email address will not be published.