Specialized instructions and patterns for building production-ready eCommerce systems with Laravel 13.
This skill provides advanced guidance for building, securing, and scaling eCommerce applications within this workspace.
with()) for all product listings and indexes for high-query fields like slug or sku.For a scalable store, don't put everything in the products table.
products: General info (name, description, brand).product_variants: Specific options (price, SKU, stock, size, color).categories: Nested using a parent_id (Adjacency List) or nested set for complex trees.order_items: Snapshots of the product price/name at the time of purchase to prevent old data from changing historical receipts.products.slug (for SEO)product_variants.sku (for inventory tracking)orders.user_idorders.status (for dashboard filtering)Supabase is the recommended managed database for this project.
In Supabase, use the Transaction Mode (usually port 6543) for Laravel.
DB_CONNECTION: pgsqlDB_HOST: Found in Settings > Database > Connection pooler.DB_PORT: 6543 (Transaction Mode) or 5432 (Session Mode).DB_DATABASE: postgres (default).ilike and @@ (full-text search) natively in Eloquent for product searching.jsonb column without strict schema.orders table changes to update admin dashboards instantly.Whenever working on eCommerce features, ensure:
Instead of putting order logic in Controllers, use a OrderService:
class OrderService {
public function createOrder(User $user, array $data) {
return DB::transaction(function() use ($user, $data) {
$order = $user->orders()->create($data);
// ... logic ...
return $order;
});
}
}
For real-time updates:
#[On('cart-updated')] to sync multiple components.wire:loading for better UX during network calls.The primary roadmap can be found in the workspace root or artifact ecommerce_laravel_roadmap.md.