Skip to content

SAFE Template overview

The SAFE Template is a dotnet CLI template for SAFE Stack projects, designed to get you up and running as quickly as possible, with flexible options to suit your application.

The template gets you up and running with the most common elements of the stack:

Using the template

Refer to the Quick Start guide to see basic guidance on how to install and use the template.

Examples

  • Create a SAFE application using all defaults:

dotnet new SAFE

  • Create a SAFE application using Giraffe with Fable Remoting:

dotnet new SAFE --server giraffe --communication remoting

  • Create a SAFE application using Giraffe with Fulma 'Landing':

dotnet new SAFE --server giraffe --layout fulma-landing

Template options

The template provides the ability to customise the created application. You can see template version and available options by running dotnet new SAFE --help.

Server

Configures the SAFE app to use one of two different back-end hosting platforms.

Usage: dotnet new SAFE --server <server>

Where <server> is one of:

  • saturn: Creates a SAFE app running on Saturn on top of Giraffe (default).
  • giraffe: Creates a SAFE app running on Giraffe only.

Layout

Configures the SAFE app to apply a CSS Framework to the UI template. Currently supports just Fulma bindings

Usage: dotnet new SAFE --layout <layout>

Where <layout> is one of:

  • none: don't add any CSS framework.
  • fulma-basic: adds Fulma basic template (default).
  • fulma-admin: adds Fulma with the 'Admin' Bulma template.
  • fulma-cover: adds Fulma with the 'Cover' Bulma template.
  • fulma-hero: adds Fulma with the 'Hero' Bulma template.
  • fulma-landing: adds Fulma with the 'Landing' Bulma template.
  • fulma-login: adds Fulma with the 'Login' Bulma template.

Communication

Configures the SAFE app to use one of available means of communication between client and server. Currently supports only Fable.Remoting. If this argument is not supplied, client / server communication will be handled through the standard routing and serialization mechanism of the server. See here for an overview of Fable Remoting and the alternatives for sharing data between client and server.

Usage: dotnet new SAFE --communication <communication model>

Where <communication model> is one of:

  • none: don't add any additional libraries for client-server communication (default)
  • remoting: add Fable.Remoting to the template.

Pattern

Configures Client app to use one of available patterns. Currently supports only either default Elmish architecture with Commands or simple (no Commands) Elmish Architecture with conjunction with Fable.Reaction library for Reactive programming

Usage: dotnet new SAFE --pattern <pattern model>

Where <pattern model> is one of:

  • default: use standard Elmish architecture with Commands (default)
  • reaction: use simple Elmish architecture without Commands + Fable.Reaction for reactive pattern

Deploy

Optionally configures the SAFE app to elements needed for deploying to one of two different hosting models. If this argument is not supplied, no explicit support for any hosting model will be provided.

Usage: dotnet new SAFE --deploy <hosting model>

Where <hosting model> is one of:

JS Deps

Configures the SAFE app to use either Yarn or NPM for JS package management.

Usage: dotnet new SAFE --js-deps <package manager>

Where <package manager> is one of:

  • yarn: uses Yarn for JS package management (default).
  • npm: uses NPM for JS package management.