Skip to main content

Prerequisites

Before installing Tienda ETCA, ensure you have the following installed on your system:

Node.js

Version 18.x or higher recommended

npm

Version 9.x or higher (comes with Node.js)

Git

Latest stable version

Modern browser

Chrome, Firefox, Safari, or Edge

Verify prerequisites

Check your installed versions:
If you need to install Node.js, visit nodejs.org and download the LTS version.

Installation steps

1

Clone the repository

Clone the project repository to your local machine:
2

Install dependencies

Install all project dependencies using npm:
This command will install all dependencies listed in package.json.
3

Verify installation

Verify that all dependencies were installed correctly:
You should see a list of all installed packages without errors.
4

Start development server

Launch the development server:
The application will start at http://localhost:5173

Dependencies

Tienda ETCA relies on the following core dependencies:

Production dependencies

The core React library for building user interfaces.
package.json
React 19 provides improved performance and new features for the application.
Client-side routing for navigation between pages.
package.json
Used for implementing routes like /productos, /admin, /contacto, etc.
UI framework and React components for responsive design.
package.json
Bootstrap is used primarily for pagination and responsive layout components.
Toast notifications for user feedback.
package.json
Displays notifications when products are added to the cart.
Beautiful, responsive popup boxes for confirmations.
package.json
Used for delete confirmations in the admin panel.
Icon library with popular icon sets.
package.json
Provides icons for UI elements throughout the application.

Development dependencies

Next-generation frontend build tool.
package.json
Provides fast HMR (Hot Module Replacement) and optimized builds.
Code quality and consistency tool.
package.json
Ensures code quality with React-specific rules.
Type definitions for development.
package.json
Provides TypeScript definitions for better IDE support.

Configuration files

Vite configuration

The project uses Vite as its build tool. The configuration is minimal:
vite.config.js
Vite automatically handles JSX transformation and module bundling. No additional configuration is needed for basic usage.

ESLint configuration

The project includes ESLint for code quality:
eslint.config.js

Environment setup

No environment variables required

Tienda ETCA does not require environment variables for basic operation. The application uses a hardcoded MockAPI endpoint:
src/context/CartContext.jsx
For production use, consider moving API endpoints to environment variables for better security and flexibility.

Optional: Creating environment variables

If you want to use environment variables in the future:
1

Create .env file

Create a .env file in the project root:
2

Add variables

Add your environment variables with the VITE_ prefix:
.env
Vite requires environment variables to be prefixed with VITE_ to be exposed to the client.
3

Access in code

Access environment variables using import.meta.env:

Project structure

After installation, your project structure will look like this:

Build for production

To create an optimized production build:
This creates a dist folder with optimized assets:
  • Minified JavaScript bundles
  • Optimized CSS
  • Compressed assets
  • Source maps for debugging

Preview production build

Test the production build locally:
The preview server runs the production build locally, allowing you to test before deploying.

Troubleshooting

Common installation issues

Try clearing the npm cache and reinstalling:
Either stop the process using port 5173 or specify a different port:
Fix linting issues before running:
Then fix any reported issues or use npm run dev to run anyway.
Ensure all dependencies are installed:
If the error persists, delete node_modules and reinstall.

Next steps

Quickstart guide

Get up and running quickly with basic usage

Project structure

Learn about the codebase organization

Context API

Understand global state management

Deployment

Deploy your application to production