- Add Next.js app structure with base configs, linting, and formatting - Implement LiveKit Meet page, types, and utility functions - Add Docker, Compose, and deployment scripts for backend and token server - Provide E2E and smoke test scaffolding with Puppeteer and Playwright helpers - Include CSS modules and global styles for UI - Add postMessage and studio integration utilities - Update package.json with dependencies and scripts for development and testing
2.4 KiB
2.4 KiB
AvanzaCast - E2E / Token flow quick guide
Resumen rápido
- backend-api: sirve endpoints para generar y almacenar sesiones/tokens (http://localhost:4000)
- broadcast-panel: UI frontend (http://localhost:5175 en dev)
- studioportal: abre con ?session= y debe pedir token a backend-api /api/session/:id/token
- LiveKit token generation se hace en backend-api (/api/session or /api/token)
Setup local (prereqs)
- Node 18+ / npm
- Postgres accesible desde tu máquina (la URL que usamos: postgres://postgres:72ff3d8d80c352f89d99@192.168.1.20:5433/avanzacast)
- Google Chrome stable (usar scripts/start-chrome-remote.sh para abrir con remote-debugging)
Instrucciones rápidas
- Abrir Chrome con perfil persistente (para debugging visible y mantener cookies):
chmod +x scripts/start-chrome-remote.sh
./scripts/start-chrome-remote.sh
# comprobar la API de debug
curl http://127.0.0.1:9222/json/version
- Arrancar el backend-api (build + start):
chmod +x scripts/start-backend.sh
# foreground (ver logs en terminal):
./scripts/start-backend.sh
# background:
./scripts/start-backend.sh background
# luego:
# tail -f packages/backend-api/logs/backend-<ts>.log
- Probar endpoints con curl:
curl http://localhost:4000/health
curl -X POST http://localhost:4000/api/session -H "Content-Type: application/json" -d '{"room":"demo-room","username":"testuser"}' | jq .
curl http://localhost:4000/api/session/<id>/token | jq .
- Ejecutar E2E script (usa browserless o Chrome remoto):
# usando browserless remote
BROWSERLESS_TOKEN=e2e098863b912f6a178b68e71ec3c58d BROADCAST_URL=http://localhost:5175 \
node packages/broadcast-panel/scripts/browserless_e2e.cjs
# usando Chrome local (si el script lo soporta, o adapta browserless_e2e.cjs a browserURL):
# primero asegúrate de que Chrome está abierto con --remote-debugging-port=9222
# y luego adapta el script para usar puppeteer.connect({ browserURL: 'http://127.0.0.1:9222' })
Notas importantes
- Si usas browserless remoto (wss://browserless...), el navegador remoto no podrá acceder a http://localhost:5175 de tu máquina; para pruebas locales usa Chrome con remote debugging o expón tu frontend públicamente.
- Por seguridad, en producción NO incluyas tokens en query params (INCLUDE_TOKEN_IN_REDIRECT solo para pruebas). Usa sesiones identificadas por id y que el studio portal haga GET al backend por token.