CLI Commands
The Rejoice CLI helps you create, develop, and build projects.
Installation
cargo install rejoice
Commands
rejoice init
Create a new project.
# Create in a new directory
rejoice init my-app
# Create with database support
rejoice init my-app --with-db
# Initialize in current directory
cd my-empty-dir
rejoice init
Options:
| Option | Description |
|---|---|
[name] | Project name (optional, uses directory name if omitted) |
--with-db | Include SQLite database support |
What it creates:
Without --with-db:
- Basic Cargo.toml with Rejoice dependency
src/main.rswithApp::new()setupsrc/routes/layout.rsandsrc/routes/index.rsbuild.rsfor route generationclient/with Vite, Tailwind, and example SolidJS componentpackage.json,vite.config.ts,tsconfig.json
With --with-db:
- Everything above, plus:
.envwithDATABASE_URL- Empty
.dbSQLite file AppStatestruct with db poolApp::with_state()setup
rejoice dev
Start the development server.
rejoice dev
Features:
- Runs your app at
http://localhost:8080 - Watches Rust files and recompiles on changes
- Watches client files and rebuilds with Vite
- Live reload via WebSocket (
ws://localhost:3001/__reload) - Hot module replacement for islands
When to restart manually:
- After adding new dependencies to
Cargo.toml - After modifying
build.rs
rejoice build
Build for production.
# Development build
rejoice build
# Production build (optimized)
rejoice build --release
Options:
| Option | Description |
|---|---|
--release | Build with optimizations |
Build steps:
- Install npm dependencies (if
node_modules/missing) - Generate islands registry
- Build client assets with Vite
- Compile Rust binary
Output:
| Asset | Location |
|---|---|
| Binary | target/debug/<name> or target/release/<name> |
| JavaScript | dist/islands.js |
| CSS | dist/styles.css |
Environment
The CLI expects:
- Rust toolchain (cargo, rustc)
- Node.js and npm
- Project directory with
Cargo.toml
Next Steps
- Installation - Getting started
- Project Structure - Understanding the files
- Deployment - Running in production