Search

How to Install Laravel Rust: Step-by-Step Installation Guide

Laravel Rust is a full-stack web framework built on Axum and Tokio. It includes routing, middleware, sessions, database tools, queues, and testing helpers. This guide follows the official installation docs and takes you from a clean machine to a running application.

Beta notice: Laravel for Rust is in beta. Releases before 1.0 may include breaking changes to APIs and configuration. If a command here stops working, check the official docs.

What You Need Before You Start

Install these three tools first:

  • Rust: version 1.99 or later
  • Node.js: the LTS release, used for the frontend
  • Git: most machines already have it

Install Rust

On macOS and Linux, install Rust with rustup:

bash

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

On Windows, download the installer from rustup.rs. If you already have Rust, run rustup update to get the latest stable release.

Install Node.js and Git

Download the Node.js LTS release from the Node.js website, which offers graphical installers for macOS and Windows. If Git is missing, download it from the Git website.

Step 1: Install the Laravel CLI

The Laravel CLI creates new applications and runs your application's commands.

macOS and Linux:

bash

curl -fsSL https://laravel.com/install.sh | sh

Windows (PowerShell):

powershell

powershell -ExecutionPolicy Bypass -c "irm https://laravel.com/install.ps1 | iex"

The installer puts the laravel command in ~/.laravel/bin and adds that directory to your PATH. Open a new terminal before using it. When a newer CLI version is released, laravel new will tell you and offer to update.

Fix PATH Conflicts (Herd or the Old Installer)

Laravel Herd and the older Composer-based Laravel installer also provide a laravel command. Check which one your shell finds first:

bash

laravel --version

The output should start with Laravel CLI. If it shows a different version, another directory is ahead of ~/.laravel/bin on your PATH. To see every laravel binary:

  • macOS/Linux: which -a laravel
  • Windows PowerShell: Get-Command laravel -All

To fix it:

  • macOS/Linux: move the PATH line the installer added to your shell profile (such as ~/.zshrc or ~/.bashrc) below any Herd or Composer PATH entries. If you no longer need the old installer, remove it with composer global remove laravel/installer.
  • Windows: move %USERPROFILE%\.laravel\bin above Herd's or Composer's directory in your user Path environment variable.

Then open a new terminal and run laravel --version again.

Step 2: Create Your Application

bash

laravel new example-app
cd example-app

When asked which language you want, choose Rust. To skip the question, for example in a script, pass --rust.

The CLI will:

  • download a new application into the example-app directory
  • create the .env file
  • install frontend dependencies
  • compile the project, so your first command starts right away

Your new app comes set up with Inertia, React, TypeScript, Tailwind, and Vite Plus.

Your APP_KEY and .env File

The CLI generates an encryption key and sets it as APP_KEY in .env. This key encrypts your cookies and sessions, so keep it secret. Do not commit .env to source control, because it holds database URLs and API keys.

Good to Know

  • Your application's library is always named app, so imports start with app::.
  • To rename your project, change the name in the [package] section of Cargo.toml.

Step 3: Set Up the Database

New applications default to PostgreSQL. The docs recommend developing against the same database you will use in production, so queries, migrations, and tests behave the same way.

By default, .env connects to a local PostgreSQL database named laravel:

env

DB_CONNECTION=postgres
DATABASE_URL=postgres://postgres@127.0.0.1/laravel

If you do not have PostgreSQL yet, DBngin (macOS and Windows) and Postgres.app (macOS) can start a local server in a few clicks.

Then run the migrations from your application's directory to create the users, sessions, and queue tables:

bash

laravel migrate

If the database does not exist yet, migrate offers to create it.

Using SQLite or MySQL Instead

  1. In Cargo.toml, replace the database-postgres feature on laravel-rust with database-sqlite or database-mysql.
  2. Point .env at your database. For SQLite:

env

DB_CONNECTION=sqlite
DATABASE_URL=sqlite://storage/app/database.sqlite?mode=rwc

The ?mode=rwc option tells SQLite to create the file the first time the app connects. Your migrations work on every supported database.

Step 4: Run the Application

bash

