Quick Start
Get Villa Buena E-Commerce running on your local machine in just a few minutes. This guide will take you from zero to a fully functional e-commerce application.Before you begin, make sure you have Node.js 18+ and npm (or yarn/pnpm) installed on your machine.
Step-by-Step Setup
Install Dependencies
Install all required packages using your preferred package manager:This will install all dependencies including:
- React 19.2.0 and React DOM
- Vite 7.3.1 build tooling
- Auth0 authentication library
- TanStack Query for data fetching
- Zustand for state management
- Bootstrap 5.3.8 for UI components
- And more…
Configure Environment Variables
Create a
.env file in the root directory and add your API endpoint:The application uses
import.meta.env.VITE_API_URL in the API service layer (see src/services/api.js:4).Configure Auth0 (Optional)
The application comes pre-configured with a demo Auth0 setup. For production use, you should configure your own Auth0 application:
- Create a free account at auth0.com
- Create a new Single Page Application
- Update the Auth0 configuration in
src/main.jsx:
src/main.jsx
Start the Development Server
Launch the Vite development server:The application will start and be available at
http://localhost:5173 (default Vite port).You should see output similar to:Verify Installation
Open your browser and navigate to
http://localhost:5173. You should see:- The home page with a product catalog
- A navigation bar with authentication options
- Product filtering and search functionality
- A shopping cart icon
The application fetches products from the configured API endpoint. Make sure your
VITE_API_URL is set correctly.Test the Application
Now that Villa Buena is running, try these features:Browse Products
The home page displays a paginated product catalog with:- Category filtering
- Search functionality
- Price sorting (ascending/descending)
- Pagination (12 products per page)
Add to Cart
- Click on any product to view details
- Click “Add to Cart” button
- See the cart icon update with item count
- Open the cart drawer to review items
Cart data persists in localStorage thanks to Zustand’s persist middleware (see
src/store/useCartStore.js:62-64).Authentication
- Click the login button in the navigation bar
- Sign in using the Auth0 login flow
- Access protected features like account and order history
Checkout Flow
- Add products to cart
- Navigate to cart
- Proceed through shipping (
/checkout/shipping) - Complete payment information (
/checkout/payment) - See order confirmation (
/payment/success)
What’s Running?
When you start the development server, several key systems initialize:Application Providers
The app is wrapped with multiple providers insrc/main.jsx:
Layout System
Every page uses theLayout component (src/app/Layout.jsx) which includes:
- Navbar - Navigation and authentication controls
- Toast - Global notification system
- CartDrawer - Slide-out cart panel
- Outlet - Renders the current route component
State Stores
Three Zustand stores are initialized:- useCartStore - Shopping cart state with persistence
- useUserStore - User profile data
- useUIStore - UI preferences (dark mode, notifications)
Common Development Commands
Troubleshooting
Port already in use
Port already in use
If port 5173 is already in use, Vite will automatically try the next available port (5174, 5175, etc.).To specify a custom port, update
vite.config.js:API requests failing
API requests failing
Make sure your After changing environment variables, restart the dev server.
.env file contains the correct API URL:Auth0 redirect loop
Auth0 redirect loop
If you’re experiencing redirect loops:
- Clear localStorage:
localStorage.clear()in browser console - Verify your Auth0 application settings
- Check that the redirect URI matches your app URL
Module not found errors
Module not found errors
Delete
node_modules and reinstall:Next Steps
Installation Guide
Deep dive into installation and configuration options
Architecture
Learn about the application structure and design patterns
API Reference
Explore the API services and data models
Building
Build and deploy Villa Buena to production
