Skip to content

Build Your First Laravel Rust App with React, Inertia, and SQLite

Build Your First Laravel Rust App with React, Inertia, and SQLite

A useful first project should teach you more than how to display "Hello World". It should show how a real request travels through the application: from a React form, into a Rust handler, through validation, into a database, and back to the browser.

In this tutorial, you'll build Issue Desk, a small issue tracker. It will list issues, let you create one, and let you edit it. You'll also test both the successful and unsuccessful form-submission paths.

We'll use Laravel Rust for routing, validation and database access; React for the interface; Inertia to connect the two without building a separate API; and SQLite to keep local setup simple.

Version note: Laravel Rust is in beta as of December 3, 2026. The commands and examples below are based on the official documentation and the 0.x starter repository available on that date. APIs and starter files may change before version 1.0. The examples have not been independently compiled in this article, so check the linked documentation if the beta has moved on.

What you'll build

By the end, Issue Desk will support this flow:

  1. Open /issues and see the saved issues.
  2. Select New issue and submit a title and description.
  3. See server-side validation errors if the title or description is missing or too long.
  4. Edit an existing issue and return to the updated list.
  5. Restart the development server and confirm that the data is still in SQLite.
  6. Run HTTP tests that check both the successful and invalid submissions.

The request path is straightforward:

React form → Inertia request → web route → Rust handler → validated input → model write → SQLite → redirect → refreshed Inertia page.

That is the pattern you'll reuse when you add more resources to the application.

1. Install the tools and create the app

You'll need:

  • Rust 1.99 or later.
  • Node.js LTS.
  • Git.
  • The Laravel CLI.

Install Rust with rustup if it isn't already on your machine. The official Laravel guide recommends the Node.js LTS release and Git as well.

Install the Laravel CLI on macOS or Linux:

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

On Windows, run this in PowerShell:

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

Open a new terminal after installing the CLI so your updated PATH is loaded.

Check that the tools are available:

rustc --version
node --version
git --version
laravel --version

The Laravel CLI's version output should start with Laravel CLI. If you already use Laravel Herd or the older Composer-based installer, your terminal may be finding a different laravel executable first. On macOS or Linux, inspect them with which -a laravel; in PowerShell, use Get-Command laravel -All. The installation guide explains how to fix a PATH conflict.

Create the project:

laravel new issue-desk --rust
cd issue-desk

The starter is already configured with Inertia, React, TypeScript, Tailwind CSS and Vite Plus. The CLI installs the frontend dependencies, creates .env, generates the application key and compiles the application. You don't need to add React or Inertia manually.

For this walkthrough, keep the generated web middleware, frontend entry point and application key. We'll add our own routes, handlers and page components without replacing the starter's foundation.

2. Switch the database to SQLite

New Laravel Rust applications use PostgreSQL by default. SQLite is convenient for a local tutorial because the database lives in a file and doesn't require a separate database server.

Open Cargo.toml. Find the laravel-rust dependency and replace the database-postgres feature with database-sqlite. Keep the dependency version and any other features already listed.

For example, change:

laravel-rust = { version = "0.1", features = ["database-postgres", "redis", "sqs"] }

to:

laravel-rust = { version = "0.1", features = ["database-sqlite", "redis", "sqs"] }

Your generated file may contain a different version or feature list. Change only the database feature.

Next, update the database settings in .env:

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

The mode=rwc option tells SQLite to create the database file when the application first connects. The storage/app directory must already exist; create it if the starter hasn't created it.

Run the starter's migrations:

laravel migrate

This creates the framework tables needed by the starter, such as users, sessions and queue tables.

Now start the development environment:

laravel dev

This command starts the Rust application, a queue worker and Vite Plus together. Open http://127.0.0.1:8000 and confirm that the welcome page loads.

Keep this terminal running. Use a second terminal, opened in the issue-desk project directory, for the remaining commands.

A database choice worth thinking about: SQLite is excellent for this local exercise, but it is not identical to PostgreSQL or MySQL. If your production application will use PostgreSQL, developing and testing against PostgreSQL locally is the safer way to catch database-specific differences before deployment. Laravel's database installation guide recommends using the same database engine you plan to run in production.

