Prerequisites
Before deploying the frontend, ensure you have:- Node.js version
^20.19.0or>=22.12.0(as specified inpackage.json) - npm or yarn package manager
- Access to your chosen hosting platform (Vercel, Netlify, etc.)
Build Configuration
The application uses Vite as the build tool with the following configuration:vite.config.js
vite.config.js
- Vue plugin for SFC (Single File Component) support
- Tailwind CSS via the official Vite plugin for styling
- Path aliases with
@pointing to thesrc/directory
Environment Variables
The frontend connects to the backend API using hardcoded URLs in the source code. You’ll need to update the API URL in your Vue components before deployment.API URL Configuration
The API URL is currently defined in multiple components:Building for Production
Install dependencies
Install all required packages from This installs:
package.json:- Vue 3 (^3.5.22)
- Vue Router (^4.6.3)
- Axios (^1.13.2)
- Tailwind CSS (^4.1.16)
- Vite build tools
Run the production build
Execute the build script defined in This command runs
package.json:vite build, which:- Bundles and minifies JavaScript/CSS
- Optimizes assets for production
- Outputs files to the
dist/directory - Tree-shakes unused code
Deployment Options
The built application is a collection of static files that can be deployed to any static hosting provider.Vercel Deployment
Netlify Deployment
The
redirects configuration is essential for Vue Router to work correctly in history mode. It ensures all routes are handled by the SPA.Static Hosting (nginx)
For self-hosted deployments using nginx:nginx.conf
Post-Deployment Checklist
After deploying the frontend:- Verify the application loads correctly
- Test user registration and login functionality
- Confirm API connectivity to the backend
- Check that all forum and exam pages render properly
- Verify Vue Router navigation works on all routes
- Test CORS configuration with your backend
- Monitor browser console for any errors
Troubleshooting
Build Failures
If the build fails, check:- Node.js version matches the requirements in
package.json - All dependencies are installed (
node_modules/exists) - No syntax errors in Vue components
API Connection Errors
If the frontend can’t connect to the backend:- Verify the
API_URLis correct in all components - Check CORS settings on the backend (see Backend Deployment)
- Ensure the backend is running and accessible
Routing Issues
If routes return 404 errors:- Verify your hosting platform redirects all routes to
index.html - Check that Vue Router is properly configured in
index.js
The application uses Vue Router for client-side routing. Make sure your hosting platform is configured to serve
index.html for all routes.