This project is a simple backend for an e-commerce application built using Rust, Actix Web, and PostgreSQL. It supports user authentication, product browsing, shopping cart management, and checkout functionality.
- ✅ User Sign-Up & Login with JWT
- ✅ Product Listing & Search
- ✅ Add to Cart, View Cart, Remove Item from Cart
- ✅ Checkout functionality
- ✅ PostgreSQL integration using SQLx
- Backend: Rust, Actix Web
- Database: PostgreSQL
- Querying: Raw SQL queries via
sqlx
- Authentication: JWT
Method | Endpoint | Description |
---|---|---|
POST | /signUp |
Register new user |
POST | /logIn |
Login user |
Method | Endpoint | Description |
---|---|---|
GET | /product/all |
Get all products |
GET | /product/{id} |
Get product by ID |
POST | /search |
Search for a product |
Method | Endpoint | Description |
---|---|---|
GET | /create_cart |
Create a cart for a user |
POST | /addToCart |
Add product to user's cart |
GET | /myCart |
View all items in the cart |
GET | /flushCart |
Remove all items from cart |
GET | /removeItem-crat |
Remove an item or reduce qty |
Method | Endpoint | Description |
---|---|---|
GET | /checkout |
Proceed to checkout |
- Rust (latest stable)
- PostgreSQL installed and running
- sqlx-cli for database setup
# Clone the repository
git clone https://github.com/your-username/your-repo-name.git
cd your-repo-name
# Set your environment variables in `.env`
DATABASE_URL=postgres://username:password@localhost/database
JWT_SECRET=your_secret_key
STRIPE_SECRET=stripe_secret_key
# Run the project
cargo run