This is a sample e-commerce website demonstrating the Axum web framework and Sqlx drivers, written in Rust. Comes with a frontend written in HTML, CSS, and vanilla Javascript.
This package is meant to be an example/reference for beginners on how they might implement a webserver API using Rust. It should thus not be used for any serious application as it was not built with practicality and security in mind.
The project aims to demonstrate the development of a full-stack web application using Rust for the backend and HTML, CSS, and JavaScript for the frontend. It leverages the Axum web framework in Rust to create a RESTful API and serves static HTML, CSS, and JavaScript files as the frontend interface.
- Rust (version 1.69.0+)
- Cargo (Rust's package manager)
- HTML5
- CSS3
- JavaScript (ES6+)
The project is fairly simple to get up and running, in fact, it boils down to only a couple of steps.
- Install Rust
You can install Rust by following the official guide
- Clone the repository
git clone https://github.com/Wolfus20/e-commerce-website.git
- Create a .env file with all the relevant fields
You can copy the .env.example file provided and the only field you have to manually enter is JWT_SECRET, which will be used by the JWT token encoded/decoder
- Run the project just like any other Rust project
Run the non-optimized, dev version:
cargo run
or the optimized verion:
cargo run --release
You'll know it's working when you see
Listening on 127.0.0.1:3000
The databases will be automatically created with the appropriate tables by the migrations upon startup.
Simply open your browser and enter in the url "http://127.0.0.1:3000/"