ServiceStack Templates is available in the ServiceStack.Common NuGet Package:

PM> Install-Package ServiceStack.Common

Or if using .NET Core:

PM> Install-Package ServiceStack.Common.Core

You're now all set to play with ServiceStack Templates! Start by creating and rendering a dynamic page:

var context = new TemplateContext().Init();
var dynamicPage = context.OneTimePage("The time is now: {{ now | dateFormat('HH:mm:ss') }}"); 
var output = new PageResult(dynamicPage).Result;

Evaluating ad hoc templates can also be condensed down to a single line:

var output = context.EvaluateTemplate("The time is now: {{ now | dateFormat('HH:mm:ss') }}");

Configure with ServiceStack

To use Template Pages as a HTML View Engine in ServiceStack, register the TemplatePagesFeature plugin:

public void Configure(Container container)
    Plugins.Add(new TemplatePagesFeature());

Starter Project Templates

The Starter Projects below provide a quick way to get started with a pre-configured ServiceStack Template Web App.

.NET Core 2.1 Boostrap Template

Create a new Templates Website .NET Core 2.1 App with dotnet-new:

    $ npm install -g @servicestack/cli

    $ dotnet-new templates ProjectName
.NET Core Starter Template

ASP.NET v4.5 Boostrap Starter

For ASP.NET v4.5 projects create a new ServiceStack ASP.NET Templates with Bootstrap from the VS.NET Templates in ServiceStackVS VS.NET Extension to create an ASP.NET v4.5 Project using ServiceStack's recommended project structure:

ASP.NET v4.5 Starter Template

WebApp Project Templates

Web Apps is our revolutionary new approach to dramatically simplify .NET Wep App development by using ServiceStack Templates to build entire Websites in a live real-time development workflow without any C# and requiring no development environment, IDE’s or build tools - dramatically reducing the cognitive overhead and conceptual knowledge required for developing .NET Core Websites in a powerful dynamic templating language that's simple, safe and intuitive enough that Web Designers and Content Authors can use.

Bare WebApp

To start with a simple and mininal website, create a new bare-webapp project template:

$ dotnet-new bare-webapp ProjectName

This creates a multi-page Bootstrap Website with Menu navigation that's ideal for content-heavy Websites.

Parcel WebApp

For more sophisticated JavaScript Web Apps we recommended starting with the parcel-webapp project template:

$ dotnet-new parcel-webapp ProjectName

This provides a simple and powerful starting template for developing modern JavaScript .NET Core Web Apps utilizing the zero-configuration Parcel bundler to enable a rapid development workflow with access to best-of-class web technologies like TypeScript that's managed by pre-configured npm scripts to handle its entire dev workflow.

WebApp Examples

View our Example Web Apps to explore different features and see examples of how easy it is to create with Web Apps:

made with by ServiceStack