/SAFE-template

dotnet CLI template for SAFE project

Primary LanguageF#MIT LicenseMIT

SAFE template

A dotnet CLI template for SAFE-Stack projects.

This is a basic template to get started with 3 core components of the stack:

The template does not include any Azure / other Cloud integration. Refer to SAFE-Bookstore to see an example of deploying to Azure and for more details about this stack.

Prerequisites

Using the template

  • Install or update the template: dotnet new -i SAFE.Template
  • Create a new project from the template: dotnet new SAFE -lang F#
    • Note: -lang F# or --language F# is currently required, due to CLI issue
  • Build and run the project: build.cmd run / ./build.sh run. This command:
    • Fetches all necessary dependencies
    • Builds Server and Client code
    • Runs dotnet fable webpack-dev-server in src/Client (note: the Webpack development server will serve files on http://localhost:8080)
    • Runs dotnet watch run in src/Server (note: Suave is launched on port 8085)
    • Opens browser with url to Webpack development server (5 second delay after running client)

Now you can edit:

  • src\Client\Client.fs - changes will be automatically refreshed in browser
  • src\Server\Program.fs - server code will be recompiled and re-run in the background

Template options

Show template version and available options with : dotnet new SAFE --help

Server

Choose between available Server back-ends:

Fulma

Add Fulma to the template:

  • none - don't add Fulma (Fable bindings for Bulma.io) at all
  • basic - adds Fulma basic template dotnet new SAFE --Fulma basic
  • hero - adds Fulma with 'Hero' Bulma template dotnet new SAFE --Fulma hero
  • landing - adds Fulma with 'Landing' Bulma template dotnet new SAFE --Fulma landing

Fable.Remoting

Add Fable.Remoting to the template by specifying --Remoting (or -R) parameter:

dotnet new SAFE --Remoting

Docker

Additional FAKE targets to bundle and build Docker image:

dotnet new SAFE --Docker

NPM

Use NPM instead of default Yarn for JS package management:

dotnet new SAFE --NPM

Contributing

Refer to Contribution guideline