Starting project template for Rust Axum backend and Svelte frontend
The svelte-axum-project is a project template for building a Rust Axum backend and Svelte frontend. It provides a simple Single-Page-App (SPA) example and does not use SvelteKit. The project has been updated to version 0.4.2, which includes a migration of axum-sessions to tower-sessions and the removal of a secret key warning due to the migration. The backend has also been updated to version 0.6.20 of axum, 0.5 of axum-sessions, and 0.4 of tower-http. The frontend has been updated to version 2.4.2 of vite-plugin-svelte, 4.0.5 of svelte, and 4.4.5 of vite. Additionally, the backend has made changes to how servedir works for serving front end static assets.
Using Cargo:
cargo install cargo-generatecargo generate jbertovic/svelte-axum-project -n <your-project-name>Using git template:
Using gh cli:
gh repo create --template option to create a new project from the template.Back end - Rust Axum:
cargo run from the parent directory, not inside the “./back_end” folder.Front end - Svelte:
npm run build from inside the “./front_end” directory.Setup:
npm install to download all module dependencies.npm run build to bundle the JS/Svelte code into the public folder.cargo run to start the server from the top level folder.Full-stack build (Linux only):
./build-fullstack.sh.The svelte-axum-project is a project template that provides an example of building a Single-Page-App (SPA) with a Rust Axum backend and Svelte frontend. It includes features such as authorization header middleware, session checking middleware, and examples of using authorization headers and sessions for secure routes. The installation process involves installing NodeJs and Rust, cloning the repository, and running commands to install dependencies and build the project. The template offers flexibility in terms of installation methods and includes a script for building both the backend and frontend concurrently on Linux.