AkhilSharma90 / Rust-Yew-JWT-Auth

Code from 2 videos on my channel - JWT Auth for Rust and Yew front ends with Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust - JWT Authentication with Actix Web with front end in Yew

This code is from two videos - JWT authentication in Rust and Yew (Build Front Ends with Rust).

Instructions

  • cd into the front end folder and run trunk build
  • then run trunk serve --port 3000
  • open your web browser on localhost:3000
  • cd into backend folder and run docker-compose up -d
  • ensure sqlx-cli is installed cargo install sqlx-cli
  • then run sqlx migrate run
  • then run cargo run
  • you can also run the backend directly, without the front-end with the collections Rust HS256 JWT.postman_collection.json

Topics Covered backend

  • Run the Actix-Web JWT Project Locally
  • Setup the Rust Project
  • Setup Postgres and pgAdmin with Docker
  • Load the Environment Variables
  • Create the SQL Queries and Run the Migrations
  • Create the Database Model
  • Create the Response Structs
  • Create the JWT Actix-Web Middleware Guard
  • Implement the JWT Authentication Flow
    • Register User Route Handler
    • Login User Route Handler
    • Logout User Route Handler
    • Get Authenticated User Route Handler
    • Merge the Route Handlers
  • Register the Routes Config and Add CORS
  • Test the JWT Authentication Flow
    • Create a New User
    • Sign-in User
    • Access Protected Route
    • Logout User

Topics Covered front end

  • Run the Yew.rs JWT Frontend App Locally
  • Run the Yew.rs Web App with a Rust API
  • Scaffold the Yew Project
  • Setup Tailwind CSS for Styling
  • Define the API Requests with the Reqwasm Crate
    • API Response Types
    • Create the API Requests
  • Setup a Global Store with the Yewdux Library
  • Create Reusable Yew Components
    • Create a Spinner Component
    • Create a Loading Button Component
    • Create a Notification Toast Component
    • Create a Form Input Component
    • Create a Header Component
  • Implement the Authentication Flow
    • Create the Account Registration Page
    • Create the Account Login Page
    • Add the Logout Functionality to the Header
  • Create the Remaining Yew Pages
    • Create the Home Page Component
    • Create the Profile Page Component
  • Setup Routes using the Yew Router Crate
  • Render the Yew Application in the Main File
  • Test the Yew Application in the Browser
    • Visit the Home Page
    • Register a New User
    • Login the User
    • Access the Protected Page

About

Code from 2 videos on my channel - JWT Auth for Rust and Yew front ends with Rust


Languages

Language:Rust 95.2%Language:Makefile 2.1%Language:JavaScript 1.5%Language:HTML 0.8%Language:CSS 0.4%