Creating a blog engine
Part 1 - Building the basic project foundation
October 28, 2024
So while developing my blog engine, I decided it might be fun to kind of treat it like a tutorial. Now tutorial might be an over statement since I can't say I am doing everything the exact right way, so guess we can call it a "building adventure". The more I have messed around with Blazor since they introduced Server Side Rendering in .NET 8, the more I have started to enjoy it. With that being said, that is the technology I have decided to use in order to create this blog engine. The tech stack I am using is
- .NET 8 (but will be upgrading to 9 in a later blog post) since 8 was the official release at the time
- Will utilize Server Side Rendering for a lot of main blog components
- Am going to mess around with WASM for any client side elements (currently I have only created one page for my blog editing)
- beercss for the styling
- Am going to stick with SQL Server for the database, even though it might be complete overkill for what I need
- Instead of hosting on Azure, I use Mochahost for my hosting provider since I haven't been able to justify the cost of Azure for my pet projects
All of the source will be available on github and I will be creating branches for most (if not all) of my blog posts.
Ok, with that being said, let's kick off this blog post with the basic project structure foundation. For starters, I work with an amazing individual who pointed me in the direction of Central Package Management, so a lot of the basis of this project structure can be found here. Based on these "Bost" practices, I have created an initial project structure that looks something like
BlogEngine
- Directory.Build.props - this holds the common information across all my projects like what version of .net and csharp I am targeting as well as if I want nullability enabled.
- Directory.Build.targets - this is just a place holder for me right now, but wanted to make sure I mimicked the files that were listed in the github repo I mentioned
- Directory.Packages.props - this holds all the package version information. The thing I like about this is that instead of getting into a situation where packages get upgraded and I have to go from project to project in order to make sure I have upgraded them all, this file is the central location for all the package versions I am using and then in the individual csproj files, it just holds a reference to the package without any versioning.
- global.json - to make sure I own the runtime of my project, I am a fan of running multiple version of .net and don't always the latest for each project
- src
- BlogEngine.Server - for the moment this is just an empty web project, but it will eventually hold all the elements that will comprise of the Server Side Rendering of our blog engine as well as any APIs we end up writing to support our Client side functionality when we add it
As mentioned above, all of this code can be found on my github project site, but if you want to see exactly what code was written for just this first part, take a look at the branch 1-create-base-project-structure.