- Node.js & npm installed - install with nvm
- Backend server running on
http://localhost:3005 - MongoDB connection configured
# Step 1: Clone the repository
git clone <YOUR_GIT_URL>
# Step 2: Navigate to the project directory
cd easyearn-frontend
# Step 3: Install dependencies
npm i
# Step 4: Start the development server
npm run devThe frontend will be available at http://localhost:8080
This project uses Vite's proxy feature to solve cross-origin session cookie issues:
- Frontend:
http://localhost:8080 - Backend:
http://localhost:3005 - Proxy:
/apiroutes →http://localhost:3005
- Base URL:
/api(uses Vite proxy) - Credentials:
withCredentials: true(enables cookies) - CORS: Handled automatically through proxy
src/
├── lib/
│ └── axios.ts # Axios instance with proxy configuration
├── contexts/
│ └── AuthContext.tsx # Authentication context
└── components/ # React components
# In backend directory
node test-proxy.js# In backend directory
node test-session-integration.js- Open browser to
http://localhost:8080 - Check Network tab for cookie headers
- Verify session persistence across refreshes
- Restart Required: After changing Vite config, restart the dev server
- Proxy Routes: All API calls should use
/apiprefix - Cookies: Sessions work through same-origin proxy, not cross-origin
- Environment: No
.envfile needed in frontend for local development
- Ensure backend is running on port 3005
- Check that Vite proxy is configured correctly
- Verify axios baseURL is set to
/api - Restart frontend dev server after config changes
- Frontend should use proxy routes (
/api/*) - Backend should have
FRONTEND_ORIGIN=http://localhost:8080 - Check browser console for specific error messages