How avored/laravel-ecommerce works
Project type and purpose
• This is a monorepo for AvoRed, a headless e-commerce solution.
• The “laravel-backend” folder implements a GraphQL API in Laravel (with modules for payments, shipping, dummy data, etc.).
• There are two independent SPAs consuming the API:
• react-frontend (React + TypeScript + Redux Toolkit + GraphQL)
• A Vue-based frontend under “src” (Vue 3 + Vuex + Vue Router + i18n + GraphQL)
Main components
a. Laravel Backend
• HTTP server + PHP-FPM / Artisan CLI
• GraphQL endpoint (/graphql)
• Laravel MVC layers: Controllers → Services/Modules → Models
• Modules directory (cash-on-delivery, pickup, dummy-data)
• Database (MySQL/Postgres)
• Cache / Queue (Redis) and Storage (local or S3)
• Authentication (Laravel Sanctum / Tokens)
b. React Frontend
• Redux store slices (cart, checkout, userLogin, flash, counter)
• Apollo Client or GraphQL fetch layer
• Components tree (Pages → Layouts → UI components)
• Static assets served via webpack/Vite/dev server
c. Vue Frontend
• Vue Router (guest/auth middleware)
• Vuex store
• GraphQL services under src/graphql
• Components / Layouts / Views
• Static assets and Tailwind CSS
d. External Services
• CORS policy allowing origins for dev ports
• Optional Docker Compose services (mysql, php, node, nginx)
Relationships and data flows
• Frontends → HTTP(S) → GraphQL endpoint (Laravel)
• Queries and Mutations over /graphql
• Authorization header with token from login mutation
• Laravel → reads and writes → Database
• Laravel → reads/writes → Cache and Queue
• Laravel modules plug into service providers and register GraphQL types/resolvers
• Frontend state stores (Redux/Vuex) update on query responses, then render UI
Architectural patterns & design principles
• Backend: Modular monolith with Laravel service providers and composer modules
• Backend: MVC for web routes; GraphQL schema for headless API
• Frontends: Component-based UI, centralized state management (Redux/Vuex)
• Separation of concerns: authentication, data fetching, presentation layers
• Use of environment configuration (.env, .env.example) and CORS config
Capturing essential details
• Don’t forget to show the auth flow: Login mutation → token stored in state → Authorization header
• CORS configuration that allows frontend origins to call backend
• How third-party modules integrate via Laravel’s ServiceProvider mechanism