Thanks to visit codestin.com
Credit goes to github.com

Skip to content

yenHunter/Sodai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce Order Management System (Laravel 12)

A high-performance, scalable REST API for managing e-commerce operations. Built with modern Laravel architecture (Actions, Repositories, Enums) and strict typing.

🚀 Core Features

  • Inventory Management: Real-time stock tracking with pessimistic locking to prevent race conditions.
  • Product Search: Integrated database search (Searchable by Name, Description, or SKU).
  • Order Processing:
    • Atomic Database Transactions.
    • Automatic Invoice PDF Generation (Queued).
    • Smart Inventory Rollback on Cancellation.
  • Security: JWT Authentication with Role-Based Access Control (RBAC).

🛠 Tech Stack

  • Framework: Laravel 12 (PHP 8.3)
  • Database: MySQL 8
  • Auth: PHP-Open-Source-Saver JWT Auth
  • Queue: Database Driver (Async Jobs)
  • PDF: DomPDF

⚙️ Installation Guide

1. Prerequisites

  • PHP 8.2 or higher (with sodium and fileinfo extensions enabled)
  • Composer
  • MySQL

2. Setup

# Clone Repository
git clone <your-repo-url>
cd project-name

# Install Dependencies
composer install

#Build assets
npm install
npm run build

# Environment Setup
cp .env.example .env
php artisan key:generate

# JWT Setup
php artisan jwt:secret

3. Database & Migrations

Configure your .env file with database credentials, then run:

php artisan migrate:fresh --seed

4. Run the Application

You need two terminals open: Terminal 1 (API Server):

php artisan queue:work

🔑 API Documentation

Authentication

  • Header: Authorization: Bearer <token>
Method Endpoint Description Body
POST /api/v1/auth/login Login {email, password}
POST /api/v1/auth/register Register {name, email, password, role}

Products

Method Endpoint Role Description
GET /api/v1/products?q=nike Public Search products
POST /api/v1/products Vendor Create product {name, variants: [...]}

Orders

Method Endpoint Role Description
POST /api/v1/orders Customer Place order {items: [{variant_id, qty}]}
PATCH /api/v1/orders/{id}/cancel Customer Cancel & Restore Stock
GET /api/v1/my-orders Customer View Order History

🧪 Testing Strategy

This project uses PHPUnit for feature testing.

Run Tests:

php artisan test

Test Credentials

Now you can login with these credentials in Postman:

Role: Customer (For Buying)

Role: Vendor (For creating more products)

Role: Admin

👤 Author

LinkedIn Fork me on GitHub

About

Multi vendor e-commerce admin panel and RESTful API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published