Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dioxus Full‑Stack Starter Template

This project builds on the default Dioxus starter application generated by dx create. The initial boilerplate has been extended into a complete full‑stack template consisting of a Dioxus Web client, an Axum server, and a shared model layer. It includes authentication, session management, user maintenance screens, and a SQLite‑backed API. The goal is to provide a reusable foundation for new applications so common functionality does not need to be rebuilt for every project.


Overview

The template is split into two independent packages:

  • client — a Dioxus Web application compiled to WASM
  • server — an Axum HTTP API with session‑based authentication
  • shared — common types used by both packages (e.g., User, LoginRequest)

This structure keeps concerns cleanly separated.


Included Functionality

Authentication & Security

  • Login form and API endpoint
  • Session cookie management
  • Server‑side session validation
  • Role‑based access control (Admin vs User)

User Administration

  • User listing screen
  • Create/edit user form
  • Delete user workflow with confirmation modal
  • Active/inactive user state
  • Shared User model between client and server

Backend

  • Axum router with modular handlers
  • SQLite database using SQLx
  • Database initialization logic
  • Environment‑driven configuration (RUST_SERVER_URL, etc.)
  • Basic unit tests for core logic

Frontend

  • Dioxus component structure
  • Navigation and routing
  • Signals for state management
  • Async API calls using gloo-net
  • Error handling and loading states

Why This Template Exists

Building a new Dioxus project often requires re‑implementing the same foundational pieces:

  • login flow
  • session handling
  • user management
  • API wiring
  • database setup
  • shared types

This template provides all of these components pre‑built so new projects can start from a stable, production‑ready baseline. It reduces boilerplate and accelerates development by letting you focus on application‑specific features rather than infrastructure.


Project Layout

project/
├─ client/
│  ├─ assets/
│  ├─ src/
│     ├─ components/
│     ├─ pages/
│     ├─ services/
│     ├─ state/
│
├─ server/
│  ├─ src/
│     ├─ sql/
│
├─ shared/
   ├─ src/

Getting Started

Server

  1. Set required environment variables:

    • RUST_SERVER_URL — server bind address (eg. '127.0.0.1:3000')
    • RUST_CLIENT_URL — client bind address (eg. 'https://127.0.0.1:8080')
    • RUST_DB_PATH — path for the default sqlite users.db file (eg. 'C:\db_data\')
    • RUST_ADMIN_EMAIL — admin user's email address (eg. 'initial_admin@email.com')
    • RUST_ADMIN_PASSWORD — admin user's temporary password which has to be changed at first login (eg. 'Rust1s@wesome')
  2. Start the server:

    cargo run -p server

    or

    dx serve --package server

Client

  1. Set required environment variables:

    • RUST_SERVER_URL — server bind address (eg. '127.0.0.1:3000')
  2. Start the client:

    dx serve --package client --platform web --port 8080
  3. Open a new tab in your browser and paste in your client url (eg. 'http://127.0.0.1:8080')

  4. Log into the application using the initial admin credentials and provide a new password

  5. In the user maintenance section, add a new admin and delete the initial admin (recommended once custom emailing code has been set up to send password reset link)

About

Full‑stack template consisting of a Dioxus web client package, and an Axum server package, with authentication, session management, and user maintenance, all written in Rust.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages