1. sbt new scala/scala3.g8
2. mkdir server
3. mv src server/
npm create [email protected]
1. -> client
2. -> vanilla
3. -> javascript
cd client
npm install
npm run dev
cd client
npm install -D @scala-js/[email protected]
I Used ScalaJs-ScalablyTyped, I am not 100% sure they are both needed however I blindly installed these plugins, will check later if any of them can be omitted
npm install -S [email protected]
npm install -D @types/[email protected] [email protected]
Have used Medium-ScalaFullstackWebApp example and partially RockTheJvm-ZioFullstackWebApp
Create common dir to keep shared code between server and client
uphold by -common- in build.sbt
Configure multimodule project in build.sbt
uphold by -root- in build.sbt
Configure server
uphold by -server- in build.sbt
Configure client
uphold by -client- in build.sbt
One thing I noticed the way RockTheJvm-ZioFullstackWebApp is configuring the common is most suitable to the way I want it to be the result is clean and easy to understand, try the example from Medium-ScalaFullstackWebApp to observe the difference.
A very good thing I learned from IdiomaticSoft was the aggregate function in multi-module projects.
plugins.sbt
Add the required plugins.
-
Important
Start from the client because, when server is started first, client does not start.
-
Before running Client first time
cd client npm install
-
Run Client
cd client npm run dev
-
Run Server
To publish usesbt publishlocal
but it is not requiredsbt server/run
-
Refresh Client