DEV Community

Cover image for I Built a Complete E-commerce REST API with Laravel 12 — Here's What's Inside
Decilap
Decilap

Posted on

I Built a Complete E-commerce REST API with Laravel 12 — Here's What's Inside

Building an e-commerce backend from scratch takes months. Authentication, payments, inventory, shipping, admin panel, tests… the list never ends.

I decided to build it once, properly, and package it for other developers. The result is LaraCommerce API — a complete, production-ready e-commerce backend built with Laravel 12.

WHAT I BUILT

A fully-featured REST API covering every e-commerce use case, with an admin panel, full Stripe integration, and 100% test coverage.

THE NUMBERS

API Endpoints: 325+ across 25+ modules
Database: 88 Eloquent models, 72 migrations
Admin Panel: Filament v3 with 46 screens
Tests: 2,452 tests / 100% coverage
Docker: 12 services, one-command setup
Languages: 3 (EN, FR, AR)
Currencies: 7 (USD, EUR, GBP, MAD, CAD, CHF, AED)

TECH STACK

Framework: Laravel 12 (PHP 8.5+)
Auth: Laravel Sanctum (access + refresh tokens)
Roles: Spatie Permissions (3 roles, 57 permissions)
Admin: Filament v3
Payments: Stripe PHP SDK
Search: Meilisearch + Laravel Scout
Storage: MinIO / AWS S3
Queue: Redis + Laravel Horizon
Database: MySQL 8.4
Infrastructure: Docker Compose + Nginx SSL

MODULES BREAKDOWN

Authentication & Security

Not just basic login/register. The API supports:

Sanctum dual-token system (access + refresh)
Social OAuth (Google, Facebook, Apple)
Email verification with resend
Password reset flow
Rate limiting with 3 tiers (standard, auth, strict)
Security headers middleware
Role-based access control (customer, manager, admin)

Product Catalog

Products with unlimited variants (size, color, custom attributes)
Nested categories, brands, tags, collections
Product images via MinIO/S3
Translations (EN, FR, AR with RTL support)
Flash sales with countdown
Product bundles with discount
Volume-based price tiers

Cart & Checkout

Persistent cart with coupon application
Coupon types: percentage, fixed, BOGO, free shipping
Smart shipping rate calculation (flat, weight-based, price-based, free)
Tax calculation
Stock deduction at checkout

Stripe Payments

This was one of the most complex parts to get right:

PaymentIntents API with 3D Secure / SCA
Saved payment methods per customer
Webhook event handlers
Refund processing with validation and audit trail
Internal wallet system
Cash-on-delivery support

Orders & Returns

Full order lifecycle (pending → confirmed → shipped → delivered)
Status history tracking
Automatic invoice generation
Cancellation workflow
Return request processing

Multi-Warehouse Inventory

Stock tracked per variant per warehouse
Movement logs with before/after quantities
Negative stock prevention
Low stock alerts
Automatic reorder notifications

Marketing Suite

Coupons & promotions engine
Flash sales with countdown timers
Product bundles
Banners management
Newsletter campaigns
Abandoned cart tracking

Loyalty & Retention

Points system (earn & redeem)
Digital gift cards
Affiliate program with conversion tracking
Customer group segmentation

Search

Meilisearch full-text search
Typo tolerance
Faceted filtering
Price range filters
Autocomplete suggestions
Multiple sort options

Notifications

Email notification templates
In-app notifications
Push notifications (Firebase FCM)
Custom webhook endpoints with delivery logs

ADMIN PANEL

46 fully-configured Filament v3 screens covering:

Dashboard with live sales stats
Order management with refund integration
Product management with variants, images, translations
Inventory with stock adjustments
Customer management with order history
Coupon & promotion management
Shipping configuration
Blog & content management
Full activity audit log

TESTING: 100% COVERAGE

Every controller, service, model, middleware, and policy is tested.
2,452 tests with 4,808 assertions.

Built to be reliable — no guesswork.

DOCKER: ONE COMMAND

docker compose up -d

That’s it. Everything runs instantly with all required services.

WHO IS THIS FOR?

Developers building mobile apps
Developers building web frontends (React, Vue, Next.js…)
Agencies needing a reusable e-commerce base
Anyone tired of rebuilding the same backend logic

GET IT

LaraCommerce API is available at:
https://amazscript.com/products/laracommerce-api-complete-e-commerce-backend-laravel-12-x9jkbo

Top comments (0)