laravel dev

This one command starts your application, a queue worker, and Vite Plus together. Open http://127.0.0.1:8000 in your browser to see the welcome page.

  • When you change Rust code or .env, the app rebuilds and restarts, and the browser page refreshes once the server is back.
  • While Vite runs, frontend edits appear through hot reloading. The page also refreshes when you edit a template in resources/views/.

Running Console Commands

Your application has its own commands, such as route:list. Run them through laravel from your app directory or any folder inside it:

bash

laravel route:list

The CLI compiles the app first and only shows compiler output if the build fails. To see all commands, run laravel list.

Frontend Checks

  • npm run check checks formatting, lint rules, and types.
  • npm run check:fix applies the fixes it can make.

Running in Production

To test how your app runs in production, stop Vite, build the frontend assets, and run in release mode:

bash

npm run build
cargo run --release

If you use Inertia server-side rendering, set INERTIA_SSR=true, build with npm run build:ssr instead, and run node bootstrap/ssr/app.js alongside your application.

Before deploying, check that:

  • APP_ENV is production
  • APP_DEBUG is false

With debug mode on, server errors show a page with the error, its causes, the route, and the request, which anyone can see.

Health Checks

Load balancers and uptime monitors can check that your app is running at /up, which returns a 200 once the app has started. The route is registered in src/app.rs, where you can change the path:

rust

.with_routing(|routing, _| {
    routing
        .web(routes::web::routes)
        .api(routes::api::routes)
        .health("/up");
})

Deploying to Laravel Cloud

Laravel Cloud is the managed platform from the Laravel team. It deploys your app each time you push to Git and includes:

  • Autoscaling, with scale-to-zero when idle
  • Preview environments for every pull request
  • Managed MySQL and Postgres databases, and Valkey caches
  • Managed queues whose workers scale with waiting jobs
  • Object storage and managed WebSocket servers

Quick Command Summary

Task Command
Install CLI (macOS/Linux) curl -fsSL https://laravel.com/install.sh | sh
Check CLI laravel --version
Create app laravel new example-app
Run migrations laravel migrate
Start dev environment laravel dev
List routes laravel route:list
List all commands laravel list
Build frontend npm run build
Run release build cargo run --release

Conclusion

With Rust, Node.js, and Git installed, getting started with Laravel Rust takes four steps: install the CLI, run laravel new, set up the database with laravel migrate, and start everything with laravel dev. Next, you can explore routing, validation, models, and authentication

?

Frequently Asked Questions (FAQ)

1. What do I need to install before Laravel Rust?

You need Rust 1.99 or later, Node.js (the LTS release), and Git. The Laravel CLI is installed afterward with the official install script.

2. Which database does Laravel Rust use by default?

PostgreSQL. The default .env connects to a local database named laravel. You can switch to SQLite or MySQL by changing the database feature in Cargo.toml and updating .env.

3. How do I start the Laravel Rust development server?

Run laravel dev from your application directory. It starts the application, a queue worker, and Vite Plus together, and the site is available at http://127.0.0.1:8000.

4. Why does laravel --version show the wrong version?

Laravel Herd or the older Composer-based installer may be ahead of ~/.laravel/bin on your PATH. Move the new CLI's PATH entry above theirs, open a new terminal, and check again.

5. Is Laravel Rust ready for production?

It is in beta, and releases before 1.0 may include breaking changes. Before deploying, set APP_ENV=production and APP_DEBUG=false, and read the deployment guide.
🎯 Interactive Skill Assessment
Laravel Challenge: How Well Do You Know the PHP Framework Devs Love?

Test what you just learned with 31 interactive multiple-choice questions and instant explanations.

Start Free Quiz

Tags

Share This:

NH
Written by Nazmul Hoque • Senior Full-Stack Developer (8+ Years Experience)

Senior Full-Stack Engineer with 8+ years of experience building production web and mobile applications using Laravel, Next.js, TypeScript, JavaScript, React, Vue.js, MySQL, PostgreSQL, and Flutter.

You May Also Like Below Articles

Handpicked related tutorials and step-by-step developer guides to continue learning.