Overview
The Athena ERP frontend is a React application built with Vite. This guide covers deploying to various static hosting platforms.Prerequisites
- Node.js 18 or higher
- Backend API deployed and accessible
- Environment variables configured
Technology Stack
- Framework: React 19
- Build Tool: Vite 6.2
- Routing: React Router v7
- State Management: Zustand 5
- Data Fetching: TanStack Query (React Query) v5
- UI Framework: Tailwind CSS v4
- Forms: React Hook Form + Zod
- HTTP Client: Axios
- Authentication: Supabase JS Client (optional)
Directory Structure
Environment Configuration
Create a.env file in the athena-front directory:
Deployment to Vercel
Vercel is the recommended platform for React/Vite applications.Step 1: Install Vercel CLI
Step 2: Login
Step 3: Deploy from Local
- Set up and deploy? Yes
- Which scope? Your account/organization
- Link to existing project? No
- Project name? athena-frontend
- Directory?
./ - Override settings? No
Step 4: Configure Environment Variables
In Vercel dashboard → Settings → Environment Variables, add:Step 5: Redeploy
Step 6: Custom Domain (Optional)
In Vercel dashboard → Settings → Domains:- Add your custom domain (e.g.,
app.yourdomain.com) - Configure DNS records as instructed
- SSL is automatic
Deployment to Netlify
Netlify is another excellent option.Step 1: Install Netlify CLI
Step 2: Login
Step 3: Initialize Project
- Build command:
npm run build - Publish directory:
dist
Step 4: Configure Environment Variables
In Netlify dashboard → Site settings → Environment variables, add:Step 5: Deploy
Step 6: Configure Redirects
Createpublic/_redirects for React Router:
netlify.toml:
Deployment to Cloudflare Pages
Cloudflare Pages offers excellent performance with their global CDN.Step 1: Connect Repository
- Go to pages.cloudflare.com
- Click Create a project
- Connect your GitHub repository
- Select the repository
Step 2: Configure Build
- Framework preset: Vite
- Build command:
npm run build - Build output directory:
dist - Root directory:
athena-front
Step 3: Add Environment Variables
In Cloudflare Pages → Settings → Environment variables:Step 4: Deploy
Cloudflare will automatically deploy on every push to main.Step 5: Configure SPA Routing
Createpublic/_redirects:
Manual Build & Deploy
For custom hosting or CDN.Step 1: Build Locally
dist/ directory with optimized static files.
Step 2: Test Build Locally
http://localhost:4173 to test the production build.
Step 3: Deploy to Static Hosting
Upload thedist/ directory to:
- AWS S3 + CloudFront
- Google Cloud Storage + CDN
- Azure Static Web Apps
- DigitalOcean Spaces
- Any static file hosting service
Example: AWS S3 + CloudFront
Docker Deployment
For container-based deployments.Create Dockerfile
Createathena-front/Dockerfile:
Build and Run
GitHub Actions CI/CD
Automate deployments with GitHub Actions.Create .github/workflows/deploy-frontend.yml
VITE_API_URLVITE_SUPABASE_URLVITE_SUPABASE_ANON_KEYVERCEL_TOKENVERCEL_ORG_IDVERCEL_PROJECT_ID
Post-Deployment
Verify Deployment
- Visit your frontend URL
- Test login with superadmin credentials
- Check browser console for errors
- Test API connectivity:
- Open browser DevTools → Network tab
- Perform actions that call the API
- Verify requests go to correct backend URL
Configure CORS
Update backendCORS_ORIGINS to include your frontend domain:
Update Backend Environment
Ensure backend knows about frontend URL for any redirects or webhooks.Performance Optimization
Code Splitting
Vite automatically code-splits by route. Verify in build output:Lazy Loading
Use dynamic imports for routes:CDN Caching
Most platforms (Vercel, Netlify, Cloudflare) automatically optimize caching. Verify cache headers:Troubleshooting
Blank page after deployment
Check browser console for errors. Common causes:- Base path issue: Verify
vite.config.tsdoesn’t have incorrectbase - Environment variables not set: Check build logs
- 404 on routes: Configure SPA redirects (see platform-specific sections)
API calls failing
Check Network tab in DevTools:- CORS errors: Update backend
CORS_ORIGINS - Wrong API URL: Verify
VITE_API_URLis correct - Mixed content: If frontend is HTTPS, backend must be HTTPS
Build fails
Environment variables not working
- Verify variables are prefixed with
VITE_ - Check variables are set in hosting platform
- Redeploy after adding new variables
- In Vite, access with
import.meta.env.VITE_API_URL
Monitoring
Analytics
Add analytics to track usage:Error Tracking
Integrate Sentry for frontend errors:Next Steps
Backend Deployment
Ensure backend is deployed and accessible
Environment Variables
Review all configuration options
User Guide
Learn how to use Athena ERP
API Reference
Explore API endpoints