How queirozcarlos/shopsync-frontend works
Project type and purpose
• Type: Full-stack web application (specifically the frontend service) in a larger inventory-management system.
• Purpose: A responsive SPA to manage products, sales, customers, suppliers, categories, reports and authentication, styled with Tailwind.
Main components
A. Developer / CI Environment (optional layer)
• Source files (src/)
• Configs: .env, tsconfig*, eslint.config.js, tailwind.config.js, vite.config.ts
• Build tools: Node 18+, npm/yarn, Vite
B. Docker-Compose services
1. frontend
• Dockerfile: builds the React app via Vite, then serves static assets through Nginx
• nginx.conf: config for static serving and proxy to backend API
2. backend (external service)
• Placeholder for your API service (e.g., Java/Spring, Node/Express) on port 8080
3. database
• MySQL container with migrations under src/database
C. Runtime / Production stack
1. Browser (end-user) – loads SPA via HTTP(S) from Nginx
2. Nginx (frontend container) – serves index.html, JS/CSS bundles, proxies API calls to backend
3. React SPA (client)
• Pages: Home, Dashboard, Sales, Reports, ...
• Components: Sidebar, Modals, List, ProtectedRoute, ChatbotButton, etc.
• Contexts: AuthContext (JWT management, ProtectedRoute), ThemeContext (light/dark persistence)
• Services (API layer): axios instance + productService, salesService, suppliersService
• Data flow: user actions → React components → services → backend
4. Backend API – REST endpoints for products, sales, customers, suppliers, categories, reports
5. MySQL – persistence layer, migrations located in src/database/migrations
Relationships & interactions
• Browser →(HTTP GET)→ Nginx (port 80/443)
• Nginx → serves JS/CSS → Browser
• Browser (SPA) →(Axios HTTP calls)→ Nginx proxy → Backend API (port 8080)
• Backend API →(SQL queries)→ MySQL
• React Context persists JWT & theme in localStorage
• Docker-Compose network allows name-based service discovery (e.g., http://backend:8080)
Architectural patterns & design principles
• Single-Page Application (SPA) architecture
• Component-based UI (React) with reusable components & modals
• Context API for global state (auth + theme) instead of Redux
• Service layer abstracts HTTP + domain logic
• Environment-driven config (VITE_API_BASE_URL)
• Containerization: Build once, run anywhere (Docker + Nginx)
• Orchestration: docker-compose ties frontend, backend, DB
Technologies & frameworks
• React 18 + TypeScript + Vite (dev server & build)
• Tailwind CSS + PostCSS + Headless UI + Lucide React (UI)
• React Router DOM (routing + ProtectedRoute)
• Axios (HTTP client)
• Docker & Docker-Compose (containerization)
• Nginx (static asset server & reverse proxy)
• MySQL (database)