+++ title = "Plugin-Based Web Application in Dotnet" date = "2024-01-20T00:00:00+00:00" author = "the1mason" authorTwitter = "the0mason" #do not include @ cover = "posts/modular-app/title.svg" tags = ["dotnet", "web", "prototype"] keywords = ["prototype", "dotnet", "guide", "plugins", "plugin-based", "web application", "ASP.NET", "C#", ".NET 8", "Programming", "Software Architecture"] description = "Have you ever thought about making a web application, that could be easily extended by third-party developers? I've been thinking about making this app for a while, so here's my experience..." showFullContent = false readingTime = true hideComments = false draft = false +++ ### Table of Contents - [Introduction](#introduction) # Introduction Have you ever heard of plugins? These are loadable libraries, extending your application. This article is an overview of my plugin-based web application prototype and mechanisms behind it's features as well as my thought process and decision making during development. This article is, essentially, a step by step guide to making your own plugin-based web app prototype. *This article assumes some knowledge of programming and design patterns.* # Problem Self-hosted web applications can solve different problems and be of use to a variety of different people with slightly different needs. For this to work, I think that such an application should provide an option to extend its functionality. This would allow other people to build an ecosystem of different extensions around it. # Choose your stack!  --- **C#** I'm a dotnet developer and I write C# code for living. This project is as much of an excersise for me as it is an interesting design prototype for C#, that hasn't been described in detail as much online. I haven't seen such plugin-based sites written in C#. There are some projects, using plugin based architecture... Well, there's even a [Microsoft Learn Article](https://learn.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support) about building such an app! **Q:** Why would I even bother to write all these posts and making prototypes? Even more: Why would someone be interested in such post? **A:** You see... there's a problem: Neither `learn.microsoft.com` nor any other webside covers dynamically updating web interface with plugins! If you want to learn about it, it's the right place. Also just loading libraries isn't enough because app also has to provide some ways for plugins to interact with it, which is also covered here! --- **MVC with HTMX** ASP.NET MVC is a web framework, that incorporates the MVC design pattern and uses SSR (Server Side Rendering) to serve content. It is a perfect fit for the HTMX library. This is a compact JavaScript library that extends basic HTML by adding some custom attributes just enough to build your app around it. You can distribute events, make AJAX requests and build truly dynamic app by using as little JS as possible.