3. Create the issues table and model

Let's give Issue Desk a small schema: an ID, a title, a description and timestamps.

Generate a migration:

laravel make:migration create_issues_table

Laravel creates a timestamped Rust file in database/migrations/. Open that file and replace its contents with:

use laravel::db::AnyTransaction;

pub async fn migrate(tx: &mut AnyTransaction<'_>) -> laravel::Result<()> {
    tx.schema()
        .create("issues", |table| {
            table.id();
            table.string("title").length(120);
            table.text("description");
            table.timestamps();
        })
        .await
}

The schema builder keeps the migration readable:

  • table.id() creates the primary key.
  • table.string("title").length(120) declares a string column with a length of 120.
  • table.text("description") creates a text column.
  • table.timestamps() adds created_at and updated_at.

There is a SQLite detail worth calling out. SQLite ignores the numeric length in declarations such as VARCHAR(120). It does not enforce a 120-character limit just because the schema says so. In this tutorial, the server-side validation rule we add next enforces that limit for requests handled by the application. If other tools or services can write directly to this table, add a database-level constraint as well. See SQLite's datatype documentation.

Run the new migration:

laravel migrate

Laravel records completed migrations in the migrations table and applies only the migrations that haven't run yet. You can safely run the command again after adding another migration.

Now create the model file at src/models/issue.rs:

use laravel::model::model;
use laravel::time::Timestamp;

#[model]
pub struct Issue {
    pub id: i64,
    pub title: String,
    pub description: String,
    pub created_at: Timestamp,
    pub updated_at: Timestamp,
}

Export the model from src/models/mod.rs, alongside the starter's existing model declarations:

mod issue;
pub use issue::Issue;

The #[model] macro maps Issue to the issues table and provides the model's query and serialization support. The model fields should match the columns you created in the migration.

For more on model declarations and conventions, see the Laravel Rust models guide.

4. Add handlers for listing, creating and editing issues

The handlers will do the server-side work. Create src/http/handlers/issues.rs:

use laravel::inertia::{self, Page, props};
use laravel::model::{create, update};
use laravel::prelude::*;

use crate::models::Issue;

#[laravel::input(fills = Issue)]
#[validate(anyone)]
pub struct IssueInput {
    #[validate(required, max_length(120))]
    pub title: String,

    #[validate(required, max_length(2000))]
    pub description: String,
}

pub async fn index() -> laravel::Result<Page> {
    let issues = Issue::query()
        .order_by(Issue::id.desc())
        .get()
        .await?;

    Ok(inertia::render("Issues/Index", props! { issues }))
}

pub async fn create() -> Page {
    inertia::render("Issues/Form", ())
}

pub async fn store(Valid(input): Valid<IssueInput>) -> laravel::Result<Redirect> {
    create!(Issue { ..input }).await?;

    Ok(redirect!(index))
}

pub async fn edit(issue: Issue) -> Page {
    inertia::render("Issues/Form", props! { issue })
}

pub async fn update(
    mut issue: Issue,
    Valid(input): Valid<IssueInput>,
) -> laravel::Result<Redirect> {
    update!(issue { ..input }).await?;

    Ok(redirect!(index))
}

Here's what matters in this file:

The input struct is the form contract. #[laravel::input(fills = Issue)] tells Laravel which model the input can fill. Only title and description are accepted for these writes; a client cannot sneak in an id or timestamp by adding extra request fields.

Validation happens before the handler runs. The title is required and limited to 120 characters. The description is required and limited to 2,000 characters. If validation fails, Laravel redirects a browser request back with errors. The handler never reaches the database write.

anyone is deliberate for this local demo. It allows visitors to submit the form without signing in. That makes the tutorial easier to run, but it is not an access-control setup for a public issue tracker. Before exposing a real app, require authentication and add authorization rules so users can only view or change issues they are allowed to access. Laravel's validation guide explains the anyone, authenticated and custom authorization options.

The Valid extractor is last. Both Valid<T> and Request read the request body, which can only be read once. Laravel requires a body-reading extractor to be the handler's final argument. That's why update takes the model first and Valid(input) second. See the handler argument documentation.

