An AI-assisted MERN workspace with real-time project collaboration, Gemini-powered code generation, and a split deployment setup that fits free hosting comfortably.
- Real-time collaboration with Socket.IO
- Authentication with JWT + cookies
- AI prompt-to-file-tree generation using Gemini
- React + Vite frontend that can live on Vercel
- Express backend that can live on Render
frontend (Vite + React)
-> calls REST API on backend
-> opens Socket.IO connection for project rooms
backend (Express + Socket.IO)
-> MongoDB for users/projects
-> Redis for token blacklist
-> Gemini API for AI-generated project scaffolds
AI_DEV/
|- frontend/
| |- src/
| |- .env.example
|- backend/
| |- controllers/
| |- routes/
| |- services/
| |- tests/
| |- .env.example
|- README.md
cd frontend
npm install
cd ../backend
npm installCopy the example env files and fill in your real values.
Frontend frontend/.env
VITE_API_BASE_URL=http://localhost:5000Backend backend/.env
PORT=5000
NODE_ENV=development
MONGODB_URI=mongodb://127.0.0.1:27017/AI_DEV
JWT_SECRET=replace-with-a-long-random-secret
REDIS_URL=redis://username:password@host:port
GEMINI_API_KEY=replace-with-your-gemini-api-key
CLIENT_URL=http://localhost:5173cd backend
npm startcd frontend
npm run devBackend tests:
cd backend
npm testFrontend production build:
cd frontend
npm run build- Import the
frontendfolder as a Vercel project. - Set
VITE_API_BASE_URLto your deployed Render backend URL. - Build command:
npm run build - Output directory:
dist
- Create a new Web Service from the
backendfolder. - Start command:
npm start - Add environment variables:
PORT,NODE_ENV=production,MONGODB_URI,JWT_SECRET,REDIS_URL,GEMINI_API_KEY,CLIENT_URL - Set
CLIENT_URLto your Vercel frontend domain.
- MongoDB Atlas free tier for
MONGODB_URI - Redis Cloud free tier for
REDIS_URL
- Cookies are now configured for cross-origin production usage.
- CORS is environment-driven through
CLIENT_URL. - The backend exposes
/healthfor uptime checks and quick deploy verification. - Redis missing in production should be treated as a misconfiguration, not ignored.
- Rotate any previously exposed API keys, Redis URLs, or JWT secrets.
- Make sure
.envfiles are not committed with real credentials. - Confirm Vercel frontend URL is added to backend
CLIENT_URL. - Verify MongoDB and Redis allow connections from your deployment provider.
- Run backend tests and frontend build one last time.
CORS origin not allowed: checkCLIENT_URLon the backend.- Cookies not sticking in production: confirm HTTPS is enabled and
NODE_ENV=production. - Socket connection failing: verify frontend API URL and backend CORS origin list.
- Gemini route failing: confirm
GEMINI_API_KEYis set correctly.
- Open
https://your-render-service/health - Open the frontend and test register/login
- Create a project
- Open a project room and confirm socket-based updates work
If this repository ever contained real secrets, treat them as compromised and rotate them before going live.