Render is a great choice for deploying Node.js applications.
- Push your code to GitHub.
- Create a new Web Service on Render:
- Connect your GitHub repository.
- Root Directory:
backend - Build Command:
npm install && npm run build - Start Command:
npm start - Environment Variables:
GROQ_API_KEY: Your Groq API Key.GITHUB_TOKEN: Your GitHub Personal Access Token.NODE_VERSION:20(Recommended).
- Deploy.
- Copy the URL (e.g.,
https://github-profile-audit-backend.onrender.com).
Vercel is optimized for Vite/React apps.
- Create a new Project on Vercel:
- Connect your GitHub repository.
- Root Directory:
frontend - Framework Preset: Vite
- Build Command:
npm run build(Default) - Output Directory:
dist(Default) - Environment Variables:
VITE_API_URL: The URL of your deployed backend (e.g.,https://github-profile-audit-backend.onrender.com).- Note: Do NOT include a trailing slash.
- Deploy.
- Note: A
vercel.jsonfile has been added to handle client-side routing (preventing 404s on refresh).
- Note: A
Once both are deployed:
- Update Backend CORS (Optional but Recommended):
- Currently, the backend allows all origins (
cors()). - For better security, update
backend/src/index.tsto only allow your Vercel domain:app.use(cors({ origin: 'https://your-frontend.vercel.app' }));
- Redeploy the backend.
- Currently, the backend allows all origins (
- CORS Errors: If you see CORS errors in the browser console, ensure your backend is running and accessible. Check the Network tab.
- 404 Errors: Ensure
VITE_API_URLis correct and does not have a trailing slash.