Overview
Tienda ETCA is a single-page application (SPA) built with Vite and React. It can be deployed to any static hosting platform that supports SPAs.SPA Routing Configuration
The application includes a_redirects file in the public/ directory to handle client-side routing:
This redirect rule ensures that all routes are served by
index.html, allowing React Router to handle navigation client-side.Recommended Hosting Platforms
Netlify
Netlify is ideal for React applications with built-in SPA support.Connect Repository
- Sign up at netlify.com
- Click “Add new site” → “Import an existing project”
- Connect your Git provider (GitHub, GitLab, or Bitbucket)
- Select your Tienda ETCA repository
Configure Build Settings
Set the following build configuration:
- Build command:
npm run build - Publish directory:
dist - Node version: 18 or higher (set in
netlify.tomlor site settings)
netlify.toml
The
_redirects file is automatically recognized by Netlify, so the netlify.toml redirect is optional.Vercel
Vercel offers excellent performance and developer experience for React apps.Connect Repository
- Sign up at vercel.com
- Click “New Project”
- Import your Git repository
Configure Project
Vercel auto-detects Vite projects. Verify these settings:
- Framework Preset: Vite
- Build Command:
npm run build - Output Directory:
dist - Install Command:
npm install
vercel.json
Cloudflare Pages
Cloudflare Pages provides fast global CDN delivery.Connect Repository
- Go to Cloudflare Pages
- Click “Create a project”
- Connect your Git repository
Configure Build
Set these build settings:
- Framework preset: Vite
- Build command:
npm run build - Build output directory:
dist
GitHub Pages
For hosting on GitHub Pages, additional configuration is required. Updatevite.config.js:
.github/workflows/deploy.yml:
Environment Variables
All platforms support environment variables for configuration:Platform-Specific Setup
Netlify: Site settings → Environment variables Vercel: Project settings → Environment Variables Cloudflare Pages: Settings → Environment variablesCustom Domains
All platforms support custom domains:- Add your domain in the hosting platform’s domain settings
- Update your DNS records with the provided values
- SSL certificates are automatically provisioned
SSL certificates are automatically generated and renewed by all major hosting platforms.
Continuous Deployment
All recommended platforms support automatic deployments:- Push to main branch → Production deployment
- Push to other branches → Preview deployments
- Pull requests → Preview URLs for testing
Performance Optimization
Recommended Headers
For Netlify, add tonetlify.toml:
Build Optimization
- Enable build caching (automatic on most platforms)
- Use platform-specific image optimization
- Enable compression (gzip/brotli)
Deployment Checklist
Pre-Deployment
- Run
npm run lintto check for errors - Test production build locally with
npm run preview - Set up environment variables
- Configure custom domain (if needed)
Deployment
- Push code to repository
- Monitor build logs for errors
- Verify deployment URL
- Test all routes and functionality
Troubleshooting
404 Errors on Routes
If you get 404 errors when navigating to routes:- Verify
_redirectsfile is in thepublic/directory - Check that the hosting platform recognizes SPA routing
- For custom server setups, configure server to serve
index.htmlfor all routes
Build Failures
- Check build logs for specific errors
- Verify Node.js version compatibility (18+)
- Ensure all dependencies are listed in
package.json - Check for environment variable issues
Assets Not Loading
- Verify the base path in
vite.config.js(especially for GitHub Pages) - Check browser console for CORS errors
- Ensure assets are included in the build output
Most hosting platforms provide detailed build logs and deployment previews to help diagnose issues.