This template provides a full stack rust application, using rocket
in the backend and seed
in the frontend.
The project is split into 3 subprojects:
backend
- Implements the server side using therocket
web framework.frontend
- Implments the frontend usingseed
,bootstrap
andscss
, packaged together usingwebpack
.shared
- Is a dependency of bothbackend
andfrontend
and allows sharing code between them. Specifically it is useful to share structs which are serialized usingserde
.
We include a small build tool called wasp. From your package manager make sure you have rustup
and npm
installed.
$ rustup update
$ rustup target add wasm32-unknown-unknown
$ ./wasp setup
Simply run:
$ ./wasp build
This will build backend, frontend and package everything together with webpack. It can then be used either using:
$ ./wasp run
Or just by running
$ cd backend
$ cargo run
The build tool also provides an automatic rebuild in case files were changed on the drive. It will automatically rebuild the frontend
and backend
projects as required and restart the webserver. Run it with:
$ ./wasp watch
Note that this depends upon having pyinotify
installed and running linux.
It is possible to create prebuilt zip-package for deployment with all files relevant files included using:
$ ./wasp release
The compiled package will be ready in build/prod.zip
.
There are deployment files ready in the deploy
folder.
We make use of nginx
to serve static files and as reverse proxy to invoke backend
.
The deploy.sh
shell script gives a reference of all the required steps to deploy the app.