Rust + React Admin Template with Axum, SQLx and Vite – Open Source

Rust + React Admin Template with Axum, SQLx and Vite – Open Source


Introducing

Building admin panels often involves setting up the same foundational patterns: authentication, user management, CRUD operations, and API documentation. After working on several such projects, I decided to create rustzen-admin - a starter template that combines Rust backend with React frontend.

🎯 The Motivation

Every time I started a new project requiring an admin interface, I found myself:

This repetitive setup work inspired me to build a template that provides a solid foundation while demonstrating modern development practices.

🛠️ Technology Stack

Backend: Rust + Axum

I chose Rust for the backend to leverage its performance and type safety:

Frontend: React + Modern Tooling

For the frontend, I used current React ecosystem tools:

🏗️ Project Structure

The template follows a clean, modular architecture:

rustzen-admin/
├── backend/         # Rust (Axum) API Service
├── frontend/        # React (Vite) Admin UI
├── docker/          # Docker configuration files
├── docs/            # Project documentation
├── justfile         # Command runner
└── README.md

Backend Architecture

Each feature module follows a consistent pattern:

features/
├── user/
│   ├── model.rs      // Data structures & validation
│   ├── repo.rs       // Database operations
│   ├── service.rs    // Business logic
│   ├── routes.rs     // HTTP handlers
│   └── mod.rs        // Module exports

This separation makes the code:

✨ Current Features

🔧 Development Setup

🗃️ Backend Foundation

🎨 Frontend Scaffold

🔄 Type Safety & Development Experience

📚 Documentation

🚀 Getting Started

The setup process is straightforward:

# Clone the repository
git clone https://github.com/idaibin/rustzen-admin.git
cd rustzen-admin

# Set up environment variables
cp backend/.env.example backend/.env

# Install frontend dependencies (Node.js 24+ recommended)
cd frontend && pnpm install && cd ..

# Start development environment
just dev

The just dev command will:

  1. Start PostgreSQL with Docker Compose
  2. Start the Rust backend with hot reload
  3. Start the React frontend with Vite
  4. Open browser to http://localhost:5173

🎨 Code Examples

Type-Safe API Contracts

Frontend and backend share the same type definitions, ensuring consistency:

// Backend: Rust types
#[derive(Debug, Serialize, Deserialize)]
pub struct User {
    pub id: Uuid,
    pub username: String,
    pub email: String,
    pub created_at: DateTime<Utc>,
}
// Frontend: TypeScript types (auto-generated or manually synced)
interface User {
  id: string;
  username: string;
  email: string;
  created_at: string;
}

Error Handling Pattern

#[derive(Debug, thiserror::Error)]
pub enum UserError {
    #[error("User not found: {id}")]
    NotFound { id: Uuid },
    #[error("Database error: {0}")]
    Database(#[from] sqlx::Error),
}

Repository Pattern

#[async_trait]
pub trait UserRepository {
    async fn find_by_id(&self, id: Uuid) -> Result<Option<User>, UserError>;
    async fn create(&self, user: CreateUser) -> Result<User, UserError>;
}

🔮 What’s Next

This template provides a foundation that can be extended with:

Want to contribute? We welcome issues and pull requests! The roadmap is community-driven.

🤝 Contributing

The project is MIT licensed and open to contributions. Areas where help would be appreciated:

🎉 Conclusion

rustzen-admin is a starting point for building admin systems with Rust and React. It’s not a complete solution but rather a foundation that demonstrates clean architecture patterns, modern tooling integration, and type-safe full-stack development.

The current version includes mock data endpoints to enable rapid frontend development while the backend architecture is being finalized. This approach allows teams to work in parallel and iterate quickly.

If you’re looking to start an admin project with Rust backend, this template might save you some initial setup time while providing a structure to build upon.

Links:

What do you think? Have you worked with similar tech stacks? I’d love to hear your experiences and suggestions!


Happy coding! 🦀⚛️