Questions tagged [safe-stack]

The SAFE stack is an open-source, free, flexible end-to-end, functional-first stack for cloud-ready web applications that emphasizes type-safe programming.

The SAFE stack allows you to develop web applications almost entirely in F#, without needing to compromise and shoehorn your codebase into an object-oriented framework or library, and without needing you to be an expert in CSS or HTML to create compelling, rich client-side web applications.

The SAFE stack is made up of four components:

  • A web server running on .NET Core for hosting back-end services in F#
  • A hosting platform that provides simple, scalable deployment models plus associated platform services for application developers
  • A mechanism to run F# in the web browser for client-side delivery of F#
  • An F# programming model for client-side user interfaces

More information is available at:

SAFE stack

Documentation

Introducing the SAFE stack

22 questions
8
votes
2 answers

How to handle redirects to auth provider from the backend in Fable Elmish SPA

I have an AspNetCore backend api (in F# with Giraffe) that uses AzureAD authentication with Microsoft.AspNetCore.Authentication.AzureAD.UI, with stateful session store, and https only cookies. The frontend is an Elmish SPA compiled to js with…
Balinth
  • 548
  • 4
  • 10
5
votes
6 answers

Fable.React - editing an Input field moves cursor to end of text

I'm working with the Elmish.Bridge flavor of the SAFE stack. At the top level of the view, I create an input field like this: Input.input [ Input.Value(model.FieldValue); Input.OnChange(fun e -> dispatch (EditFieldValue(e.Value))) ] When I edit…
Overlord Zurg
  • 3,430
  • 2
  • 22
  • 27
4
votes
1 answer

How to properly force HTTPS in SAFE-Stack?

As per Saturn docs, to have HSTS in Saturn, one needs to specify force_ssl in the application: application { url ("http://0.0.0.0:" + port.ToString() + "/") force_ssl ... } This works for the deployed version of the web, however it…
psfinaki
  • 1,814
  • 15
  • 29
3
votes
1 answer

F# SAFE how to deal with growth of message DU variants?

In F# SAFE stack there is a DU type, which defines all types of messages flowing between server and client. In sample application there are <10 of them, I looked on provided examples - all of them have not many possible types. But what if the…
Michael Snytko
  • 327
  • 3
  • 13
3
votes
1 answer

HMR - Update failed: SyntaxError: Unexpected token < in JSON at position 0

I'm working in a Elmish application. I put in place SSR (server-side rendering) for the index page only as I need some dynamically generated initial state at the start of the application. Since the Hot module replacement is not working and it is…
sabotero
  • 4,265
  • 3
  • 28
  • 43
3
votes
1 answer

How to access and use user secrets in a saturn application

Edit: here are some adaptions to the answer by Koenig Lear,in case someone else stumbles upon this question: to add user secrets to the application i used this code, where the ID used by config.AddUserSecrets is the secrets id that gets added to the…
kMutagene
  • 177
  • 10
3
votes
0 answers

Using the Saturn Framework, how can I get a reference to the Websockets hub outside of a particular request?

I'm building an application for a toy problem to learn more about SAFE. I have some background processes running server-side and occasionally they need to send a message unprompted to the connected clients. This means that I need a reference to the…
3
votes
2 answers

How to import an image in Fable?

I already have all the webpack loaders, so all I need to do is this, but in F#: import loading from "../images/loading.gif"; This should be an easy thing, I am just lost in the docs and I mostly find info about [] attribute which seems to…
psfinaki
  • 1,814
  • 15
  • 29
2
votes
1 answer

Login in a multi-page website (SAFE Stack)

Does anybody use the Elmish routing for a multi-page app (SAFE Stack in my case) as specified by Maxime Mangel here on StackOverflow , but with a login page? Do you, at the same time, use the accessibility (Anonymous/LoggedIn) philosophy as…
2
votes
1 answer

Entity Framework NullReferenceException on second migration

I am using entity framework in an F# project (SAFE-stack) and I can create the initial migration, but when I try to do another migration it fails with a NullReferenceException. I'm on a SAFE-template 3.1.1, but if I add entity framework to a new…
Espen Brun
  • 103
  • 7
2
votes
0 answers

Authentication redirect uri uses http instead of https when deployed in docker container

I am trying to deploy a SAFE-stack application with AzureAD authentication to Azure inside docker. I got authentication to work when deploying with the build script that deploys directly to azure (dotnet fake run -t azure). But when I deploy the app…
Espen Brun
  • 103
  • 7
2
votes
2 answers

SAFE-stack with github authorization

I am trying to hide my whole application behind a authentication (I'll deal with authorization when this works), and for now I want to every url to require github login. I am not getting the github login page up. I have tried to combine the…
Espen Brun
  • 103
  • 7
2
votes
2 answers

How do I solve encoder problem with the Elmish Debugger?

I've got an application that I've built in SAFE-Stack using websockets, more or less following the approach here: https://github.com/CompositionalIT/safe-sockets It works fine but the Elmish debugger doesn't like the type of WsSender in this…
1
vote
2 answers

SAFE Stack - installing pre-requisites

The SAFE Stack Documentation says to install npm (amongst other things) as a pre-requisite to build SAFE apps. But the link refers to https://www.npmjs.com where you have to search for packages. But which ones? What to install? There are thousands…
1
vote
1 answer

SAFE Stack authentication with Azure AD B2C user flows (or custom policies) -- Has anyone solved this?

Straightforward but open-ended question: Has anyone succeeded in wiring up a SAFE Stack application to Azure AD B2C such that guest users (in the B2C tenant) can sign-in, via defined user flow or custom policy? Specific question that could enable me…
1
2