Building a Full-Stack Rust Application with Inertia.js, React and TypeScript
Published on by Aleksandar Cvetanovski
Building a Full-Stack Rust Application with Inertia.js, React and TypeScript
Exploring a different backend ecosystem doesn't mean abandoning the development workflow you already enjoy. This project started with an interesting question: Can I build a modern full-stack application with Rust while keeping the developer experience of Laravel and Inertia.js?
The answer is yes.
I built a full-stack application using Rust, Axum, Inertia.js v3, React, TypeScript, PostgreSQL and Tailwind CSS 4. The goal was to explore Rust as a backend technology and understand how Inertia.js can connect a Rust server with a modern React frontend.
The Architecture
The application follows a server-driven architecture.
Rust handles routing, HTTP requests, business logic, authentication, database operations and server-side validation. React handles the user interface and interactive components, while Inertia.js connects both sides without requiring a separate REST API or a dedicated client-side router for normal page navigation.
This approach keeps the application organized while allowing the backend and frontend to use technologies suited to their responsibilities.
Technology Stack
The project combines the following technologies:
-
Rust – Backend programming language.
-
Axum – HTTP routing and request handling.
-
Inertia.js v3 – Communication between the backend and frontend.
-
React – Component-based user interface.
-
TypeScript – Type safety across frontend components.
-
PostgreSQL – Relational database.
-
SQLx – Asynchronous database queries and migrations.
-
Tailwind CSS 4 – Utility-first styling.
-
Vite – Frontend development and production builds.
-
Tower Sessions – Persistent server-side session management.
Authentication and Security
One of the main objectives was to implement authentication and authorization properly rather than creating a frontend-only demonstration.
The application includes:
-
User registration and login.
-
Secure password hashing using Argon2id.
-
Persistent server-side sessions stored in PostgreSQL.
-
Session ID and CSRF token rotation during authentication.
-
CSRF protection for state-changing requests.
-
Protected dashboard routes.
-
Role-based administrator access.
-
Secure session cookie configuration.
-
Generic authentication error messages to avoid exposing account information.
Passwords are never stored or logged in plaintext, and sensitive password hashes are excluded from frontend page properties.
User Management
The application also includes an administrator area for managing registered users.
Administrators can search accounts by name or email, filter users by role, create new accounts, view account details, update user information and delete accounts.
Authorization is enforced on the Rust backend, ensuring that administrative functionality is not accessible simply by manipulating the frontend.
Database Integration
PostgreSQL is used for persistent application data and session storage.
SQLx handles database communication and migrations. Database migrations are applied automatically when the application starts, keeping the development workflow straightforward.
The implementation also uses parameterized SQL queries to prevent user input from being directly concatenated into database statements.
Project Structure
I organized the application into separate backend and frontend responsibilities.
The Rust backend contains dedicated modules for authentication, configuration, database connections, CSRF protection, HTTP responses and application features.
The React frontend is organized around Inertia pages, reusable components, shared layouts and TypeScript definitions.
This separation makes it easier to maintain the application and introduce additional features without putting everything into a single module.
What I Learned
Coming from a PHP and Laravel background, working with Rust introduced a different way of thinking about backend development.
Some of the most interesting parts were:
-
Working with Rust's type system and ownership model.
-
Building HTTP middleware and authentication flows with Axum.
-
Integrating an Inertia.js adapter outside the Laravel ecosystem.
-
Managing asynchronous database operations with SQLx.
-
Implementing secure session and CSRF handling.
-
Structuring a full-stack application without relying on a traditional PHP framework.
An important part of this experiment was working with the Rust Inertia adapter, which is still in alpha. The project uses a pinned Git revision of the adapter rather than assuming a stable production release.
What's Next?
This project is a foundation for further experimentation with Rust and Inertia.js.
Potential next steps include expanding the application with additional business features, improving the architecture, exploring server-side rendering and evaluating how this stack performs as the application grows.
Final Thoughts
I primarily work with Laravel, but I enjoy exploring technologies outside my usual stack.
This project demonstrates that the Inertia.js development model can extend beyond Laravel and PHP. Rust provides the backend foundation, React delivers the frontend experience, and Inertia connects them into a cohesive full-stack application.
The source code is available on GitHub:
github.com/calexandar/my-first-rust-app
The screenroll of the landing page on YouTube: