Seed project for Play framework + ScalaJS using React, Apollo client and Sangria. Under the hood it uses:
- GraphQL
- Apollo Client
- Play framework
- Sangria
- Silhouette (Authentication)
- Slinky (React for Scala.js)
- Antd (Components for React)
- Slick with codegen and play-evolutions
-
Docker installed on the dev box. See: https://github.com/frgomes/bash-scripts/blob/master/sysadmin-install/install-docker-ce.sh
-
Node installed on the dev box. See: http://github.com/frgomes/bash-scripts/blob/master/user-install/install-node.sh
-
SBT installed on the dev box See: https://github.com/frgomes/bash-scripts/blob/master/user-install/install-scala.sh
-
Follow the instructions in the file
project/WebClient.scala
. -
If an error at build time appears saying that module
style-loader
cannot be found, runnpm install -g style-loader css-loader
Follow the setup here for IntelliJ support.
-
Make sure you have already built and published locally
apollo-scalajs
according to instructions atproject/WebClient.scala
. -
Start a MySQL container via Docker Compose.
$ docker-compose up -d
Note: Only MySQL is supported at the moment. In order to support other databases, we should have multiple sets of DDLs and evolutions per database vendor.
- Run test cases:
$ sbt clean test
- Runs the server and live reloads changes:
$ sbt run
- Generates a fat jar:
$ sbt assembly
Generates schema.graphql and query/mutation objects for the client. You shouldn't need to use this explicitly.
$ sbt web_client/Compile/managedSources
The default login for the user interface is:
- username: admin
- password: admin
It is created via evolutions, remove it from there if you want to change it. Also if you want to create another one manually there is an app called ManualUserGenerator to do that.
- WebpackDevServer is not used at the moment
- When a new dependency is added to the npmDependencies the bundle.js is not rebuilt.
- The build is slow because some files are not cached (static query generation and two rounds of js bundling) and the dist directory is deleted.
- Add test framework for front-end
- Refetching the queries instead of changing the apollo cache.
https://github.com/shadaj/create-react-scala-app.g8/tree/master/src/main/g8
https://github.com/boosh/play-scalajs-seed/blob/master/build.sbt