Validation and Auth Examples using Server HTML + Ajax Forms, jQuery, TypeScript, Vuetify, Sharp Pages and Razor Pages.
This app showcases ServiceStack's API First Development model where its pure APIs are unopinionated as to which UI or client are consuming them yet is able to support multiple UI rendering strategies including server HTML Rendered and Ajax Client forms, multiple View Engines, multiple layouts - all utilizing the same Service and declarative Fluent Validation. With no additional effort the same APIs are automatically available to Mobile and Desktop Apps.
From Server HTML generated server controls, flexible JS-enhanced custom HTML to client Ajax forms with built-in auto-binding available in either built-in jQuery plugin or dependency-free "Vanilla JS" TypeScript library that's easily consumed from both TypeScript or JavaScript Apps and can seamlessly integrate with high-level UI frameworks like Vuetify.
All productive development options also have access to the rich ecosystem around ServiceStack Services including Add ServiceStack Reference for developing end-to-end Typed APIs for all popular Mobile and Desktop platforms. This App makes use of the TypeScript support to generate its Typed dtos.ts - benefiting TypeScript code-bases with compile-time safety and JavaScript code-bases from rich intelli-sense in IDEs that support TypeScript declarations.
Contacts Service is demonstrative of a typical Auth-enabled App, with Login and Registration forms, protected pages and Services and Simple UI's for entering personal contacts for Authenticated users. All Source Code is available in the Validation GitHub project.
All Auth Configuration is encapsulated within a "no-touch" IConfigureAppHost plugin that's run once on Startup:
All Services and Validators used in this App. Extension methods are used to DRY reusable code and a Custom Auto Mapping handles conversion between the Contact Data Model and Contact DTO:
The dynamic App data used within ServiceStack Sharp Pages and Razor pages are maintained within Custom ContactScripts and RazorHelpers:
Typed Request/Response Service Contracts including Data and DTO models that utilizes Enum's: