This project was bootstrapped with Create Rust App.
- stable Rust
- Diesel CLI
- if using postgres,
cargo install diesel_cli --no-default-features --features postgres
- if using sqlite,
cargo install diesel_cli --no-default-features --features sqlite-bundled
- if using postgres,
- cargo-watch to recompile on change:
cargo install cargo-watch
(allows runningcargo watch -x run -i frontend/
for continuous compilation; see "available scripts")
- In development, the
.env
file is read (use.env.example
for reference) - In production, environment variables are sourced directly
In the project directory, you can run:
Runs the app in development mode and watches for changes. Visit http://localhost:3000 to view it.
Any frontend changes should instantly appear. Backend changes will need to recompile.
Needs cargo-watch
installed, see requirements.
To test/debug issues with the production build, set the debug-assertions
to true
for [profile.dev]
in Cargo.toml
. This way, development-only code paths are discarded and instead, production-only code paths are included.
Alternatively, use cargo run
to run the app in development mode without watching for file changes.
Builds a production-ready build.
Generates the typescript types from rust code marked with tsync
.
Outputs to frontend/src/types/rust.d.ts
.
# frontend
cd frontend && npm && npm start
# backend
cargo watch -x run -i frontend/
-
diesel migration generate <migration_name>
-
diesel migration run
-
diesel migration revert
-
diesel database setup
-
diesel database reset
- Use the mold linker for slightly faster compilation.
docker build -t image-name .
docker run -e SECRET_KEY=123 -e DATABASE_URL=postgres://postgres:postgres@localhost/database -p 3000:3000 image-name