Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ AlgShop Backend

Laravel REST API backend for the AlgShop e-commerce marketplace.

AlgShop Backend provides the server-side API for AlgShop, handling authentication, shops, products, shopping carts, checkout, orders, addresses, reviews, and seller workflows.

The backend is built with Laravel 12, PHP, and a MySQL-compatible database.


πŸ”— Related Project

Frontend

https://github.com/amarmaruf6800-collab/algshop-frontend

Live Demo

https://algshop.vercel.app

The current demo uses simulated payment processing for development and demonstration purposes.


✨ Features

πŸ” Authentication

  • User registration
  • User login
  • Laravel Sanctum authentication
  • Protected API endpoints
  • Authenticated user profile access

πŸͺ Shop Management

  • Create a seller shop
  • Manage seller shop data
  • Associate products with individual shops
  • Buyer and seller workflows

πŸ“¦ Product Management

  • Create products
  • Update products
  • Delete products
  • Product pricing
  • Discount management
  • Stock management
  • Multiple product images
  • Product catalog API

πŸ›’ Shopping Cart

  • Add products to cart
  • View cart
  • Update cart data
  • Remove cart items
  • User-specific cart
  • Prevent users from purchasing products from their own shop

πŸ“ Address Management

  • Add shipping addresses
  • Edit addresses
  • Delete addresses
  • Set default address
  • Manage user-specific addresses

🧾 Checkout & Orders

  • Checkout cart
  • Select shipping address
  • Group orders by seller/shop
  • Generate invoice numbers
  • Create order items
  • Deduct product stock during checkout
  • Buyer order history
  • Seller incoming orders
  • Seller order status management

πŸ’³ Payment Flow

  • Invoice-based payment flow
  • Simulated payment endpoint
  • Payment status handling

Note: The current implementation uses a simulated payment endpoint and does not represent a live payment gateway integration.

⭐ Reviews

  • Product ratings from 1–5 stars
  • Review comments
  • Verified-purchase review validation
  • Prevent duplicate reviews from the same user

🧱 Architecture

                     ALGSHOP

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        React + Vite Frontend     β”‚
β”‚                                  β”‚
β”‚ Catalog β€’ Cart β€’ Checkout        β”‚
β”‚ Orders β€’ Seller Dashboard        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚
                β”‚ HTTP / REST API
                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Laravel 12 API          β”‚
β”‚                                  β”‚
β”‚ Sanctum Authentication           β”‚
β”‚ Product β€’ Shop β€’ Cart APIs       β”‚
β”‚ Order β€’ Address β€’ Review APIs    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚
                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       MySQL-compatible DB         β”‚
β”‚                                  β”‚
β”‚ Users β€’ Shops β€’ Products         β”‚
β”‚ Orders β€’ Cart β€’ Reviews          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The frontend is deployed separately from the Laravel backend.


πŸ› οΈ Tech Stack

Backend

  • PHP
  • Laravel 12
  • Laravel Sanctum
  • Laravel Breeze
  • Eloquent ORM

Database

  • MySQL / MariaDB-compatible database

Frontend Integration

  • REST API
  • JSON
  • HTTP authentication

Deployment

  • VPS backend deployment
  • Vercel frontend deployment

πŸ“ Project Structure

algshop-backend/
β”‚
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ Http/
β”‚   β”œβ”€β”€ Models/
β”‚   └── ...
β”‚
β”œβ”€β”€ bootstrap/
β”œβ”€β”€ config/
β”œβ”€β”€ database/
β”‚   β”œβ”€β”€ migrations/
β”‚   └── seeders/
β”‚
β”œβ”€β”€ public/
β”œβ”€β”€ resources/
β”œβ”€β”€ routes/
β”‚   └── api.php
β”‚
β”œβ”€β”€ storage/
β”œβ”€β”€ artisan
β”œβ”€β”€ composer.json
β”œβ”€β”€ composer.lock
└── README.md

πŸ”‘ API Overview

The API is organized around the main marketplace workflows.

Authentication

POST /api/login
POST /api/register

Catalog

GET /api/katalog
GET /api/produk/{id}

Buyer

GET    /api/keranjang
POST   /api/keranjang/{product_id}
POST   /api/checkout-keranjang

GET    /api/alamat
POST   /api/alamat
PUT    /api/alamat/{id}
DELETE /api/alamat/{id}
PUT    /api/alamat/{id}/default

POST   /api/bayar-simulasi
GET    /api/riwayat-belanja
POST   /api/produk/{id}/ulasan

Seller

POST   /api/buka-toko

GET    /api/toko-saya/produk
POST   /api/toko-saya/produk
POST   /api/toko-saya/produk/{id}
DELETE /api/toko-saya/produk/{id}

GET    /api/pesanan-masuk
PUT    /api/pesanan/{id}/status

πŸš€ Run Locally

Requirements

  • PHP 8.2+
  • Composer
  • MySQL / MariaDB-compatible database
  • Node.js and npm for the frontend

1. Clone the repository

git clone https://github.com/amarmaruf6800-collab/algshop-backend.git

cd algshop-backend

2. Install PHP dependencies

composer install

3. Configure environment

Create the environment file:

cp .env.example .env

Configure the database and application settings in .env.

4. Generate application key

php artisan key:generate

5. Run migrations

php artisan migrate

6. Create storage link

php artisan storage:link

7. Start the development server

php artisan serve

πŸ” Environment Variables

Do not commit production credentials or secrets to GitHub.

Configure environment-specific values in .env.

Example:

APP_NAME=AlgShop
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=algshop
DB_USERNAME=your-user
DB_PASSWORD=your-password

πŸ“Œ Project Highlights

AlgShop Backend demonstrates practical backend development through:

  • REST API development with Laravel
  • Authentication with Laravel Sanctum
  • Role-based buyer and seller workflows
  • Product and shop management
  • Shopping cart implementation
  • Checkout and order processing
  • Stock deduction during checkout
  • Shipping address management
  • Product review validation
  • Relational database integration
  • Frontend/backend API integration

🎯 Marketplace Workflow

User
 ↓
Authentication
 ↓
Browse Catalog
 ↓
Product Detail
 ↓
Shopping Cart
 ↓
Checkout
 ↓
Payment Simulation
 ↓
Order Creation
 ↓
Stock Deduction
 ↓
Seller Order Management

πŸ‘¨β€πŸ’» Author

Amar

Junior Web Developer | Full-Stack Enthusiast

Information Technology / Web Development

About

Laravel REST API backend for the AlgShop e-commerce marketplace.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages