Skip to content

Installation ​

Install the rustcms command, create an application with it, and sign in to its admin panel. This takes a few minutes, most of it the first build.

Quick start ​

sh
curl -fsSL https://irisvn.github.io/RustCMS/install.sh | sh
export PATH="$HOME/.rustcms/bin:$PATH"   # as the script prints; add it to your shell profile
rustcms new blog
cd blog
rustcms migrate                    # creates database.sqlite (DATABASE_URL in .env)
rustcms make:user --email you@example.com --name You --super-admin
rustcms serve                      # http://localhost:8000/admin

The sign-in page of the admin panel

The demo application's sign-in page at /admin (password reset is enabled there, hence "Forgot password?"; a new application does not show it).

Requirements ​

  • Rust, stable 1.94 or newer, from rustup.rs. Your application is a Rust project: Cargo builds it together with RustCMS.
  • A C compiler, for the few dependencies with C code (SQLite, TLS):
    • macOS: Xcode Command Line Tools (xcode-select --install);
    • Linux: build-essential on Debian/Ubuntu, gcc or clang elsewhere.
  • macOS or Linux. Windows is not supported: use WSL (Ubuntu), where the Linux build works.
  • Network access to GitHub for the first build: applications depend on RustCMS-Core through a Git tag.
  • A database: SQLite works out of the box; PostgreSQL or MySQL 8.4 for production. Node.js is not needed (the admin panel is built in).

rustcms doctor checks this machine (Rust version, C compiler, access to RustCMS-Core) and says what to install.

Installing the rustcms command ​

sh
curl -fsSL https://irisvn.github.io/RustCMS/install.sh | sh

The script picks the build for your system from the releases, checks it against the release's SHA256SUMS, and installs it as ~/.rustcms/bin/rustcms. It prints the line to add to your shell profile, or adds it itself with sh -s -- --modify-path.

VariableDefault
RUSTCMS_VERSIONthe latest releasea release tag, e.g. v0.4.0; release candidates (v0.4.0-rc.1) are only installed this way
RUSTCMS_INSTALL~/.rustcmsthe install root: the command goes in its bin/ (/opt/rustcms → /opt/rustcms/bin/rustcms)
sh
curl -fsSL https://irisvn.github.io/RustCMS/install.sh | RUSTCMS_VERSION=v0.12.1 sh
  • Builds exist for macOS on Apple silicon (11 or newer) and Linux (x86_64 and arm64, any distribution: the binary is static). An x86_64 shell running under Rosetta on Apple silicon gets the native build. On an Intel Mac, build the command from source with Cargo: cargo install --git https://github.com/irisvn/RustCMS-Core --tag v0.12.1 rustcms-cli.
  • To read the script first: curl -fsSLO https://irisvn.github.io/RustCMS/install.sh, then sh install.sh. Or download an archive from the releases page and put rustcms on your PATH yourself.

Checksums are not signatures

The checksum detects a corrupted download; it does not prove who published the release. Releases are not code-signed yet: an archive downloaded with a browser may be blocked by macOS (xattr -d com.apple.quarantine rustcms). The install script is not affected.

Keeping it up to date ​

CommandDoes
rustcms self-updatereplaces the command with the latest release; --version v0.4.0 installs a given one (it may be older). Only for a command installed by the script
rustcms upgrademoves the application in the current directory to the command's version (Cargo.toml and Cargo.lock); --dry-run shows the changes, --force allows going back to an older version
rustcms docsopens this guide for the command's version; --print-path prints its URL instead
rustcms doctorchecks that this machine can build an application

Run self-update first, then upgrade in each application. The upgrade guide lists what changes between versions.

Creating an application ​

sh
rustcms new blog                       # in the current directory
rustcms new blog --path ~/code         # in ~/code/blog

rustcms new writes the project (see Directory structure), then resolves its dependencies (Cargo.lock). Its Cargo.toml depends on the RustCMS-Core tag of the command's version:

