Skip to main content
This guide covers deploying your React + TypeScript frontend application to production.

Overview

The VENCOL Front Template is built with Vite and can be deployed to any static hosting platform. This guide focuses on Vercel and Netlify, the two most popular options.

Project Configuration

Your project includes build configuration in package.json:
package.json

Deploying to Vercel

Vercel is the recommended platform for deploying Vite applications. The project includes vercel.json configuration.

Vercel Configuration

vercel.json
This configuration ensures all routes are handled by the React Router in your SPA.

Deploy via Vercel CLI

1

Install Vercel CLI

2

Login to Vercel

3

Deploy

Follow the prompts to configure your project
4

Deploy to production

Deploy via Vercel Dashboard

1

Push to Git

Push your code to GitHub, GitLab, or Bitbucket
2

Import to Vercel

Go to vercel.com/new and import your repository
3

Configure build settings

  • Framework Preset: Vite
  • Build Command: vite build
  • Output Directory: dist
  • Install Command: npm install
4

Add environment variables

If using WordPress integration:
5

Deploy

Click “Deploy” and wait for the build to complete
Vercel will automatically deploy new commits from your main branch. Preview deployments are created for pull requests.

Deploying to Netlify

Netlify is another excellent option for deploying static sites.

Netlify Configuration

Create netlify.toml in your project root:
netlify.toml

Deploy via Netlify CLI

1

Install Netlify CLI

2

Login to Netlify

3

Initialize your site

4

Deploy

Deploy via Netlify Dashboard

1

Push to Git

Push your code to GitHub, GitLab, or Bitbucket
2

Import to Netlify

Go to app.netlify.com and click “Add new site”
3

Configure build settings

  • Build command: npm run build
  • Publish directory: dist
  • Base directory: (leave empty)
4

Add environment variables

In Site settings → Build & deploy → Environment:
5

Deploy

Click “Deploy site”

Building Locally

Test your production build locally before deploying:
The build output will be in the dist directory.

Environment Variables

Vite uses environment variables prefixed with VITE_.

Local Development

Create .env in your project root:
.env
Never commit .env files to Git. Add .env to your .gitignore file.

Production Variables

Accessing Environment Variables

In your code:

Custom Domain Setup

Vercel Custom Domain

1

Open project settings

Go to your project in Vercel Dashboard → Settings → Domains
2

Add domain

Enter your custom domain (e.g., www.vencol.com)
3

Configure DNS

Add the following DNS records at your domain registrar:Option A: Using A record
Option B: Using CNAME
4

Wait for DNS propagation

SSL certificate will be automatically issued (may take a few minutes)

Netlify Custom Domain

1

Open domain settings

Site settings → Domain management → Add custom domain
2

Add domain

Enter your custom domain
3

Configure DNS

Point your domain to Netlify:
4

Enable HTTPS

Netlify will automatically provision an SSL certificate

Performance Optimization

1. Enable Build Caching

Both Vercel and Netlify cache node_modules automatically.

2. Image Optimization

Use a CDN for images. Services like Cloudinary, Imgix, or WordPress media library with CDN integration are recommended.

3. Code Splitting

Vite automatically splits code by routes. To optimize further:
App.tsx

4. Bundle Analysis

Analyze your bundle size:
Update vite.config.ts:
vite.config.ts
Run npm run build to generate a bundle analysis.

Continuous Deployment

Both Vercel and Netlify support automatic deployments:

Git Workflow

1

Push to branch

2

Preview deployment created

Both platforms create a preview URL for your branch
3

Merge to main

4

Production deployment

Automatically deployed to your production domain

Monitoring & Analytics

Vercel Analytics

Enable analytics in your Vercel dashboard:
  1. Project Settings → Analytics
  2. Enable Web Analytics
  3. No code changes required

Google Analytics

Add Google Analytics to index.html:
index.html

Troubleshooting

Build Fails on Deployment

  1. Check build logs in your hosting platform dashboard
  2. Test locally: Run npm run build to replicate the error
  3. Check Node version: Ensure your hosting platform uses Node 18+
  4. Clear cache: Force a clean build without cache

Routes Return 404

Problem: Direct navigation to /nosotros returns 404 Solution: Ensure your vercel.json or netlify.toml includes SPA redirects

Environment Variables Not Working

  1. Check prefix: Must start with VITE_
  2. Rebuild: Environment variables require a new build
  3. Check scope: Ensure variables are set for production environment

Images Not Loading

  1. Check CORS: Ensure image CDN allows your domain
  2. Check URLs: Use absolute URLs, not relative paths
  3. Check HTTPS: Mixed content (HTTP images on HTTPS site) may be blocked

Deployment Checklist

1

Update site metadata

Update siteUrl in data/data.tsx with your production domain
2

Configure WordPress URL

Set VITE_WORDPRESS_API_URL environment variable
3

Test production build

Run npm run build && npm run preview locally
4

Check responsive design

Test on mobile, tablet, and desktop
5

Verify all routes work

Test navigation to all pages
6

Set up custom domain

Configure DNS and wait for SSL certificate
7

Enable analytics

Set up Google Analytics or platform analytics
8

Test contact form

Ensure form submissions work (if implemented)

Next Steps

After deployment:
  • Monitor performance with Lighthouse
  • Set up uptime monitoring (e.g., UptimeRobot)
  • Configure Google Search Console
  • Submit sitemap to search engines
  • Set up email notifications for build failures

Additional Resources