Welcome, I am a static .NET website!


1. Introduction

The aim of this web application is to demonstrate the functionalities of the Static Site Generator tool.

The Static Site Generator has the goal of allowing ASP.NET Core developers to generate static (client-side only) web applications, while allowing them to reuse the concepts and tools they are already familiar with: Partial Views, Tag Helpers, Layouts, and so on.

This should facilitate using free/cheap hosting without forcing developers to learn JavaScript SPA frameworks, but also without forcing them to handle individual HTML files which would require them to duplicate a lot of code.

The Static Site Generator is free, Open-Source Software, and you can use it for any personal/commercial purposes, under the conditions of the MIT license.

2. Using the Static Site Generator

Using the tool should be quite straightforward for simple scenarios:

  1. First, you write your application using ASP.NET Core MVC (Razor Pages not currently supported).
  2. Then, you install the tool from NuGet:
    dotnet tool install TerevintoSoftware.StaticSiteGenerator.Tool
  3. The tool can then be ran using the ssg command on a CLI (Windows and Linux tested), which will provide on-screen help for the available parameters.
  4. Finally, you just need to copy the output of the tool to your hosting provider (in this case of this website, Azure Storage Static Websites!).

3. Use cases / hosting options

The tool can be used in a number of different scenarios, although its main purpose is to facilitate free or extremely cheap hosting options.

1. For static websites

For small applications, like a static blog, a resume page, a company site, and so on. The output of the tool can be server for free or very cheaply in several hosting options, like Azure Static Websites, Azure Blob Storage, AWS S3, Google Firebase, Netlify, etc.

2. For static websites with some dynamic functionality

If you want to have a mainly static website with only some dynamic functionality, like a contact form for example, my recommendation would be to have the frontend be static, and then use a free or cheap serverless backend. For example:

An image that shows different hosting options using AWS, Azure and Firebase.
Notice: We are not affiliated with any of these providers nor endorse any of these options in particular. These are just examples based on public information as of June 2022.
3. For dynamic websites

For mainly dynamic websites, such as web applications (stores, blogs with comments, etc.), this tool could be used in 2 ways:

On one hand, you could first start with a static website using this tool, while the dynamic parts of the website are created, so as to avoid costs during development. This would allow you to continue using ASP.NET Core MVC without doing anything special!

On the other hand, you could split the application into backend and frontend, and use client-side technologies (like vanilla JavaScript) for the dynamic parts, such as calling the HTTP APIs. This would allow you to remove load from the server as the client can be hosted statically.

Depending on current and future needs, however, you may want to consider other frameworks too. For c#, that would mean looking at Blazor, for example.

4. Improving the Static Site Generator

This tool is currently supported by a single developer (hi!), so there are obviously flaws/bugs, things that can be improved, and functionality that could be added.

For example, getting URLs correctly generated is quite puzzling . If you want to help, you can do so by:

  1. Helping out with the documentation (code and features).
  2. Adding more unit tests.
  3. Improving this website (I'm on GitHub).
  4. Suggesting features.
4.1. Known limitations

Currently, this tool does not provide support for: Models (when passed into Views), Areas, localization, and possibly other MVC client-side functionality. This also doesn't support Razor Pages, although it should be possible to support it if help is provided.