Fork me on GitHub

ServiceStack Templates

At its core ServiceStack Templates is a simple, fast, and extremely versatile dynamic templating language for .NET and .NET Core that utilizes an Expressive Syntax to compose high-level functionality using .NET filters and arguments.

It's small, lightweight footprint and built-in Hot Reloading provides a fun, clean and productive alternative to MVC Razor that's easily integrated into any web framework and runs identically in every platform ServiceStack runs on, it can also be returned in ASP.NET MVC and ASP.NET MVC Core Controllers - in all cases, using the same high-performance implementation to asynchronously write to a forward-only OutputStream for max performance and maximum potential reuse of your Source Code.

Templates are lazily loaded and late-bound for Instant Startup, doesn't require any pre-compilation, have coupling to any external configuration files, build tools, designer tooling or have any special deployment requirements. It can be used as a general purpose templating language to enhance any text format and includes built-in support for .html.

Templates are evaluated in an Isolated Sandboxed that enables fine-grained control over exactly what functionality and instances are available to different Templates. They're pre-configured with a comprehensive suite of safe Default Filters which when running in trusted contexts can easily be granted access to enhanced functionality.

Templates are designed to be incrementally adoptable where its initial form is ideal for non-programmers, that can gradually adopt more power and functionality when needed where they can leverage existing Services or MVC Controllers to enable an MVC programming model or have .html pages upgraded to use Code Pages where they can utilize the full unlimited power of the C# programming language to enable precise control over the rendering of pages and partials. Code pages take precedence and are interchangeable wherever normal .html pages are requested making them a non-invasive alternative whenever advanced functionality is required.

Surrounding Ecosystem

These qualities opens Templates up to a number of new use-cases that's better suited than Razor for maintaining content-heavy websites, live documents, Email Templates and can easily introspect the state of running .NET Apps where they provide valuable insight at a glance with support for Adhoc querying.

Web Apps

One use-case made possible by Templates we're extremely excited about is Web Apps - a new approach to dramatically simplify .NET Web App development and provide the most productive development experience possible whilst maximizing reuse and component sharing.

Web Apps leverages Templates to develop entire content-rich, data-driven websites without needing to write any C#, compile projects or manually refresh pages - resulting in the easiest and fastest way to develop Web Apps in .NET!

Pure Cloud Apps

Web Apps also enable the development of Pure Cloud Apps where the same Web App can be developed and run entirely on AWS S3 and RDS or Azure Blob Storage and SQL Server by just changing the app.settings that's deployed with the pre-compiled Web App Binary.

Learn ServiceStack Templates

Get started learning ServiceStack Templates by going through the Interactive Guide and creating a Starter Project.

View the source code of this Template Pages generated website to see how clean a website built with it is.

Checkout the Live LINQ examples for a fun Live programming experience to explore its querying features, as a quick preview here's a copy of the first LINQ example you can play with below:

Free for OSS and Commercial Projects

We believe we've only just scratched the surface of what's possible with Templates and we'd love to see what new use-cases it can help achieve and help encourage an ecosystem of pluggable and reusable filters, so whilst ServiceStack is a dual-licensed platform with a commercial license for closed-source projects, the core of Templates is being developed in ServiceStack.Common which is an unrestricted library that's free for OSS and commercial usage.

ServiceStack's existing free-quota restrictions only applies if you're using OrmLite, ServiceStack.Redis or exceed the allowed free-quota of ServiceStack Services.

made with by ServiceStack