Minimum Required Rust Version: 1.75.0
async trait
This repository contains a Rust Axum-based web application with SQLx, PostgreSQL database, and authentication features for a SaaS template. Follow the steps below to set up and run the project.
-
Install sqlx-cli:
cargo install sqlx-cli
-
Run the Database Setup Script: Execute the following commands in your terminal:
./db.sh sqlx-cli db setup
-
Run the Application:
cargo run
Ensure that you can successfully run the application in development mode before proceeding.
-
Run the Build Script:
./build.sh
-
Run Docker Compose:
docker-compose up
-
Home:
- Method:
GET
- URL:
{{base_url}}/
- Method:
-
Login Form:
- Method:
GET
- URL:
{{base_url}}/login
- Method:
-
Login:
- Method:
POST
- URL:
{{base_url}}/api/auth/login
- Body:
{ "email": "{{email}}", "password": "{{password}}" }
- Method:
-
Protected Resource:
- Method:
GET
- URL:
{{base_url}}/api/protected
- Method:
-
Register:
- Method:
POST
- URL:
{{base_url}}/api/auth/register
- Body:
{ "username": "haheho", "email": "[email protected]", "password": "Doplhin123!" }
- Method:
-
User email verification:
- Method:
POST
- URL:
{{base_url}}/api/auth/verify-email/:token
- Method:
-
Send Reset Password:
- Method:
POST
- URL:
{{base_url}}/api/auth/reset-password
- Body:
{ "email": "[email protected]" }
- Method:
-
Verify Reset Password:
- Method:
POST
- URL:
{{base_url}}/api/auth/reset-password/:token
- Body:
{ "password": "Dolphin123!" }
- Method:
- base_url: Set your base URL.
- email: Set the email for testing.
- password: Set the password for testing.
This project is inspired by and incorporates elements from the following repositories:
- Realworld Axum SQLx by David Pedersen
- Rust Axum Course by Jeremy Chone
- Cargo Chef by Luke Math Walker
- Lucia Auth by pilcrow
A big thank you to the contributors of these projects for their valuable insights and code contributions. And chat GPT cause all this message generated by it LOL!