> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackshift.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy Laravel Rust

> Deploy a Laravel Rust app from GitHub. StackShift builds the binary and your frontend assets, sets the environment it needs, runs migrations when a database is attached, and offers a queue worker and the scheduler in one click.

> [!TIP]
>
> **Live.** This area is documented as current, user-reliable behavior.

## Goal

Run a Laravel Rust app on StackShift with its assets, database, queue worker and scheduler.

## Prerequisites

* A Laravel Rust app in a GitHub repository, such as the official skeleton
* A StackShift database if your app uses one

## Workflow

**Step 1**

Deploy the repository from the dashboard. StackShift detects the app and shows it as Laravel Rust.

**Step 2**

Attach a database if your app uses one. StackShift adds `DATABASE_URL` and runs `./app migrate --force` before each new version starts.

**Step 3**

Deploy. StackShift builds the assets and the binary, starts it, and checks `/up`.

**Step 4**

Open the project, press + and add the Queue worker and the Scheduler if your app uses queued jobs or scheduled tasks.

**Step 5**

Add your domain. If it is not the main address or a subdomain of it, copy the src/app.rs snippet StackShift shows into your app and deploy again.

## What StackShift does automatically

* Detects Laravel Rust: Your `Cargo.toml` depends on `laravel-rust`.
* Builds with Rust 1.100.1: `cargo build --release`. The first build takes a few minutes; later builds reuse the cargo cache.
* Builds your frontend first when `package.json` has a build script: `npm ci && npm run build`, or `npm run build:ssr` when `INERTIA_SSR=true`.
* Ships `public/`, `resources/`, `storage/` and `bootstrap/ssr/` when you use server-side rendering next to the binary, with `storage/` writable by the app.
* Starts the binary from `/app` on port 8080 and checks `/up`, which answers before any middleware, so health checks pass on every address.
* Runs `./app migrate --force` before each new version starts when a database is attached (`DATABASE_URL` is set). A release command you set wins.

## Environment variables StackShift sets

StackShift sets these on every deploy, worker and scheduled run. A variable you set yourself always wins.

* `SERVER_HOST=0.0.0.0`, so the app listens on every interface instead of 127.0.0.1.
* `SERVER_PORT`, the same value as `PORT` (8080 unless you change the port).
* `APP_ENV=production`.
* `APP_URL=https://` followed by the main address: your verified custom domain when it is the main address, otherwise the project’s stackshift.cloud address. When you change the main address, StackShift redeploys the app so `APP_URL` follows.
* `APP_KEY`, generated once per environment in the same format as `./app key:generate --show` and stored as a secret variable, so it stays the same across deploys. You find it under Variables. Previews get their own key.

## Queue worker and scheduler

Open the project, press + (or A) and pick Queue worker or Scheduler under Laravel Rust.

Queue worker runs `./app queue:work` as its own process next to the web process, from the same build. Deploy changes to start it. It restarts with every deploy, so it always runs the code it was built with.

Scheduler adds a scheduled job that runs `./app schedule:run` every minute (UTC) in a fresh container from the live build.

## Custom domains

In production Laravel Rust answers only the host in APP\_URL and its subdomains; other hosts get a 400. When you add a domain that is neither, the Networking settings show the exact snippet with your hosts. Put it in src/app.rs and deploy again.

The list replaces the default, so keep the APP\_URL host in it. `*.example.com` covers every subdomain of example.com but not example.com itself. If your main address is a custom domain and you still want the stackshift.cloud address to work, list it too.

```rust src/app.rs theme={null}
.with_middleware(|middleware, _| {
    middleware.trust_hosts(["example.com", "*.example.com", "example.org"]);
})
```

## Uploads and storage

`storage/` is reset on every deploy, and each copy of your app has its own. Keep logs on stderr and keep uploads elsewhere:

* A StackShift storage bucket with your app’s S3-compatible disk. This works with several copies of the app.
* A persistent volume on the project, with your local disk’s root pointed at the volume path. This keeps files across deploys on one server.

## Expected result

> [!TIP]
>
> Your Laravel Rust app answers on its address, /up returns 200, assets load, migrations have run, and the worker and scheduler run from the same build.

## Common failures

> [!WARNING]
>
> * A domain returns 400 Bad Request. In production Laravel Rust answers only the APP\_URL host and its subdomains. List the other hosts in src/app.rs as shown below, and keep the APP\_URL host in the list.
> * Uploads disappear after a deploy. `storage/` is reset on every deploy. Keep uploads on a persistent volume or in a bucket.
> * Migrations did not run. They run only when `DATABASE_URL` is set. If you set your own release command, StackShift runs yours instead.
> * Sessions end and encrypted values stop working after you change `APP_KEY`. Keep the key StackShift stored, or set your own once and leave it.

## Related guides

> [card] [Deploy from GitHub](https://docs.stackshift.cloud/projects/deploy-from-github.md)
>
> Use the repository-backed project flow when you want StackShift to detect the app, build from source, and let you override runtime behavior before the first deploy.

> [card] [Worker and background processes](https://docs.stackshift.cloud/projects/worker-processes.md)
>
> Run a project as a background process type (worker, queue, scheduler, reverb) instead of a public web service.

> [card] [Scheduled jobs (cron)](https://docs.stackshift.cloud/projects/scheduled-jobs.md)
>
> Run a command from your deployed image on a recurring standard-cron schedule, with run history and exit-code tracking.

> [card] [Create a bucket and connect an S3 client](https://docs.stackshift.cloud/object-storage/create-and-connect.md)
>
> Create an S2 bucket, capture its one-time credentials, and verify object operations with the AWS CLI.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.