The list query orders by descending ID, so newly created issues appear first. The create! and update! macros write only the fields declared in IssueInput. After saving, both handlers redirect to the list, which then fetches the current database state.

Add the module to src/http/handlers/mod.rs:

pub mod issues;

Keep any existing module declarations in that file.

5. Register the web routes

Open src/routes/web.rs. Add this import alongside the other handler imports:

use crate::http::handlers::issues;

Inside the existing routes function, register the Issue Desk routes:

route.get("/issues", issues::index);
route.get("/issues/create", issues::create);
route.post("/issues", issues::store);
route.get("/issues/{issue}/edit", issues::edit);
route.patch("/issues/{issue}", issues::update);

Place these routes before the fallback route, if the starter has one. The {issue} segment matches the issue: Issue handler argument. Laravel resolves the model by its key and returns a 404 if the record doesn't exist.

These routes belong in the starter's web route group, which provides the session and CSRF middleware used by browser forms. Inertia's client reads the XSRF-TOKEN cookie and sends the token back with its requests. Don't remove CSRF protection to make a form submission work; check the route group and origin if you encounter a 419 response. See routing and model binding and CSRF protection for Inertia.

6. Build the React issue list

Create this directory if it doesn't exist:

resources/js/pages/Issues/

Add Index.tsx:

import { Link } from '@inertiajs/react';

type Issue = {
    id: number;
    title: string;
    description: string;
};

export default function Index({ issues }: { issues: Issue[] }) {
    return (
        <main className="mx-auto max-w-2xl space-y-6 p-6">
            <header className="flex items-center justify-between gap-4">
                <h1 className="text-2xl font-semibold">Issue Desk</h1>

                <Link className="underline" href="/issues/create">
                    New issue
                </Link>
            </header>

            {issues.length === 0 ? (
                <p>No issues yet. Create one to get started.</p>
            ) : (
                <ul className="space-y-4">
                    {issues.map((issue) => (
                        <li key={issue.id} className="space-y-2 rounded border p-4">
                            <h2 className="font-semibold">{issue.title}</h2>
                            <p className="whitespace-pre-wrap">{issue.description}</p>

                            <Link
                                className="underline"
                                href={`/issues/${issue.id}/edit`}
                            >
                                Edit <span className="sr-only">{issue.title}</span>
                            </Link>
                        </li>
                    ))}
                </ul>
            )}
        </main>
    );
}

The component name must match the string passed to inertia::render: Issues/Index. File and folder capitalization matters on case-sensitive filesystems.

The issues prop comes from the Rust handler. The Link component handles navigation through Inertia, so you don't need to build a separate JSON API just to move between these pages. The Inertia overview explains this server-routed approach.

7. Build one form for both create and edit

In the same directory, create Form.tsx:

import { Link, useForm } from '@inertiajs/react';
import type { FormEvent } from 'react';

type Issue = {
    id: number;
    title: string;
    description: string;
};

export default function IssueForm({ issue }: { issue?: Issue }) {
    const form = useForm({
        title: issue?.title ?? '',
        description: issue?.description ?? '',
    });

    function submit(event: FormEvent<HTMLFormElement>) {
        event.preventDefault();

        if (issue) {
            form.patch(`/issues/${issue.id}`);
        } else {
            form.post('/issues');
        }
    }

    return (
        <main className="mx-auto max-w-2xl space-y-6 p-6">
            <Link className="underline" href="/issues">
                Back to issues
            </Link>

            <h1 className="text-2xl font-semibold">
                {issue ? 'Edit issue' : 'New issue'}
            </h1>

            <form className="space-y-4" onSubmit={submit} noValidate>
                <div className="space-y-1">
                    <label className="block" htmlFor="title">Title</label>
                    <input
                        id="title"
                        name="title"
                        className="w-full rounded border p-2"
                        value={form.data.title}
                        onChange={(event) => form.setData('title', event.target.value)}
                        aria-required="true"
                        aria-invalid={Boolean(form.errors.title)}
                        aria-describedby={form.errors.title ? 'title-error' : undefined}
                    />

                    {form.errors.title && (
                        <p id="title-error" role="alert">{form.errors.title}</p>
                    )}
                </div>

                <div className="space-y-1">
                    <label className="block" htmlFor="description">Description</label>
                    <textarea
                        id="description"
                        name="description"
                        className="w-full rounded border p-2"
                        rows={5}
                        value={form.data.description}
                        onChange={(event) => form.setData('description', event.target.value)}
                        aria-required="true"
                        aria-invalid={Boolean(form.errors.description)}
                        aria-describedby={
                            form.errors.description ? 'description-error' : undefined
                        }
                    />

                    {form.errors.description && (
                        <p id="description-error" role="alert">
                            {form.errors.description}
                        </p>
                    )}
                </div>

                <button
                    className="rounded border px-4 py-2"
                    type="submit"
                    disabled={form.processing}
                >
                    {form.processing ? 'Saving…' : 'Save issue'}
                </button>
            </form>
        </main>
    );
}

