This is a monorepo containing a fullstack application with Rust (backend, WASM) and SolidJS (frontend) components.
- Rust
- Node.js (for frontend)
- wasm-bindgen-cli
cargo install wasm-bindgen-cli - sqlx-cli
cargo install sqlx-cli - mailtutan
cargo install mailtutan
To test email functionality locally, you can use mailtutan, a simple SMTP server for development
mailtutan --ip 127.0.0.1This will start a local SMTP server on port 1025 by default.
Configure your .env or server launch to use 127.0.0.1:1025 as the SMTP relay.
npm installnpm run dev -w @zahash/authnpm run build -w @zahash/authThe output will be in the fullstack/auth-ui/dist folder.
Set the DATABASE_URL environment variable
export DATABASE_URL="sqlite://some/path/data.db"$env:DATABASE_URL="sqlite://some/path/data.db"set DATABASE_URL=sqlite://some/path/data.dbThen setup the database as described. This creates the database specified in your DATABASE_URL and runs any pending migrations.
sqlx database setup --source auth/server/migrationscargo build -p wasm --target wasm32-unknown-unknown --profile web
wasm-bindgen ./target/wasm32-unknown-unknown/web/wasm.wasm --out-dir fullstack/auth-ui/lib/wasm --target webcargo run --bin authcargo build --bin auth --releaseThe release binary will be in target/release/auth.exe (Windows) or target/release/auth (Linux/macOS).
This workspace uses Cargo feature flags to enable optional functionality in various crates.
You can enable features at build or run time using --features.
The following features are available for the auth binary crate:
- client-ip: Enables listing the client-ip of the incoming request in application logs.
- openapi: Enables openapi documentation support.
- profiles: Enables use of profiles like
dev,staging,prod, etc... by setting theRUST_PROFILEenvironment variable. Requires having.env.<profile>files like.env(default profile),.env.dev,.env.staging,.env.prod, etc... in the current working directory. - rate-limit: Enables rate limiting middleware.
- serve-dir: Enables serving the frontend UI from the backend.
- smtp: Enables SMTP email sending support (adds
lettre,tera, andtokendependencies, and enables related features inlettre). - smtp--no-tls: Enables SMTP support without TLS (used for testing purposes only).
- tracing: Enables application logs. Log level can be set using the
RUST_LOGenvironment variable.
You can enable these features at build or run time using the --features flag. For example:
cargo run --bin auth --features smtp,rate-limit,tracingOr for a release build:
cargo build --bin auth --release --features smtp,rate-limit,tracing- Backend: Deploy the Rust server as you would any Axum-based service.
- Frontend: Deploy the contents of
fullstack/auth-ui/distas static files. - WASM: Ensure the generated WASM files are available in the frontend's
fullstack/auth/lib/wasmdirectory.