Aplicacion de mensajeria en tiempo real construida con React, Node.js, MongoDB y Socket.IO.
- Autenticacion con JWT y contrasenas cifradas con bcryptjs.
- Chat en tiempo real con Socket.IO.
- Historial de mensajes persistido en MongoDB.
- Solicitudes y gestion de contactos.
- Limpieza local y borrado definitivo de mensajes.
- Frontend responsive con React, Vite y Tailwind CSS.
- Documentacion HTTP con Swagger en
/api-docs.
- React
- Vite
- Tailwind CSS
- socket.io-client
- Node.js
- Express
- MongoDB + Mongoose
- Socket.IO
- JWT
- bcryptjs
- Swagger UI
frontend/: aplicacion cliente.backend/: API HTTP, Socket.IO y Swagger.e2e/: base de pruebas con Playwright, Cypress, Selenium, Newman y Lighthouse.
Usa backend/.env tomando como base backend/.env.example.
Variables principales:
PORT: puerto del backend.JWT_SECRET: secreto para firmar tokens.CORS_ORIGIN: origen permitido para el frontend.PUBLIC_API_URL: URL publica usada por Swagger para mostrar el server correcto.MONGO_URI: conexion a MongoDB.SKIP_DB: si valetrue, arranca sin conectar MongoDB.
Usa frontend/.env.local tomando como base frontend/.env.example.
Variables principales:
VITE_API_URLVITE_SOCKET_URL
git clone https://github.com/JEJS-IA97/Chat.git
cd Chatcd backend
npm installCrea backend/.env a partir de backend/.env.example y completa tus valores reales.
Ejemplo:
PORT=3000
JWT_SECRET=tu_secreto
CORS_ORIGIN=http://127.0.0.1:4173
PUBLIC_API_URL=http://127.0.0.1:3000
MONGO_URI=tu_uri_de_mongodb
SKIP_DB=falsecd ../frontend
npm installCrea frontend/.env.local a partir de frontend/.env.example.
Ejemplo:
VITE_API_URL=http://127.0.0.1:3000
VITE_SOCKET_URL=http://127.0.0.1:3000En una terminal:
cd backend
npm run devEn otra terminal:
cd frontend
npm run dev- Levanta el backend con
npm run devdentro debackend/. - Abre http://127.0.0.1:3000/api-docs.
- Si quieres el JSON de OpenAPI, abre http://127.0.0.1:3000/api-docs.json.
- Despliega el backend en Render.
- Configura
PUBLIC_API_URLcon la URL publica del backend. - Abre
https://tu-backend.onrender.com/api-docs. - Si quieres el JSON, abre
https://tu-backend.onrender.com/api-docs.json.
Variables recomendadas del backend:
JWT_SECRET=tu_secreto
MONGO_URI=tu_uri_real
CORS_ORIGIN=https://tu-frontend.vercel.app
PUBLIC_API_URL=https://tu-backend.onrender.com
SKIP_DB=falseVariables recomendadas del frontend:
VITE_API_URL=https://tu-backend.onrender.com
VITE_SOCKET_URL=https://tu-backend.onrender.comLa base de pruebas automatizadas vive en e2e/.
Comandos utiles:
npm run stack:upnpm run test:playwrightnpm run test:cypressnpm run test:seleniumnpm run test:newmannpm run test:lighthouse