The same component handles both routes. On the create page, issue is absent and the fields start empty. On the edit page, the handler passes the selected issue as a prop, so the form is pre-filled.

useForm tracks the values, processing state and validation errors. The submit handler calls post for a new issue and patch for an existing one. Disabling the button while form.processing is true prevents accidental repeat submissions while the request is in flight.

The form uses noValidate so the browser doesn't block an empty submission before it reaches Laravel. That lets you see the server-side validation path in action. In a production interface, you can add client-side hints too, but server-side validation must remain authoritative.

The form sends both editable fields on update. Although this example uses PATCH, it is a full edit form rather than a partial-field editor. If you later build truly partial updates, Laravel Rust supports Sometimes<T> so the handler can distinguish a field that was omitted from one explicitly set to null.

8. Run the app and try the complete flow

If laravel dev is still running, the development process watches Rust and frontend files and should rebuild as you make changes.

Open:

http://127.0.0.1:8000/issues

Try these steps:

  1. Select New issue.
  2. Leave the title blank, enter a description and select Save issue. The page should return with a title validation error, and the description should remain available.
  3. Enter a title such as Reports page needs a loading state and save again. The new issue should appear in the list.
  4. Select Edit, change the title and save. The list should show the updated title.
  5. Restart the development server and revisit /issues. The issue should still be there because SQLite stores the data in a file rather than in the running process's memory.

If a route doesn't appear, run:

laravel route:list

If the issues table is missing, check that Cargo.toml enables database-sqlite, verify the .env database URL, and run laravel migrate again. If Inertia cannot resolve a page, compare the component name in inertia::render with the exact file path and capitalization under resources/js/pages/.

9. Add HTTP tests for both paths

A tutorial feels more complete when it checks what happens after a request, not just whether the page renders.

Create tests/issues.rs:

use laravel::testing::prelude::*;

#[laravel::test]
async fn issue_appears_on_the_index_after_creation(app: Application) {
    let title = "Reports page needs a loading state";

    app.post("/issues")
        .form([
            ("title", title),
            ("description", "Show progress during slow requests."),
        ])
        .await
        .assert_redirect_to("/issues");

    app.assert_database_has("issues", json!({ "title": title }))
        .await;

    app.get("/issues")
        .await
        .assert_ok()
        .assert_inertia()
        .component("Issues/Index")
        .equals("issues.0.title", title);
}

#[laravel::test]
async fn issue_with_a_blank_title_is_rejected(app: Application) {
    app.post("/issues")
        .from("/issues/create")
        .form([
            ("title", ""),
            ("description", "Keep this value in the form."),
        ])
        .await
        .assert_redirect_back_with_errors(&["title"])
        .assert_session_has_input("description", "Keep this value in the form.");

    app.assert_database_empty("issues").await;
}

The first test submits a valid form, confirms that the handler redirects, checks that the row was written, and verifies that the Inertia list contains the new issue.

The second test simulates a form submitted from /issues/create with an empty title. It checks that Laravel redirects back with a validation error, flashes the description as old input, and leaves the issues table empty.

The starter's test configuration calls refresh_database(). Laravel gives each test an isolated database copy and rolls back its writes automatically, so the test data doesn't pollute your local development database. See the database testing guide and the starter's src/testing.rs.

