Skip to content

mishaszu/rust-fullstack-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust

Rust Fullstack Template 🔌 🔋

Backend: actix-web

Frontend: yew

Generate 🎇 🎇 💾

You can use cargo generate tool to generate this template as your workspace:

cargo generate --git https://github.com/mishaszu/rust-fullstack-template.git --branch main

What 📗 📣

This template is an easy way to start developing production-level applications with actix-web & yew.

Actix-web

Features in the template:

  • serving static files
  • support simple get route
  • share API with Frontend
  • serve Frontend as SPA

Port: 8081

Note: In the developer version, the static folder is placed in frontend directory, and in the production version, the static folder is within the backend folder. You can use dev setup to run the server from the workspace root folder, or prod's set up to run it from backend folder.

actix-web examples

actix-web examples

Yew

Remember to install Frontend packages first!

cd frontend && npm install

Features in the template:

  • handles two simple routes
  • passing simple props
  • handling simple get request
  • webpack configured to support SPA application
  • webpack proxy connect to actix-web server
  • webpack outputs CSS files

Port: 8000

Note: To get request backend server has to be turned on.

yew examples:

yew examples

yew router examples


How 📘 📡

You can manually run all commands with cargo run or cargo run -p project_name for BE and npm start etc for FE, or you can use run.sh the file that provides all commands.

Remember to install Frontend packages with npm first (you should do this only once).

cd frontend && npm install

Run Frontend in developer mode. The frontend will be served by webpack and proxied to actix-web server.

  ./run.sh fe run

Build Frontend with webpack and output files to frontend/public

  ./run.sh fe build:dev

Build Frontend with webpack and output file to backend/static

  ./run.sh fe build:prod

Build backend

  ./run.sh be build

Run backend with workspace folder as root.

  ./run.sh be run

Run backend with backend folder as root.

	cd ./backend && cargo run

Run & watch backend with workspace folder as root. You will need cargo-watch

  ./run.sh be watch

Run & watch backend with backend folder as root. You will need cargo-watch

  cd backend && cargo watch -x run

About

A template that helps generate full-stack application with actix-web & yew.

Topics

Resources

License

Stars

Watchers

Forks