Work in progress boilerplate for a website with Rust/Axum/SQLx backend and HTMX frontend.
The example application is based on the one in https://hypermedia.systems
-
Use
rustupto install the latest stable Rust toolchain:rustup update stable -
Use
cargoto build and run the server:cargo run
-
Install the SQLx command line tool:
cargo install sqlx-cli -
Use it to create a new migration script:
sqlx migrate add -r <DESCRIPTION> -
Migrate the database:
sqlx migrate run
-
Recreate and migrate the database:
sqlx database drop -y && sqlx database create && sqlx migrate run -
Save query metadata for offline usage:
cargo sqlx prepare --workspace
If DATABASE_URL is defined, SQLx will continue building against a database.
To force building in offline mode, set the SQLX_OFFLINE environment variable to true.
If you want to make this the default, add it to your .env file.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as below, without any additional terms or conditions.
Copyright © 2023 Scott J Maddox
Licensed under the BSD Zero Clause License. See LICENSE file in the project root, or https://opensource.org/licenses/0BSD for full license information.
The SPDX license identifier for this project is 0BSD.