Open mackdunkan opened 2 years ago
If you want to start development with a complete working app as a template, an easy way is to download the contents of this repository and use the example app from implement\example-apps\minimal-backend-hello-world
You can run a server with this command:
elm-fs run-server --public-urls="http://*:5000" --deploy="C:\Users\John\Downloads\elm-fullstack-main\implement\example-apps\minimal-backend-hello-world"
(You can use the Download ZIP
button in the GitHub UI to download the repository or use git clone
)
Thanks for the answer! Can I use this for an online store or blog? I have somewhere around 50 thousand products and about 5 thousand users
Yes, it works for online stores and blogs. Fifty thousand items are within the supported limits.
But another metric to consider is the size of your database. At the moment (with the current implementation), the size of the database is limited to a few hundred MB.
For online stores, you often have images taking up quite some space. Usually, the app does not need to read the contents of these images. It is enough to link to them as static external files. Then you can host them outside the Elm app to avoid them blowing up the Elm database size.
Thanks for the answer and what aisles the number of elements no longer supports? What will happen if the database exceeds the limit? how to deal with SEO for robots, are there any examples?
I will run a test to measure the exact limits of today's implementation. Regarding SEO for robots (crawlers), I recommend https://moz.com/beginners-guide-to-seo/how-search-engines-operate That article also has many examples.
I ran a test and found another important limit for total app state size: App state sizes of more than 166.6 MB will usually crash the server with v2022-03-20.
Therefore elm-fs is not currently fit for that workload.
Restarting a server with v2022-03-20 crashed with this exception:
Application startup exception: System.ArgumentException: The JSON value of length 168831530 is too large and not supported.
at System.Text.Json.ThrowHelper.ThrowArgumentException_ValueTooLarge(Int32 tokenLength)
at System.Text.Json.Serialization.Converters.StringConverter.Write(Utf8JsonWriter writer, String value, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.JsonSerializer.WriteUsingSerializer[TValue](Utf8JsonWriter writer, TValue& value, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.WriteStringUsingSerializer[TValue](TValue& value, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options)
at ElmFullstack.WebHost.PersistentProcess.PersistentProcessLiveRepresentation.AttemptProcessEvent(IProcessWithStringInterface process, AppEventStructure appEvent)
at ElmFullstack.WebHost.PersistentProcess.PersistentProcessLiveRepresentation.RestoreFromCompositionEventSequence(IEnumerable`1 compositionLogRecords, ElmAppInterfaceConfig overrideElmAppInterfaceConfig)
at ElmFullstack.WebHost.PersistentProcess.PersistentProcessLiveRepresentation.LoadFromStoreAndRestoreProcess(IProcessStoreReader storeReader, Action`1 logger, ElmAppInterfaceConfig overrideElmAppInterfaceConfig)
at ElmFullstack.WebHost.StartupAdminInterface.<>c__DisplayClass28_0.<Configure>g__startPublicApp|2()
at ElmFullstack.WebHost.StartupAdminInterface.Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime appLifetime, Func`1 getDateTimeOffset, FileStoreForProcessStore processStoreForFileStore)
It crashes because the current implementation depends on a limit similar to the one discussed at: https://github.com/dotnet/runtime/issues/39953
In our case, it should be MaxCharacterTokenSize
:
https://github.com/dotnet/runtime/blob/55e2378d86841ec766ee21d5e504d7724c39b53b/src/libraries/System.Text.Json/src/System/Text/Json/JsonConstants.cs#L77
Oh thanks for the replies!
Hi!