Commit Graph

24 Commits

Author SHA1 Message Date
848540cfbf fix: auto-start room when host enters (WAITING → ACTIVE) 2026-03-24 07:29:38 +03:00
4b6284b04d fix: prisma.config.ts use dotenv to load .env (Prisma env() broken) 2026-03-24 07:16:11 +03:00
cac8f5434d fix: prisma.config.ts use env() helper to load .env file 2026-03-24 07:13:46 +03:00
985a556242 fix: prisma.config.ts use datasource.url (not top-level url) 2026-03-24 07:12:40 +03:00
f277b53c8e fix: add top-level url to prisma.config.ts (required by db push) 2026-03-24 07:11:48 +03:00
a1ef5d13f7 fix: setup.sh dev auto-creates docker-compose.override.yml + BETTER_AUTH_URL
- Create override with port mappings if missing (was gitignored, absent on server)
- Force-recreate containers to apply new port mappings
- Auto-add BETTER_AUTH_URL to .env if not set
2026-03-24 07:02:19 +03:00
68b6eaeac5 docs: update CLAUDE.md, README.md, PROMPT.md, setup.sh per post-change checklist
- Prisma 7 notes: adapter-pg, no url in schema
- README: setup.sh commands, first admin auto-assign, pgbouncer in docker
- PROMPT.md: Prisma 7 adapter-pg description
- setup.sh dev: reordered (kill first, containers before prisma, healthchecks)
2026-03-24 06:54:39 +03:00
ca3c786a6b fix: Prisma 7 adapter-based connection (no url in schema)
- Use @prisma/adapter-pg for PrismaClient (Prisma 7 removed datasourceUrl/datasources)
- prisma.config.ts: migrate.url for CLI commands
- schema.prisma: no url in datasource (Prisma 7 requirement)
2026-03-24 06:43:47 +03:00
a6c744223b fix: prisma url in schema + first user becomes ADMIN
- Add url = env("DATABASE_URL") back to schema (required by Prisma 7.5)
- Simplify prisma.config.ts
- First registered user auto-promoted to ADMIN via databaseHooks
- Subsequent users get HOST role
2026-03-24 03:54:55 +03:00
e59ba0ab97 feat: create first admin during ./setup.sh install
Step 6/7 asks for admin name/email/password and creates the user
directly in the database. Can be skipped (creates later via ./setup.sh admin).
Also fixed PgBouncer wait_for_service to use nc instead of pg_isready.
2026-03-24 03:47:11 +03:00
59c0cdad5f fix: remove datasourceUrl from PrismaClient constructor (Prisma 7)
Prisma 7 no longer accepts datasourceUrl in constructor.
URL is resolved from DATABASE_URL env var automatically.
2026-03-24 03:44:44 +03:00
0e53fba726 fix: auto-detect all LAN IPs for dev auth and HMR
No more manual LAN_HOST or BETTER_AUTH_TRUSTED_ORIGINS for dev.
Uses os.networkInterfaces() to allow all machine IPs automatically.
2026-03-24 03:35:02 +03:00
4cae7b48ef fix: pgbouncer healthcheck + minio doctor checks via docker exec
- pgbouncer: replace pg_isready with nc (not available in edoburu/pgbouncer)
- minio: add healthcheck in docker-compose.yml
- doctor: check minio/pgbouncer via docker exec instead of localhost curl
- cmd_dev: wait for healthy services, auto-create minio bucket
2026-03-24 03:29:18 +03:00
f6f93c2ae9 feat: auto LAN auth + setup.sh dev command
- auth.ts: auto-allow localhost:3000-3010 + LAN_HOST for trustedOrigins
- setup.sh: new `dev` command (update + kill old processes + auto LAN IP + launch)
- next.config.ts: allowedDevOrigins for LAN HMR
2026-03-24 03:24:14 +03:00
cbdd2fb2e4 fix: auth not working when accessed from non-localhost
- Remove hardcoded baseURL from auth-client.ts — better-auth now uses
  current window.location.origin, works from any IP/domain