Run the tests:

cargo test --test issues

Then run the frontend checks:

npm run check:fix
npm run check

check:fix applies the fixes supported by the starter's frontend tooling; check runs its formatting, lint and type checks.

Where to take Issue Desk next

You now have the basic pattern for a Laravel Rust feature: a route selects a handler, the handler validates input, the model writes to SQLite, and Inertia returns the result to React.

From here, sensible next steps are:

  • Add a status field and filter the list by open and closed issues.
  • Add authentication and an ownership rule so users only manage their own issues.
  • Add pagination when the list grows.
  • Add a delete action with a confirmation step.
  • Add a database constraint if a rule must also hold for writes that bypass HTTP validation.

The useful lesson is the connection between the pieces. React doesn't need to know how the database works, the handler doesn't need to build SQL by hand for ordinary model operations, and validation runs before the write. Once this flow makes sense, adding another resource becomes a matter of repeating a pattern you already understand.


Part B --- SEO package

SEO title: Build a Laravel Rust App with React and SQLite

Meta description: Build a Laravel Rust issue tracker with React, Inertia and SQLite. Follow the setup, migration, validation, CRUD and HTTP testing steps.

URL slug: build-laravel-rust-app-react-inertia-sqlite

Primary keyword: Laravel Rust tutorial

Secondary keywords: - Laravel Rust React - Laravel Rust Inertia - Laravel Rust SQLite - Laravel Rust starter app - Laravel Rust CRUD - Laravel Rust validation

Featured image concept: A clean 16:9 editorial illustration of a simple issue-tracker interface connected to a Rust backend and a SQLite database file. Show the flow from a React form through an application layer to a database, using restrained Rust-orange and Laravel-red accents. Avoid generic robot heads, floating code and fake screenshots. Suggested size: 1200 × 675 px or larger.

Image alt text: Laravel Rust issue tracker tutorial showing a React and Inertia form connected to a Rust backend and SQLite database.

Suggested internal links: 1. Laravel Rust vs Laravel PHP: What's Different and Which One Should You Choose? 2. Exploring Laravel Rust ORM: Database Models, Queries and Migrations. 3. Laravel Inertia Forms: Handling Validation Errors with React.

Update recommendation: Revisit the tutorial when Laravel Rust reaches version 1.0. Recheck CLI commands, starter structure, dependency features, validation APIs and test helpers.


Part C --- Sources and fact verification

  1. Laravel Rust installation guide
    Verifies Rust and Node.js prerequisites, CLI installation, project creation, default React/Inertia/TypeScript starter, SQLite feature configuration, database URL and development command.

  2. Laravel Rust handlers, validation and CSRF protection
    Verifies handler organisation, Valid<T> extraction order, input authorization, model binding, validation behaviour and Inertia's CSRF handling.

  3. Laravel Rust migrations, schema builder and testing
    Verifies migration generation and execution, schema definitions, database test isolation and the HTTP/database assertion methods used in the tutorial.

  4. Laravel Rust 0.x starter repository
    The Cargo.toml, package.json and src/testing.rs files were used to check the starter's dependency features, frontend scripts and default test configuration. SQLite's official datatype documentation verifies that SQLite does not enforce declared VARCHAR(n) lengths.

Verification notes:

  • Research reflects the official Laravel Rust documentation and 0.x starter repository available on December 3, 2026.
  • Laravel Rust is in beta. The installation documentation warns that pre-1.0 releases may include breaking API and configuration changes.
  • SQLite does not enforce VARCHAR(120) as a maximum length. The example's max_length(120) validation rule enforces the limit for requests passing through this handler; direct database writes need a database-level constraint if the same guarantee is required.
  • #[validate(anyone)] is intentionally permissive for a local demo. It is not suitable as the authorization policy for a public issue tracker.
  • The examples were checked against the official documentation and starter structure but were not independently compiled or run. Verify them against the current beta before using them in a production application.
Discussion

Comments

No comments yet. Be the first to comment.

Browse the project library

Projects to explore next

Source-code projects from the KritiMyantra catalogue. Check each project's details before buying.

All projects