#Script is a simple, fast, highly versatile and embeddable scripting language for .NET Core and .NET Apps that utilizes a familiar expressive Syntax to enable dynamic scripting of .NET Apps via controlled access to pluggable methods and arguments within a sandbox environment - ensuring scripts are encapsulated and developed using clean, reusable and testable components.
Popular Use Cases
These qualities opens #Script 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.
Scripts have access to all built-in Scripts and ServiceStack's which makes it easy to create scripts that run against all supported RDBMS's and cloud agnostic ServiceStack.Aws and ServiceStack.Azure as seen below with the same script below performs adhoc queries against an AWS RDS PostgreSQL managed database and S3 File Storage and an Azure SQL Server Database and Azure Blob File Storage:
The watch mode enables an live REPL which serves as an interactive explanatory playground that's especially useful in scripts where you want instant feedback like viewing the results of live transformations:
One use-case made possible by #Script we're extremely excited about is Sharp Apps - a new approach to dramatically simplify .NET Web App development and provide the most productive development experience possible.
Sharp Apps leverages #Script to develop entire content-rich, data-driven websites in a pure live development model without needing to write any C#, compile projects or manually refresh pages. Checkout the Spirals Sharp App below for a glimpse of the Live Development experience available:
See the Making of Spirals for a walk through on how to create the Spirals Web App from scratch.
The integrated development experience extends to end-to-end to provide a seamless installation and deployment experience where the same web dotnet tool used to develop Sharp Apps is all users need to find and install Apps locally or hosted as a server App where they're easily deployed and hosted on Linux or run within Docker - the overall Sharp Apps experience results in the easiest and fastest way to develop and deploy Web Apps in .NET!
Pure Cloud Apps
Sharp Apps also enable the development of Pure Cloud Apps where the same SharpApp can be developed and run entirely on AWS S3 and RDS or Azure Blob Storage and SQL Server by just changing its app.settings.
View the source code of this Sharp Pages website to see how clean a website built with it is.
In addition to the language, #Script includes a surrounding ecosystem of rich functionality adapting #Script to power a number of fun and exciting scenarios. E.g. Scripts are lazily loaded from its Virtual File System which can be configured to use any of the available Virtual File Systems and is what enables Pure Cloud Apps where entire Sharp Apps could be hosted within your AWS S3 Bucket or Azure Blob Storage.
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, as well as within ASP.NET MVC and ASP.NET Core MVC 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.
#Script scripts are lazily loaded and late-bound for Instant Startup, doesn't require any pre-compilation, coupling to any external configuration files, build tools, designer tooling or have any special deployment requirements. It can be used as a general purpose scripting or templating language to generate any text format and includes built-in support for .html.
Similar to Vue.js Components, Sharp Script's are evaluated in an Encapsulated Sandbox that enables fine-grained control over exactly what functionality and instances are available to different Scripts. They're pre-configured with a comprehensive suite of safe Default Scripts which when running in trusted contexts can easily be granted access to enhanced functionality.
#Script is 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.
We believe we've only scratched the surface of what's possible with #Script and we'd love to see what new use-cases it can help achieve and help encourage an ecosystem of pluggable and reusable scripts, #Script is being developed in ServiceStack.Common which is a free library for commercial or non-commercial use.