- Add trustedOrigins config to auth.ts — allows requests from LAN IPs
- Add BETTER_AUTH_TRUSTED_ORIGINS env var for configuring allowed origins
- Improve error logging in login/register forms (was silent catch)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 02:54:56 +03:00
bd195bd735 feat: add admin command to setup.sh
- ./setup.sh admin — create admin user directly in DB
- Hashes password via bcryptjs (already in dependencies)
- Creates both user and better-auth account records
- Shows existing admins, offers to promote existing users
- Validates email, password length (min 8)
- Added to interactive menu and CLI router

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 02:53:18 +03:00
3b6c666744 fix: setup.sh doctor/update crash fixes
- Remove set -e (((issues++)) returns exit 1 when 0 → kills script)
- Fix .env.example parser: skip comments, validate var names with regex
- Fix update: skip git pull when user declines stash (was running anyway)
- Add --accept-data-loss to prisma db push (prevents interactive hang)
- Replace ((var++)) with var=$((var + 1)) for safety with pipefail

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 02:44:27 +03:00
f44d4e8c03 feat: universal setup.sh with install/update/doctor/status commands
- install: full first-time setup (unchanged flow)
- update: git pull + npm install + prisma + rebuild containers + clear cache
- doctor: 8-step diagnostic with auto-fix (deps, .env, package.json "type"
  bug, docker services, postgres schema, redis, minio bucket, .next cache)
- status: table view of all services with health, ports, DB size, Redis keys
- logs: tail service logs (default: app)
- restart: restart all containers
- reset: full teardown with double confirmation + .env backup
- Interactive menu when run without arguments

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 02:27:02 +03:00
7f9c521fed fix: remove "type" field from package.json + improve setup.sh
- Remove "type": "commonjs" from package.json — fixes Turbopack
  ESM/CommonJS conflict causing white screen in dev mode
- setup.sh: auto-generate passwords (PostgreSQL, MinIO, auth secret)
- setup.sh: auto-install Docker/Node.js if missing (apt/nvm/brew)
- setup.sh: backup existing .env before overwrite
- setup.sh: create MinIO bucket via curl if mc not installed
- setup.sh: add timeout errors for service readiness checks
- setup.sh: include pgbouncer in local dev docker compose up

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 02:21:40 +03:00
cb589b540a chore: add Redis/PgBouncer readiness checks to setup.sh + post-change checklist rule to CLAUDE.md
setup.sh now waits for Redis PONG and PgBouncer pg_isready before running
Prisma migrations. CLAUDE.md gets mandatory post-change checklist ensuring
setup.sh, README.md, PROMPT.md, .env.example stay in sync after every change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:21:40 +03:00
a42ec96965 perf: Redis pub/sub, PgBouncer, optimistic UI for high concurrency
- Add Redis 7 for pub/sub (lobby + chat real-time), rate limiting, caching
- Replace SSE DB polling with Redis pub/sub (lobby: instant approval, chat: instant delivery)
- Add PgBouncer (transaction mode, 500 client → 25 pool connections)
- Chat SSE stream via Redis pub/sub instead of 3s polling
- Optimistic UI in ChatPanel (messages appear before server confirms)
- Redis-based rate limiter (works across multiple app replicas)
- Prisma query optimization (select only needed fields)
- Chat message cache in Redis (10s TTL)
- Docker Compose: add redis, pgbouncer services with healthchecks
- Production: resource limits, 2 app replicas behind Traefik
- Update CLAUDE.md, README.md, .env.example, setup.sh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:17:25 +03:00
3e50c57ee0 Merge pull request 'feat: LiveServer-M1 v1 — educational video conferencing platform' (#1) from master into main
Reviewed-on: #1
2026-03-22 14:02:49 +03:00
3846e3e00d feat: LiveServer-M1 v1 — educational video conferencing platform
Full MVP implementation:
- Next.js 16 + React 19 + TypeScript + Tailwind CSS v4
- LiveKit integration (rooms, tokens, webhooks, moderation)
- better-auth (email/password, sessions, roles)
- Prisma 7 + PostgreSQL (9 models, 3 enums)
- 15 API routes (auth, rooms, lobby, chat, files, moderation, hand-raise)
- 7 pages (landing, auth, dashboard, join, video room)
- SSE-based waiting room with host approval flow
- Security: PIN rate limiting, session fingerprint bans, chat/files auth
- Python AI Agent (Deepgram STT + OpenAI summarization)
- Docker Compose (local + production with Traefik + Let's Encrypt)
- Interactive setup script (setup.sh)
- Dev protection middleware (DEV_ACCESS_KEY, ALLOWED_IPS)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 13:57:53 +03:00
e5bb4c99ec Initial commit 2026-03-22 11:49:30 +03:00