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.

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 three 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.

Remoting

Configures the SAFE app to use Fable.Remoting to the template. 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 --remoting

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.

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 --remoting
  • Create a SAFE application using Giraffe with Fulma: dotnet new SAFE --server giraffe --layout fulma-landing