# How to deploy a Laravel for Rust app on Cloider App Engine

> Deploy a Laravel for Rust app with PostgreSQL on Cloider App Engine three ways: from the dashboard with a Dockerfile and a GitHub repository, with the cloider CLI, or with one prompt to an AI coding agent, with a screenshot of every step.

By Marei Morsy, published December 4, 2026. Source: https://cloider.com/blog/deploy-laravel-rust-app-cloider-apps

## Key takeaways

- A Dockerfile builds the Vite frontend and the Rust binary, and ships a small Debian runtime on port 8080.
- The app reaches PostgreSQL on the database's private host with sslmode=require.
- APP_KEY and DATABASE_URL are locked secrets, never shown in the dashboard again.
- Run ./myapp migrate --force once, from the app Terminal or cloider app exec.
- With the CLI it is cloider login, then cloider deploy.

[Laravel for Rust](https://laravel.com/rust/docs) brings Laravel's routing, validation, Eloquent-style models, migrations and Inertia frontends to Rust, and builds your app into a single fast binary. In this guide you deploy a real Laravel for Rust app with a PostgreSQL database to [Cloider App Engine](https://cloider.com/apps) (Apps in the dashboard), three ways:

1. **From the dashboard**: dockerize the app, create the database, connect the GitHub repository, then add the environment variables and secrets.
2. **With the cloider CLI**: install it, `cloider login`, `cloider deploy`.
3. **With an AI coding agent**: one prompt, "using cloider cli deploy this app".

Options 1 and 2 show every step with a screenshot of what you will see. The finished app is live at [laravel-rust-blog.cloider.app](https://laravel-rust-blog.cloider.app), and the code is on GitHub at [mareimorsy/laravel-rust-blog](https://github.com/mareimorsy/laravel-rust-blog).

## What you are deploying

The app is the Laravel for Rust starter with a small blog on top: a list of posts, and pages to write, edit and delete them. It uses an Inertia + React + TypeScript + Tailwind frontend, keeps its posts, sessions, cache and jobs in PostgreSQL, and reads its configuration from environment variables.

| Variable | Value on Cloider | Secret |
| --- | --- | --- |
| APP\_ENV | production | No |
| APP\_DEBUG | false | No |
| APP\_URL | https://\<your-subdomain\>.cloider.app | No |
| APP\_KEY | base64: followed by 32 random bytes in base64 | Yes |
| DATABASE\_URL | postgres://USER:PASSWORD@HOST:PORT/DB?sslmode=require | Yes |

Clone it to follow along:

```bash
git clone https://github.com/mareimorsy/laravel-rust-blog.git
cd laravel-rust-blog
```

You also need a Cloider account. New accounts get a welcome credit, which covers everything in this guide many times over.

---

## Option 1: deploy from the Cloider dashboard

## Step 1: Dockerize the app

Cloider builds an app with buildpacks when it has no Dockerfile, and with your Dockerfile when it has one. A Laravel for Rust app needs both Node.js (for the frontend) and Rust (for the server) at build time, so a Dockerfile is the clearest way to build it.

Laravel for Rust compiles your whole application, migrations included, into one binary. At runtime it still reads three folders next to it: `public/` (the Vite build), `resources/views/` (the root view) and `storage/`. The Dockerfile in the repository builds all of that in three stages:

1. **assets**: `npm ci` and `npm run build` write the Inertia + React frontend to `public/build`.
2. **server**: `cargo build --release --locked` builds the binary. The two cache mounts keep the Cargo registry and the build folder between builds, so a rebuild only compiles what changed.
3. **runtime**: a slim Debian image with the binary, `public/`, `resources/views/` and a writable `storage/`, running as a non-root `app` user.

```dockerfile
# syntax=docker/dockerfile:1

FROM node:24-slim AS assets
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY vite.config.ts tsconfig.json ./
COPY resources ./resources
COPY public ./public
RUN npm run build

FROM rust:1.100-slim-trixie AS server
WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
    --mount=type=cache,target=/usr/local/cargo/build \
    cargo build --release --locked \
    && cp target/release/myapp /usr/local/bin/myapp

FROM debian:trixie-slim
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates \
    && rm -rf /var/lib/apt/lists/* \
    && useradd --system --no-create-home app
WORKDIR /app
COPY --from=server /usr/local/bin/myapp ./myapp
COPY --from=assets /app/public ./public
COPY resources/views ./resources/views
RUN mkdir -p storage/app storage/logs && chown -R app:app storage

ENV SERVER_HOST=0.0.0.0 \
    SERVER_PORT=8080
USER app
EXPOSE 8080
CMD ["./myapp"]
```

![The Dockerfile of the laravel-rust-blog repository printed in a terminal](https://cloider.com/blog/media/0103182f27555c4fe6bd079afea038bb.webp "The Dockerfile: Vite assets, the release binary, and a small Debian runtime on port 8080.")

Two settings matter on any platform. The server listens on `127.0.0.1:8000` by default, which nothing outside the container can reach, so the image sets `SERVER_HOST=0.0.0.0` and `SERVER_PORT=8080`. And Cloider terminates HTTPS in front of your app, so `src/app.rs` trusts the proxy, which makes the URLs the app generates start with `https://`:

```rust
.with_middleware(|middleware, _| {
    // Cloider's load balancer terminates HTTPS, and apps are only reachable through it
    middleware.trust_proxies(["*"]);
    // ...
})
```

The framework also answers `GET /up` with a 200 once it has started, which is what Cloider and Kubernetes use as the health check.

## Step 2: Create the PostgreSQL database

Open **Databases** in the sidebar and click **Create Database**. Name it `laravel`, set the user to `laravel`, and pick **PostgreSQL v18** as the engine.

![The Create new database form with the Database Engine list open, showing MySQL, PostgreSQL, Redis and MongoDB](https://cloider.com/blog/media/13d345d24de32d565ea4c04c99040285.webp "Cloider manages MySQL, PostgreSQL, Redis and MongoDB.")

Leave **Trusted sources** on **Allow Everything** and **SSL Mode** on, and keep the **Hobby** plan, which is plenty for this app. Then click **Create database**.

![The new database form filled in with the name laravel, the user laravel, PostgreSQL v18, SSL on and the Hobby plan selected](https://cloider.com/blog/media/7b4ac52da16632dfe9369e9c9a8b573b.webp "The laravel database: PostgreSQL 18 on the Hobby plan, SSL required.")

The database shows **Creating** for a minute or two, then **Ready**.

![The Databases list with the laravel database in the Creating status](https://cloider.com/blog/media/a24362fb122d74dff187ace39482098e.webp "The database is being created.")

Click it to see its connection details. Your app runs on Cloider, so it connects through the **private host** (`...db.cloider.internal`), which stays inside Cloider's network. Open the **Private** tab under **Quick Connect** and copy the **DSN**, then click **show** next to the password to fill it in.

![The laravel database overview with the Ready status, PostgreSQL v18, the Hobby plan and the Quick Connect panel](https://cloider.com/blog/media/9de526fc933b133a21f71f265721138d.webp "The database is Ready.")

![The Quick Connect panel on its Private tab, with a psql command and a postgresql:// DSN on the db.cloider.internal host](https://cloider.com/blog/media/4d8a4be87f1cf048b177646b7503a54a.webp "The private DSN is what the app uses. Note the database's own port and sslmode=require.")

## Step 3: Connect the GitHub repository (or upload the code)

Open **Apps** and click **Create App**. You can import a Git repository from GitHub, GitLab or Bitbucket, deploy a Docker image you already built, or drag and drop the project folder or a zip file to upload it.

![The Create new app page with Import a Git repository (GitHub, GitLab, Bitbucket), Deploy a Docker image, and an upload area for the application source](https://cloider.com/blog/media/285e1c9386180c66b05b09992c15fcc5.webp "Three ways in: a Git repository, a Docker image, or an upload.")

Click **GitHub**. The first time, GitHub asks you to install the Cloider Apps GitHub App and choose the repositories it may read. Pick `laravel-rust-blog`, and keep the `main` branch. Every push to that branch deploys a new version.

![The Import from GitHub dialog with the mareimorsy account, the laravel-rust-blog repository selected and the main branch](https://cloider.com/blog/media/b9c15048da6ce227922c927ba1aa22c7.webp "Import the repository and pick the branch to deploy.")

Click **Import**. Cloider reads the repository and fills in the form: the app name, the type (**Web service**) and port `8080`. Pick a free subdomain, here `laravel-rust-blog.cloider.app`.

![The Configure your app step showing Deploying from mareimorsy/laravel-rust-blog on main, the detected port 8080 and the app name laravel-rust-blog](https://cloider.com/blog/media/ce98cc045e7475f8acec0fa374792da9.webp "Cloider fills in the name and the port. The build uses the repository's Dockerfile.")

If you would rather not connect Git, the upload area does the same with a folder or a zip of the project. Leave out `target/` and `node_modules/`: they are large, and the Dockerfile builds them anyway.

## Step 4: Add the environment variables and secrets

Under **Environment variables**, click **Add variable** for each plain setting:

![The environment variables section with APP\_ENV production, APP\_DEBUG false and APP\_URL https://laravel-rust-blog.cloider.app, and the free subdomain laravel-rust-blog.cloider.app available](https://cloider.com/blog/media/f7384c835c1a7b72c55d96a131617a6c.webp "The plain settings, and the free subdomain the app will answer on.")

Then add the two secrets, and click the lock icon next to each so its value is never shown in the dashboard again:

- `DATABASE_URL`: the private DSN from step 2, with the password in it, for example `postgres://laravel:PASSWORD@laravel-42lble.db.cloider.internal:20149/laravel?sslmode=require`.
- `APP_KEY`: the key that encrypts sessions and cookies. Make one with the command below, and keep it the same across deploys.

```bash
echo "base64:$(openssl rand -base64 32)"
```

![The app's Environment tab listing APP\_DEBUG, APP\_ENV, APP\_URL as plain values and APP\_KEY and DATABASE\_URL as locked secrets shown as dots](https://cloider.com/blog/media/0e4a6bf4f6f1e321b5d24b95f8137dfd.webp "APP_KEY and DATABASE_URL are locked: the dashboard never shows them again.")

Open **Advanced settings** and set the **Health check path** to `/up`. A new version then only goes live once it answers there, and a replica that stops answering is restarted.

![Advanced settings with the compute options and the health check path set to /up, a 10 second interval, 5 second timeout, failure threshold 6 and 300 second grace period](https://cloider.com/blog/media/2107fd8d2db48a77f0c16232ae4441e7.webp "The health check uses the framework's /up route.")

Click **Create App**. Cloider starts a build machine, builds the image from your Dockerfile and streams the output. The first build compiles every crate, so it takes several minutes. Later builds reuse the build cache.

![The Build output dialog streaming cargo compiling crates inside the Docker build](https://cloider.com/blog/media/49e0987ea33ed6c53124909d6d59f365.webp "The first build compiles the whole dependency tree.")

![The app's Builds tab with version 1 live and Ready, built from commit a8337ed in 8m 30s](https://cloider.com/blog/media/9d42fa9b9ac38e15e345c0b41480f30d.webp "Version 1 is built and live.")

## Step 5: Run the migrations

The app is up, but the database is still empty, so `/posts` answers with a 500 (`relation "posts" does not exist` in the logs). Open the app's **Terminal** tab, which gives you a shell in a running replica, and run the migrations once:

```bash
./myapp migrate --force
```

![The app Terminal tab running ./myapp migrate --force, which migrates the users, cache, jobs and posts tables and prints 4 migrations ran](https://cloider.com/blog/media/10bbc3c64865f50176ff9f50bb10e926.webp "The migrations are compiled into the binary, so the container can run them itself.")

Run them the same way after any deploy that adds a migration. Run them from one place only: the framework doesn't lock the migrations table, and the app runs at least two replicas.

## Step 6: Open the app

Open `https://laravel-rust-blog.cloider.app`, click **New post** and publish one. It goes through the app, into PostgreSQL and back:

![The live Laravel for Rust app showing a published post titled Hello from Cloider with the Post published message](https://cloider.com/blog/media/1e4bd7f601b8004660076c3991da4239.webp "A post written on the deployed app.")

![The posts list of the live app with the Hello from Cloider post](https://cloider.com/blog/media/045f1cbead5e6a8eabedf3a574fe3b34.webp "The posts list, served from PostgreSQL.")

From now on, `git push` to `main` is a deploy: Cloider builds the new commit and switches to it once its health check passes.

---

## Option 2: deploy with the cloider CLI

The same deployment from your terminal, in three commands plus the database.

## Step 1: Install the CLI

```bash
curl -fsSL https://cloider.com/install.sh | sh
```

![A terminal running the install script, which downloads cloider 0.21.0 for darwin/arm64 and installs it to ~/.local/bin](https://cloider.com/blog/media/96f32f7daeb7c2da98f7ea43dc294c47.webp "The install script picks the build for your OS and CPU.")

On Windows, run `irm https://cloider.com/install.ps1 | iex` in PowerShell instead.

## Step 2: cloider login

```bash
cloider login
```

The CLI opens your browser on Cloider, where you pick the account and whether the CLI may make changes:

![The terminal after cloider login, opening the browser and waiting for it](https://cloider.com/blog/media/66edd98b168e952cbde66b5e3950e86d.webp "The CLI waits for the browser.")

![The Authorize Cloider CLI page with the account, the Read and write and Read only options, and the Authorize CLI button](https://cloider.com/blog/media/6177177988968894e833c2b801e6270a.webp "Choose Read and write to deploy.")

![The terminal printing Logged in as the account with Read and Write access](https://cloider.com/blog/media/40d06e43e10b605904cebdde9aa487cd.webp "Logged in. The token is kept in ~/.cloider.")

## Step 3: Create the database

```bash
cloider db create blog-db --engine postgresql --wait
```

![The terminal output of cloider db create blog-db, creating PostgreSQL 18 on the Hobby plan and reporting it ready](https://cloider.com/blog/media/3834e78ed837e935e1d8ebd7a3c34457.webp "A PostgreSQL 18 database on the Hobby plan.")

Build the connection string for the private host, and a new app key, into shell variables. Nothing secret is printed:

```bash
DB=$(cloider db get blog-db -o json)
export DATABASE_URL="postgres://$(jq -r .database_user <<<$DB):$(cloider db password blog-db)@$(jq -r .private_host <<<$DB):$(jq -r .database_port <<<$DB)/$(jq -r .database_name <<<$DB)?sslmode=require"
export APP_KEY="base64:$(openssl rand -base64 32)"
```

## Step 4: cloider deploy

From the project folder, deploy it. The first deploy creates the app, and later ones from the same folder update it:

```bash
cloider deploy --name laravel-rust-cli --subdomain laravel-rust-cli \
  --env APP_ENV=production --env APP_DEBUG=false \
  --env APP_URL=https://laravel-rust-cli.cloider.app \
  --secret-env APP_KEY="$APP_KEY" --secret-env DATABASE_URL="$DATABASE_URL"
```

The CLI zips the folder (leaving out what `.gitignore` lists), creates the app, links the folder to it in `.cloider/app.json`, and streams the build:

![The start of cloider deploy: packaged 76 files, created app laravel-rust-cli on port 8080, linked the folder, and building the app from its own Dockerfile](https://cloider.com/blog/media/7f20f13c51d8f1a8ab4c374d84d54a8c.webp "cloider deploy packages the folder and builds it with your Dockerfile.")

![The end of cloider deploy: the image pushed, deployed, the app running and its URL https://laravel-rust-cli.cloider.app/](https://cloider.com/blog/media/a4c0fcdf4b1524867aa7821291f71348.webp "Deployed, with the app's URL on the last line.")

Then run the migrations in the app's container with `cloider app exec`:

```bash
cloider app exec laravel-rust-cli -- ./myapp migrate --force
```

![cloider app exec running the four migrations, followed by a curl of /posts that returns 200](https://cloider.com/blog/media/40b1d099b16744e6ed5aed49d579c79c.webp "The migrations ran and /posts answers 200.")

To deploy a new version later, run `cloider deploy` again in the same folder.

---

## Option 3: let an AI coding agent deploy it

If you work with an AI coding agent such as Claude Code, Cursor or Codex, install and log in to the CLI as in option 2, open the project, and ask:

```
using cloider cli deploy this app
```

The first thing `cloider --help` prints is a note for AI agents pointing them to [docs.cloider.com/llms.txt](https://docs.cloider.com/llms.txt), which holds the deployment strategy agents follow on Cloider:

- Start with `cloider whoami`, to confirm the account and that the token can make changes.
- Deploy a web service like this one as an app, and use a managed database instead of running PostgreSQL yourself.
- When the project has a GitHub, GitLab or Bitbucket remote, ask you to run `cloider git connect` and create the app from the repository, so every push deploys. That is the one step the agent can't finish for you.
- Use Kubernetes only when you ask for it or the app needs it.

Agents can also drive Cloider through its MCP server, `cloider mcp`, with the same commands as tools. See [AI coding agents in the docs](https://docs.cloider.com/mcp/ai-coding-agents).

---

## Troubleshooting

- **500 on every page**, with `relation "posts" does not exist` in the logs: the migrations haven't run. Run `./myapp migrate --force` in the app's Terminal, or with `cloider app exec`.
- **400 Bad Request**: in production the app only answers requests for its `APP_URL` host. Check that `APP_URL` matches the subdomain or domain you open it on.
- **Errors about TLS or SSL when connecting to the database**: keep `?sslmode=require` at the end of `DATABASE_URL`. SSL is on for new databases.
- **Sessions reset after a deploy**: `APP_KEY` changed. Generate it once and keep it as a locked secret.

## What it costs

An app is billed for the CPU and memory its replicas use, with a minimum of $2.99 per 30 days while it runs. The Hobby PostgreSQL plan is $3.99 a month. Both are charged by the hour, so trying this out for an afternoon costs cents, and the welcome credit of a new account covers it. Delete the app and the database from their pages when you're done.

## Frequently asked questions

### Does Cloider support Laravel for Rust?

Yes. Cloider builds the app from its Dockerfile, runs it on two or more replicas behind HTTPS, and gives it a managed PostgreSQL database. The guide deploys a real Laravel for Rust app this way.

### How do I run Laravel for Rust migrations on Cloider?

The migrations are compiled into the binary. Run ./myapp migrate --force once from the app's Terminal tab in the dashboard, or with cloider app exec <app> -- ./myapp migrate --force.

### Which database host should a Cloider app use?

The private host, which ends in .db.cloider.internal. It stays inside Cloider's network. Keep sslmode=require in the connection string.

### Can I deploy without connecting GitHub?

Yes. Upload the project folder or a zip in the dashboard, or run cloider deploy from the folder.


Tags: Apps, CLI, Docker, Laravel, PostgreSQL, Rust, Tutorial