toml
rustcms = { git = "https://github.com/irisvn/RustCMS-Core", tag = "v0.17.0" }
Option
--path <dir>the parent directory (default: the current one)
--no-fetchdo not resolve the dependencies now (offline); Cargo does it on the first build
--in-workspacedo not declare a standalone [workspace], for an application inside another Cargo workspace (dependencies are not resolved either; add the workspace's [patch.crates-io] for sqlx to its root, see the upgrade guide)

A tag that does not exist, or dependencies that do not resolve, fail the command; the project is left in place to inspect. The first build compiles everything and takes a few minutes; later builds only compile your code.

It also writes a kit for AI coding agents (AGENTS.md, CLAUDE.md, .claude/skills), linked to the guide of this version: see AI agents.

Commit Cargo.lock: it pins the exact commit and every dependency, so your team and your CI build what you tested (the generated .github/workflows/ci.yml runs cargo test --locked).

The .env file ​

rustcms new writes .env with a fresh APP_KEY, and .env.example without it:

sh
APP_NAME="blog"
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost:8000
APP_KEY=base64:…

DATABASE_URL=sqlite://database.sqlite?mode=rwc

.env.example also lists a PostgreSQL and a MySQL DATABASE_URL to start from (a MySQL database needs CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_bin; see MySQL). .gitignore already excludes .env, *.sqlite and /storage.

DANGER

Never commit .env: APP_KEY signs admin sessions and JWTs and encrypts your secrets. A teammate copies .env.example to .env and runs rustcms key:generate.

Signing in ​

Open http://localhost:8000/admin and sign in with the user you created. Use the host of APP_URL: sign-in and every change are only accepted from that origin. Opening http://127.0.0.1:8000/admin shows the page, but sign-in answers 403; list other origins in auth.admin_origins (Configuration).

rustcms inside an application ​

Inside an application, rustcms <command> runs your application's binary (cargo run -- <command>), so your own commands are available too. The command's own names (new, make:*, doctor, upgrade, self-update, docs, docs:cli) come first; rustcms -- <command> always reaches the application. Once built, the binary takes the same commands: ./blog migrate, ./blog serve. Every command is listed in the CLI reference.

Rebuilding on changes ​

sh
rustcms serve --watch

rustcms serve --watch (macOS and Linux) builds and starts the server, then rebuilds it when the application changes and replaces the running server once the build succeeds:

You changeWhat happens
src/, Cargo.toml, Cargo.lock, build.rs, lang/, .cargo/, built extension scripts in resources/admin/build, then the server is replaced
config/*.toml, .envthe same (the build is a quick check when no code changed): settings are read when the server starts
a template registered with view! or mail_template! in resources/views/nothing: debug builds with APP_ENV=local read it again on each render, reload the page
a migration (src/database/migrations/)build and replace; run rustcms migrate yourself (the command reminds you)
an extension's sources (resources/admin/src/)nothing until you run npm run build in resources/admin (the built files then trigger a build)
  • A build that fails leaves the previous server running; the next change tries again. Files changed during a build are never missed: the next round takes them.
  • The server runs as rustcms serve runs it (cargo run), with the same options (rustcms serve --watch --api-only; after --, arguments go to the application as written). The old server stops as on a deploy (it finishes its requests, at most 6 seconds; queue workers are cut short). Admin sessions live in the database, so reloading the page keeps you signed in.
  • Ctrl-C stops the watcher, the server and a running build. Run it in the foreground: a watcher killed with kill -9 leaves its server running.
  • An application with several binaries needs default-run in its Cargo.toml; a manifest that cannot be read is reported and the server keeps running until it is fixed. Path dependencies outside the application are not watched, nor are files named by *_FILE settings: after changing one, save any watched file (or restart).
  • Templates in resources/views/ are not watched: one that does not reload itself (embedded with include_str!, or a release build) shows a change after you save a file in src/ (or restart).
  • Each change costs a build: a Rust server cannot swap code while it runs. [profile.dev] debug = "line-tables-only" in the application's Cargo.toml makes builds faster.

Your first resource ​

sh
rustcms make:model Post -m                 # src/models/post.rs + a create_posts_table migration
# edit the model and the migration, then:
rustcms migrate
rustcms make:resource Post --generate      # src/admin/resources/post_resource.rs: fields, form, table
rustcms permission:sync                    # declares posts.view_any, posts.create, …
rustcms serve

--generate writes fields, form, table and filters from the model's columns. For a foreign key, --belongs-to category_id=categories (repeatable) makes the column a select of the categories resource.

Posts now appear in the panel for super admins. Give other users access with roles (System → Roles, see Users & roles).

Pitfalls ​

  • Sign-in answers 403 on 127.0.0.1 or another host: use the host of APP_URL, or add the origin to auth.admin_origins.
  • rustcms self-update refuses: the command was not installed by the script (Cargo or a manual copy). Update it the way you installed it (cargo install --git … --tag <version> rustcms-cli), or switch to the script.
  • The first build fails to fetch RustCMS-Core: check access to GitHub, or create the project with --no-fetch and build when online.

Next steps ​

RustCMS 0.17.0 · source cfb82fa33fab · MIT OR Apache-2.0