Install dependencies
Install all required dependencies using npm:
This will install React 19, Vite 6, React Router DOM, Bootstrap, and other essential packages for the e-commerce platform.
Start the development server
Run the Vite development server:The application will be available at
http://localhost:5173Vite provides hot module replacement (HMR) for instant updates during development.
Available scripts
The application includes the following npm scripts:Script descriptions
- dev: Starts the Vite development server with hot reload
- build: Creates an optimized production build in the
distfolder - preview: Previews the production build locally
- lint: Runs ESLint to check code quality
Quick code examples
Adding a product to cart
The application uses React Context API for global state management. Here’s how products are added to the cart:src/context/CartContext.jsx
Fetching products from API
Products are fetched from MockAPI on component mount:src/context/CartContext.jsx
Application routing
The app uses React Router DOM for client-side routing:src/App.jsx
Testing the application
Test the product gallery
- Navigate to
/productosto see the full product gallery - Use the search bar to filter products by name
- Test pagination controls to navigate through product pages
Test the shopping cart
- Click “Agregar al carrito” on any product
- You should see a toast notification confirming the addition
- Open the cart to view added products
- Test quantity increase/decrease and product removal
Test admin functionality
- Navigate to
/login - Enter admin credentials
- Access
/adminto manage products - Test adding, editing, and deleting products
Next steps
Installation
Learn about detailed installation requirements and environment setup
Project structure
Understand the codebase organization and architecture
Context API
Explore the context providers for cart, auth, and admin
Deployment
Deploy your application to production