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.
- dotnet SDK 2.0.0 together with dotnet CLI
- node.js
- yarn
- 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
- Note:
- 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 browsersrc\Server\Program.fs
- server code will be recompiled and re-run in the background
Show template version and available options with : dotnet new SAFE --help
Choose between available Server back-ends:
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
Add Fable.Remoting to the template by specifying --Remoting
(or -R
) parameter:
dotnet new SAFE --Remoting
Additional FAKE targets to bundle and build Docker image:
dotnet new SAFE --Docker
Use NPM instead of default Yarn for JS package management:
dotnet new SAFE --NPM
Refer to Contribution guideline