TODO: This document outlines the basic process for building the site, but does not include enough information to go through step by step and have a working website. The goal is to eventually have enough information here to allow people to work on the site or fix bugs, etc.
cargo leptos build --release
Will generate a server binary in target/server/release
and a site package in target/site
Most tests are unit tests and can be run with
cargo leptos test
We have no E2E tests at the moment, but they are set up and can be run as well
cargo leptos end-to-end
cargo leptos end-to-end --release
cargo-leptos uses Playwright as the end-to-end test tool.
Tests are located in end2end/tests
directory.
After running a cargo leptos build --release
the minimum files needed are:
- The server binary located in
target/server/release
- The
site
directory and all files within located intarget/site
Copy these files to your remote server. The directory structure should be:
this-week-in-bevy
site/
Set the following environment variables (updating for your project as needed):
LEPTOS_OUTPUT_NAME="this-week-in-bevy"
LEPTOS_SITE_ROOT="site"
LEPTOS_SITE_PKG_DIR="pkg"
LEPTOS_SITE_ADDR="127.0.0.1:3000"
LEPTOS_RELOAD_PORT="3001"
Finally, run the server binary.
sqlx checks all queries at compile time. This presents some challenges for how to enable that without allowing full database access. cargo sqlx prepare
will write out a .sqlx
file that can be checked into the repository for testing purposes.
This prepare
command has to be run by someone with database access to re-generate the metadata files when the database schema is changed.
DATABASE_URL=mysql://127.0.0.1:3306 op run --no-masking -- cargo sqlx prepare -- --features ssr