From 21ba899f9871e0159f8922d547915f34605dcff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Gierwia=C5=82o?= Date: Thu, 13 Nov 2025 21:51:11 +0100 Subject: [PATCH] docs: update README and docs to reflect Phase 1.5 completion Update documentation to accurately reflect all features implemented in Phase 1.5: README.md updates: - Replace outdated "mockup" references with real implementation status - Add comprehensive feature list with Phase 1.5 additions - Document 7 database tables (added event_participants) - Add user profile features (social media, location, public profiles) - Add event security features (unique slugs) - Update tech stack versions and test coverage (81%+) - Add detailed setup instructions for dev and prod profiles - Update roadmap to show Phase 1.5 as completed SESSION_CONTEXT.md updates: - Update current status to Phase 1.5 completed (65% overall) - Add new features to "What Works Now" section - Update database schema to 7 tables with all Phase 1.5 fields - Add new migrations (event slugs) - Update key files list with Phase 1.5 changes - Update frontend routes to use slugs (/events/:slug/chat) TODO.md updates: - Mark Phase 1.5 as completed with full feature list - Update progress tracking table (65% overall completion) - Update last modified date to 2025-11-13 Phase 1.5 features documented: - Email verification (AWS SES with link + PIN code) - Password reset workflow - WSDC API integration - User profiles (social media links: YouTube, Instagram, Facebook, TikTok) - User location (country dropdown with 195 countries, city) - Public profiles accessible at /{username} - Event participation tracking (auto-save joined events) - Event security (12-char unique slugs, prevent ID enumeration) --- README.md | 487 ++++++++++++++++++++++++++++------------ docs/SESSION_CONTEXT.md | 85 ++++--- docs/TODO.md | 25 ++- 3 files changed, 415 insertions(+), 182 deletions(-) diff --git a/README.md b/README.md index b052ef3..e2d7c8f 100644 --- a/README.md +++ b/README.md @@ -2,83 +2,137 @@ Aplikacja webowa (PWA) dla społeczności tanecznej umożliwiająca matchmaking, czatowanie i wymianę nagrań wideo bezpośrednio przez WebRTC (peer-to-peer). -## 🚀 Funkcjonalności (Mockup) +## 🚀 Funkcjonalności -### ✅ Zaimplementowane (Frontend Mockup) -- **Autoryzacja** - logowanie i rejestracja (mock) -- **Wybór eventu** - przeglądanie i dołączanie do eventów tanecznych -- **Czat eventowy** - publiczny czat dla uczestników eventu z listą aktywnych użytkowników -- **Matchmaking** - łączenie się w pary bezpośrednio z czatu -- **Czat 1:1** - prywatny czat dla sparowanych użytkowników -- **📹 Transfer wideo (mockup WebRTC)** - symulacja przesyłania filmów P2P - - Wybór pliku z galerii urządzenia - - Symulacja połączenia WebRTC (connecting → connected) - - Progress bar transferu pliku - - Status połączenia (disconnected/connecting/connected/failed) - - Fallback: wysyłanie linków do filmów (Google Drive, Dropbox) -- **System ocen** - ocenianie partnera po współpracy (1-5 gwiazdek, komentarz) -- **Historia współprac** - lista poprzednich matchów i otrzymanych ocen +### ✅ Zaimplementowane -### 🔜 Do implementacji w kolejnych etapach -- **Backend API** (Node.js + Express + PostgreSQL) -- **WebSocket** (Socket.IO) - real-time chat i signaling -- **WebRTC P2P** - prawdziwy transfer plików przez RTCDataChannel -- **Autentykacja JWT** - prawdziwa autoryzacja -- **Baza danych** - PostgreSQL z pełnym schematem +**Autoryzacja & Bezpieczeństwo:** +- ✅ **JWT Authentication** - prawdziwa autoryzacja z bcrypt password hashing +- ✅ **Email Verification** - weryfikacja email przez AWS SES (link + PIN code) +- ✅ **Password Reset** - pełny workflow resetowania hasła +- ✅ **WSDC Integration** - auto-fill danych z worldsdc.com podczas rejestracji +- ✅ **Event Slugs** - unikalne alfanumeryczne identyfikatory zapobiegające ID enumeration attacks + +**Profile użytkowników:** +- ✅ **User Profiles** - edycja profilu (imię, nazwisko, WSDC ID) +- ✅ **Social Media Links** - YouTube, Instagram, Facebook, TikTok +- ✅ **Location** - kraj (dropdown z 195 krajami) i miasto +- ✅ **Public Profiles** - widoczne dla innych zalogowanych pod /{username} +- ✅ **Profile Statistics** - liczba matchów, średnia ocena, liczba recenzji + +**Eventy & Chat:** +- ✅ **Event List** - przeglądanie eventów tanecznych z worldsdc.com +- ✅ **Event Participation Tracking** - automatyczne zapisywanie dołączonych eventów +- ✅ **Real-time Event Chat** - Socket.IO chat dla uczestników eventu +- ✅ **Active Users Sidebar** - lista użytkowników online w evencie +- ✅ **Message History** - persistencja wiadomości w bazie danych +- ✅ **Infinite Scroll** - ładowanie starszych wiadomości + +**Matchmaking & Private Chat:** +- ✅ **Matchmaking** - łączenie się w pary bezpośrednio z czatu eventowego +- ✅ **Private 1:1 Chat** - prywatny czat dla sparowanych użytkowników z Socket.IO + +**Backend & Infrastructure:** +- ✅ **PostgreSQL Database** - 7 tabel z relacjami (Prisma ORM) +- ✅ **RESTful API** - Express.js backend z walidacją +- ✅ **WebSocket** - Socket.IO dla real-time communication +- ✅ **Docker Compose** - pełna orkiestracja (nginx, frontend, backend, PostgreSQL) +- ✅ **Test Coverage** - 81%+ coverage (Jest + Supertest) + +### 🔜 W trakcie implementacji + +- ⏳ **Matches API** - create/accept match requests +- ⏳ **Ratings API** - ocenianie partnera po współpracy (1-5 gwiazdek) +- ⏳ **WebRTC Signaling** - SDP/ICE exchange via Socket.IO +- ⏳ **WebRTC P2P Transfer** - prawdziwy transfer plików przez RTCDataChannel ## 🛠️ Stack Technologiczny -### Frontend (Current) +### Frontend - **React 18** - framework UI - **Vite** - build tool i dev server -- **Tailwind CSS** - stylowanie +- **Tailwind CSS v3.4.0** - stylowanie - **React Router** - routing - **Lucide React** - ikony - **Context API** - zarządzanie stanem (auth) +- **Socket.IO Client** - real-time WebSocket communication + +### Backend +- **Node.js 20** - runtime +- **Express 4.18** - web framework +- **PostgreSQL 15** - relational database +- **Prisma ORM 5.22** - type-safe database client +- **Socket.IO 4.8** - WebSocket server +- **bcrypt** - password hashing +- **JWT** - token-based authentication +- **AWS SES** - email service +- **Jest + Supertest** - testing (81%+ coverage) ### Infrastructure -- **Docker Compose** - orkiestracja kontenerów -- **Nginx** - reverse proxy i serving statycznych plików -- **Node.js 20 Alpine** - kontener dla frontendu +- **Docker Compose** - container orchestration (dev + prod profiles) +- **Nginx** - reverse proxy & static file serving +- **Alpine Linux** - lightweight container base images ## 📁 Struktura projektu ``` spotlightcam/ -├── docker-compose.yml # Konfiguracja Docker Compose -├── nginx/ # Konfiguracja Nginx -│ ├── nginx.conf # Główna konfiguracja -│ └── conf.d/ -│ └── default.conf # Proxy do frontendu (i backendu w przyszłości) +├── docker-compose.yml # Container orchestration (dev + prod profiles) +├── nginx/ # Nginx reverse proxy config +│ ├── nginx.conf +│ └── conf.d/default.conf # Proxy /api & /socket.io to backend ├── frontend/ # React PWA │ ├── src/ -│ │ ├── components/ # Komponenty React -│ │ │ ├── common/ -│ │ │ ├── chat/ -│ │ │ ├── video/ +│ │ ├── components/ # React components +│ │ │ ├── common/ # Shared components, PasswordStrength, VerificationBanner +│ │ │ ├── chat/ # Chat components +│ │ │ ├── video/ # WebRTC video transfer (mockup) │ │ │ └── layout/ # Navbar, Layout -│ │ ├── pages/ # Strony aplikacji +│ │ ├── pages/ # Application pages │ │ │ ├── LoginPage.jsx -│ │ │ ├── RegisterPage.jsx -│ │ │ ├── EventsPage.jsx -│ │ │ ├── EventChatPage.jsx -│ │ │ ├── MatchChatPage.jsx # 🔥 Główna funkcjonalność - mockup WebRTC -│ │ │ ├── RatePartnerPage.jsx -│ │ │ └── HistoryPage.jsx -│ │ ├── contexts/ # Context API (AuthContext) -│ │ ├── hooks/ # Custom hooks -│ │ ├── utils/ # Utility functions -│ │ ├── services/ # API services (przyszłość) -│ │ └── mocks/ # Mock data -│ │ ├── events.js -│ │ ├── users.js -│ │ ├── messages.js -│ │ └── matches.js -│ ├── Dockerfile +│ │ │ ├── RegisterPage.jsx # Two-step registration with WSDC lookup +│ │ │ ├── VerifyEmailPage.jsx # Email verification (link + PIN) +│ │ │ ├── ForgotPasswordPage.jsx # Request password reset +│ │ │ ├── ResetPasswordPage.jsx # Reset password with token +│ │ │ ├── ProfilePage.jsx # Edit profile (social media, location) +│ │ │ ├── PublicProfilePage.jsx # View other user's profile +│ │ │ ├── EventsPage.jsx # Event list with real API +│ │ │ ├── EventChatPage.jsx # Real-time event chat +│ │ │ ├── MatchChatPage.jsx # Private chat + WebRTC mockup +│ │ │ ├── RatePartnerPage.jsx # Rate partner after collaboration +│ │ │ └── HistoryPage.jsx # Match history +│ │ ├── contexts/ # AuthContext (JWT integration) +│ │ ├── services/ # API client, Socket.IO client +│ │ ├── data/ # Static data (countries list) +│ │ └── mocks/ # Mock data (for UI development) +│ ├── Dockerfile # Development container +│ ├── Dockerfile.prod # Production build │ └── package.json -└── docs/ # Dokumentacja - ├── CONTEXT.md # Opis projektu - └── TODO.md # Lista zadań +├── backend/ # Node.js + Express API +│ ├── src/ +│ │ ├── controllers/ # Auth, users, events, WSDC +│ │ ├── middleware/ # Auth, validation, error handling +│ │ ├── routes/ # API routes +│ │ ├── socket/ # Socket.IO server (event/match rooms) +│ │ ├── utils/ # Auth utils, DB, email service (AWS SES) +│ │ └── __tests__/ # Jest unit tests (81%+ coverage) +│ ├── prisma/ +│ │ ├── schema.prisma # Database schema (7 tables) +│ │ ├── migrations/ # Database migrations +│ │ └── seed.js # Seed data +│ ├── Dockerfile # Development container +│ ├── Dockerfile.prod # Production build +│ └── package.json +└── docs/ # Documentation + ├── SESSION_CONTEXT.md # Quick session context (minimal tokens) + ├── CONTEXT.md # Full project description + ├── TODO.md # Task list & roadmap + ├── ARCHITECTURE.md # Technical details + ├── COMPLETED.md # Completed tasks archive + ├── PHASE_1.5.md # Phase 1.5 documentation + ├── SECURITY_AUDIT.md # Security audit & fixes + ├── DEPLOYMENT.md # Deployment guide + └── RESOURCES.md # Learning resources ``` ## 🚀 Uruchomienie projektu @@ -87,7 +141,7 @@ spotlightcam/ - Docker i Docker Compose - (Opcjonalnie) Node.js 20+ dla developmentu bez Dockera -### Uruchomienie z Docker Compose +### Development Mode 1. Sklonuj repozytorium: ```bash @@ -95,150 +149,277 @@ git clone cd spotlightcam ``` -2. Uruchom Docker Compose: +2. Skopiuj przykładowy plik .env: ```bash -docker-compose up --build +cp backend/.env.example backend/.env ``` -3. Otwórz przeglądarkę: +3. Uruchom Docker Compose z profilem dev: +```bash +docker compose --profile dev up +``` + +4. Otwórz przeglądarkę: ``` http://localhost:8080 ``` -Frontend Vite dev server działa na porcie 5173 (wewnątrz kontenera), ale jest dostępny przez Nginx na porcie 8080. +### Production Mode + +```bash +docker compose --profile prod up -d +``` + +### Dostęp do usług + +**Development:** +- Frontend: http://localhost:8080 +- Backend API: http://localhost:8080/api +- WebSocket: ws://localhost:8080/socket.io +- Health check: http://localhost:8080/api/health +- PostgreSQL: localhost:5432 (exposed for dev tools) + +**Production:** +- Application: http://localhost (port 80) +- HTTPS: https://localhost (port 443, requires SSL certificates) +- PostgreSQL: internal only (not exposed) ### Zatrzymanie + ```bash -docker-compose down +# Development +docker compose --profile dev down + +# Production +docker compose --profile prod down ``` ### Rebuild po zmianach + ```bash -docker-compose up --build +docker compose --profile dev down +docker compose --profile dev up --build ``` +## 🗄️ Database Schema + +7 tables z relacjami (Prisma ORM): + +1. **users** - użytkownicy + - Base: id, username, email, password_hash, avatar, created_at, updated_at + - WSDC: first_name, last_name, wsdc_id + - Email: email_verified, verification_token, verification_code, verification_token_expiry + - Password Reset: reset_token, reset_token_expiry + - Social: youtube_url, instagram_url, facebook_url, tiktok_url + - Location: country, city + +2. **events** - eventy taneczne + - id, slug (unique), name, location, start_date, end_date, description, worldsdc_id, participants_count + +3. **event_participants** - uczestnicy eventów (many-to-many) + - id, user_id, event_id, joined_at + +4. **chat_rooms** - pokoje czatu + - id, event_id, type (event/private), created_at + +5. **messages** - wiadomości + - id, room_id, user_id, content, type (text/link/video), created_at + +6. **matches** - pary użytkowników + - id, user1_id, user2_id, event_id, room_id, status (pending/accepted/completed), created_at + +7. **ratings** - oceny + - id, match_id, rater_id, rated_id, score (1-5), comment, would_collaborate_again, created_at + +### Migracje + +```bash +# Rozwój (w kontenerze backend) +docker compose exec backend npx prisma migrate dev + +# Produkcja +docker compose exec backend-prod npx prisma migrate deploy + +# Generowanie Prisma Client +docker compose exec backend npx prisma generate +``` + +### Seed data + +```bash +docker compose exec backend npx prisma db seed +``` + +Dodaje: +- 3 eventy (Warsaw, Barcelona, Herräng) +- 2 użytkowników (john_doe, jane_smith) +- Event chat rooms + ## 🧪 Testowanie aplikacji ### Flow testowy: -1. **Logowanie** (http://localhost:8080/login) - - Wpisz dowolny email i hasło (mock auth) - - Zostaniesz zalogowany jako użytkownik "john_dancer" +1. **Rejestracja z WSDC** (http://localhost:8080/register) + - Opcjonalnie: podaj WSDC ID (np. 12345) dla auto-fill danych + - Wypełnij formularz rejestracji + - Otrzymasz email weryfikacyjny (sprawdź AWS SES sandbox) -2. **Wybór eventu** (http://localhost:8080/events) - - Wybierz jeden z eventów (np. "Warsaw Dance Festival 2025") - - Kliknij "Dołącz do czatu" +2. **Weryfikacja Email** (http://localhost:8080/verify-email) + - Kliknij link z emaila LUB wpisz 6-cyfrowy kod PIN + - Email zostanie zweryfikowany -3. **Czat eventowy** - - Zobacz mockowane wiadomości w czacie publicznym - - Po prawej stronie lista aktywnych użytkowników +3. **Logowanie** (http://localhost:8080/login) + - Email: john@example.com + - Password: password123 + +4. **Edycja profilu** (http://localhost:8080/profile) + - Uzupełnij social media links (Instagram, YouTube, etc.) + - Wybierz kraj z listy 195 krajów + - Podaj miasto + - Edytuj WSDC ID, imię, nazwisko + +5. **Wybór eventu** (http://localhost:8080/events) + - Zobacz listę eventów (dołączone wyświetlają się na górze) + - Wybierz event (np. "Warsaw Dance Festival 2025") + - Kliknij "Join chat" lub "Open chat" (jeśli już dołączyłeś) + +6. **Czat eventowy** + - Real-time chat z Socket.IO + - Po prawej stronie lista aktywnych użytkowników online - Kliknij ikonę "+" przy użytkowniku aby się z nim połączyć - - Po 1 sekundzie zostaniesz przekierowany do prywatnego czatu 1:1 + - Zostaniesz przekierowany do prywatnego czatu 1:1 -4. **Czat 1:1 - Główna funkcjonalność!** 🔥 - - Zobacz profil partnera na górze +7. **Czat 1:1 - WebRTC (mockup)** 🔥 + - Zobacz profil partnera na górze (kliknij username aby zobaczyć public profile) - Status WebRTC połączenia (disconnected/connecting/connected) - **Wysyłanie filmu przez WebRTC (mockup):** - Kliknij "Wyślij film (WebRTC)" - Wybierz plik wideo z dysku - - Kliknij "Wyślij film (P2P)" - - Zobacz symulację: - - Status WebRTC: connecting → connected - - Progress bar transferu (0% → 100%) - - Informacja o przesłanym pliku w czacie + - Zobacz symulację transferu P2P - **Fallback - wysyłanie linku:** - Kliknij "Link" - - Wklej URL do filmu (np. Google Drive) - - Link pojawi się w czacie + - Wklej URL do filmu (Google Drive, Dropbox, etc.) -5. **Ocena partnera** +8. **Ocena partnera** (coming soon - Matches & Ratings API) - Kliknij "Zakończ i oceń" - Wybierz ocenę (1-5 gwiazdek) - - Dodaj komentarz (opcjonalnie) + - Dodaj komentarz - Zaznacz czy chcesz współpracować ponownie - - Kliknij "Zapisz ocenę" -6. **Historia współprac** (http://localhost:8080/history) - - Zobacz listę twoich poprzednich matchów +9. **Historia współprac** (http://localhost:8080/history) + - Zobacz listę matchów - Zobacz otrzymane oceny - Zobacz statystyki -## 🎨 Główne widoki +10. **Public Profiles** + - Kliknij na username innego użytkownika + - Zobacz profil: avatar, lokalizacja, social media, statystyki -### LoginPage & RegisterPage -- Formularz logowania/rejestracji -- Mock autoryzacja (dowolny email/hasło) -- Info box o demo mode +## 🔐 Bezpieczeństwo -### EventsPage -- Karty eventów z worldsdc.com -- Informacje: lokalizacja, daty, liczba uczestników -- Przycisk "Dołącz do czatu" +### Zaimplementowane zabezpieczenia: -### EventChatPage -- Czat publiczny dla eventu -- Lista aktywnych użytkowników (sidebar) -- Wysyłanie wiadomości -- Matchmaking przez ikonę "+" +✅ **Authentication:** +- bcrypt password hashing (10 salt rounds) +- JWT tokens (httpOnly cookies in production) +- Protected routes with auth middleware +- Email verification required -### MatchChatPage ⭐ (Główna funkcjonalność) -- Profil partnera -- Status WebRTC połączenia (disconnected/connecting/connected/failed) -- Czat 1:1 -- **Mockup transferu wideo WebRTC:** - - Wybór pliku z galerii - - Symulacja nawiązywania połączenia WebRTC - - Progress bar (chunking simulation) - - Info o szyfrrowaniu E2E (DTLS/SRTP) -- Fallback: wysyłanie linków do filmów -- Przycisk "Zakończ i oceń" +✅ **Input Validation:** +- express-validator for all inputs +- Custom validators for URLs (domain checking) +- SQL injection prevention (Prisma parameterized queries) +- XSS protection (input sanitization) -### RatePartnerPage -- Ocena partnera (1-5 gwiazdek) -- Pole komentarza -- Checkbox "Chcę współpracować ponownie" +✅ **Rate Limiting:** +- Login attempts: 5 per 15 minutes +- Registration: 3 per hour +- Email sending: 3 per hour -### HistoryPage -- Lista matchów -- Otrzymane oceny -- Statystyki użytkownika +✅ **Database:** +- Unique constraints on emails, usernames +- Indexed fields for performance +- Cascading deletes for data integrity -## 📝 Mock Data +✅ **Event Security:** +- Unique alphanumeric slugs (12 chars, MD5-based) +- Prevents ID enumeration attacks +- URLs: /events/{slug}/chat instead of /events/{id}/chat -Aplikacja używa mock data dla wszystkich funkcjonalności: -- **Users**: 5 użytkowników testowych -- **Events**: 4 eventy (Warsaw, Berlin, Prague, Krakow) -- **Messages**: Przykładowe wiadomości w czatach -- **Matches**: 3 przykładowe matche -- **Ratings**: 3 przykładowe oceny +✅ **Socket.IO:** +- JWT authentication for WebSocket connections +- Room-based access control +- User verification before joining rooms -Mock data znajduje się w `frontend/src/mocks/`. +### Planowane zabezpieczenia (Phase 3): -## 🔐 Bezpieczeństwo (Mockup) +⏳ CORS configuration +⏳ CSRF protection (cookies) +⏳ Helmet.js security headers +⏳ Content Security Policy +⏳ HTTPS enforcement (production) -W obecnej wersji (mockup): -- ✅ Autoryzacja jest symulowana (localStorage) -- ✅ WebRTC status jest symulowany -- ⏳ Backend API będzie dodany w kolejnym etapie -- ⏳ Prawdziwe WebRTC P2P będzie zaimplementowane później -- ⏳ JWT autoryzacja będzie dodana później +## 📊 Test Coverage -## 🎯 Kolejne kroki +**Backend: 81%+ coverage** +- Auth controllers: 78% +- Socket.IO module: 89% +- Jest + Supertest -Zobacz `docs/TODO.md` dla pełnej listy zadań. Najważniejsze: +```bash +# Run tests +docker compose exec backend npm test -1. **Backend setup** - Node.js + Express + PostgreSQL -2. **WebSocket** - Socket.IO dla real-time communication -3. **WebRTC Signaling** - Serwer sygnalizacyjny (SDP/ICE exchange) -4. **WebRTC P2P Transfer** - Prawdziwy transfer plików przez RTCDataChannel -5. **Autentykacja** - JWT + bcrypt -6. **Testy** - Unit, integration, E2E -7. **Deployment** - Production setup +# Coverage report +docker compose exec backend npm run test:coverage +``` + +## 🎯 Roadmap + +### ✅ Phase 0: Frontend Mockup (COMPLETED) +- All views with mock data +- WebRTC UI mockup +- Routing & navigation + +### ✅ Phase 1: Backend Foundation (COMPLETED) +- Node.js + Express + PostgreSQL +- JWT authentication +- Socket.IO real-time chat +- Test coverage 81%+ + +### ✅ Phase 1.5: Email & WSDC Integration (COMPLETED) +- Email verification (AWS SES) +- Password reset workflow +- WSDC API integration +- User profiles with social media & location +- Public profiles +- Event participation tracking +- Event security (slugs) + +### ⏳ Phase 2: Core Features (IN PROGRESS) +- Matches API (create/accept match requests) +- Ratings API (rate partner after collaboration) +- WebRTC signaling (SDP/ICE exchange) +- WebRTC P2P file transfer (RTCDataChannel) + +### ⏳ Phase 3: MVP Finalization (PLANNED) +- Security hardening +- Integration & E2E tests +- PWA features (manifest, service worker) +- Production deployment +- Monitoring & logging + +### ⏳ Phase 4: Extensions (FUTURE) +- User badges & trust system +- Block users +- Push notifications +- Video compression +- Multi-file transfer ## 📖 Dokumentacja **Quick Start:** -- `docs/SESSION_CONTEXT.md` - **Ultra-zwięzły kontekst** dla wznowienia sesji (minimal tokens) +- `docs/SESSION_CONTEXT.md` - Szybki kontekst dla wznowienia sesji (minimal tokens) **Main Documentation:** - `docs/CONTEXT.md` - Główny opis projektu i założeń @@ -246,12 +427,24 @@ Zobacz `docs/TODO.md` dla pełnej listy zadań. Najważniejsze: **Detailed Documentation:** - `docs/ARCHITECTURE.md` - Szczegóły techniczne i implementacyjne +- `docs/PHASE_1.5.md` - Dokumentacja Phase 1.5 (Email & WSDC) +- `docs/SECURITY_AUDIT.md` - Security audit & fixes +- `docs/DEPLOYMENT.md` - Deployment guide - `docs/COMPLETED.md` - Archiwum ukończonych zadań - `docs/RESOURCES.md` - Linki do dokumentacji i zasobów edukacyjnych ## 🤝 Contributing -Projekt jest w fazie MVP. Backend i prawdziwy WebRTC będą dodane w kolejnych etapach. +Projekt jest w fazie rozwoju. Aktualnie implementujemy Phase 2 (Matches & Ratings API, WebRTC P2P transfer). + +### Git workflow: +```bash +git status +git add . +git commit -m "feat: description" +``` + +**Uwaga:** Commit messages bez wzmianek o AI/automatycznym generowaniu. ## 📄 License @@ -259,4 +452,6 @@ TBD --- -**Uwaga:** To jest wersja mockup frontendu. WebRTC transfer jest symulowany. Pełna funkcjonalność (backend + prawdziwy WebRTC) będzie dostępna w kolejnych wersjach. +**Current Status:** Phase 1.5 ✅ Completed | Phase 2 ⏳ In Progress (60% overall) + +**Last Updated:** 2025-11-13 diff --git a/docs/SESSION_CONTEXT.md b/docs/SESSION_CONTEXT.md index a8b696d..88b510e 100644 --- a/docs/SESSION_CONTEXT.md +++ b/docs/SESSION_CONTEXT.md @@ -15,19 +15,23 @@ ## Current Status -**Phase:** 1.5 (Email Verification & WSDC Integration) - ✅ COMPLETED -**Progress:** ~60% +**Phase:** 1.5 (Email Verification & WSDC Integration + User Profiles + Security) - ✅ COMPLETED +**Progress:** ~65% **Next Goal:** Phase 2 - Core Features (Matches API, Ratings, WebRTC signaling) ### What Works Now - ✅ Docker Compose (nginx:8080 + frontend + backend + PostgreSQL) -- ✅ All frontend views with mockups +- ✅ All frontend views with real API integration - ✅ Backend API (Node.js + Express) -- ✅ PostgreSQL database with 6 tables (Prisma ORM) +- ✅ PostgreSQL database with 7 tables (Prisma ORM) - ✅ Real authentication (JWT + bcrypt) - ✅ **Email verification (AWS SES with link + PIN code) - Phase 1.5** - ✅ **Password reset workflow - Phase 1.5** - ✅ **WSDC ID integration for auto-fill registration - Phase 1.5** +- ✅ **User profiles with social media & location - Phase 1.5** +- ✅ **Public profiles (/{username}) - Phase 1.5** +- ✅ **Event participation tracking - Phase 1.5** +- ✅ **Event security (unique slugs, no ID enumeration) - Phase 1.5** - ✅ Real-time chat (Socket.IO for event & match rooms) - ✅ WebRTC P2P transfer UI mockup @@ -103,28 +107,37 @@ ## Key Files **Frontend:** -- `frontend/src/pages/RegisterPage.jsx` - **NEW: Two-step registration (WSDC lookup + form) - Phase 1.5** -- `frontend/src/pages/VerifyEmailPage.jsx` - **NEW: Email verification (link + code) - Phase 1.5** -- `frontend/src/pages/ForgotPasswordPage.jsx` - **NEW: Request password reset - Phase 1.5** -- `frontend/src/pages/ResetPasswordPage.jsx` - **NEW: Reset password with token - Phase 1.5** -- `frontend/src/components/common/PasswordStrengthIndicator.jsx` - **NEW: Password strength indicator - Phase 1.5** -- `frontend/src/components/common/VerificationBanner.jsx` - **NEW: Email verification banner - Phase 1.5** -- `frontend/src/pages/EventChatPage.jsx` - Event chat with Socket.IO real-time messaging +- `frontend/src/pages/RegisterPage.jsx` - Two-step registration (WSDC lookup + form) +- `frontend/src/pages/VerifyEmailPage.jsx` - Email verification (link + code) +- `frontend/src/pages/ForgotPasswordPage.jsx` - Request password reset +- `frontend/src/pages/ResetPasswordPage.jsx` - Reset password with token +- `frontend/src/pages/ProfilePage.jsx` - **UPDATED: Edit profile (social media, location) - Phase 1.5** +- `frontend/src/pages/PublicProfilePage.jsx` - **NEW: View other user profiles - Phase 1.5** +- `frontend/src/pages/EventsPage.jsx` - **UPDATED: Real API, joined events first - Phase 1.5** +- `frontend/src/pages/EventChatPage.jsx` - **UPDATED: Uses slugs instead of IDs - Phase 1.5** - `frontend/src/pages/MatchChatPage.jsx` - Private chat + WebRTC mockup +- `frontend/src/components/common/PasswordStrengthIndicator.jsx` - Password strength indicator +- `frontend/src/components/common/VerificationBanner.jsx` - Email verification banner - `frontend/src/contexts/AuthContext.jsx` - JWT authentication integration -- `frontend/src/services/api.js` - API client (extended with email verification & WSDC lookup) +- `frontend/src/services/api.js` - **UPDATED: eventsAPI uses slugs - Phase 1.5** - `frontend/src/services/socket.js` - Socket.IO client connection manager +- `frontend/src/data/countries.js` - **NEW: List of 195 countries - Phase 1.5** **Backend:** -- `backend/src/controllers/auth.js` - **UPDATED: Register, login, email verification, password reset - Phase 1.5** -- `backend/src/controllers/wsdc.js` - **NEW: WSDC API proxy for dancer lookup - Phase 1.5** -- `backend/src/utils/email.js` - **NEW: AWS SES email service with HTML templates - Phase 1.5** -- `backend/src/utils/auth.js` - **UPDATED: Token generation utilities - Phase 1.5** -- `backend/src/middleware/auth.js` - **UPDATED: Email verification middleware - Phase 1.5** +- `backend/src/controllers/auth.js` - Register, login, email verification, password reset +- `backend/src/controllers/user.js` - **UPDATED: Profile updates (social, location) - Phase 1.5** +- `backend/src/controllers/wsdc.js` - WSDC API proxy for dancer lookup +- `backend/src/routes/events.js` - **UPDATED: Uses slugs instead of IDs - Phase 1.5** +- `backend/src/routes/users.js` - **UPDATED: Public profile endpoint - Phase 1.5** +- `backend/src/socket/index.js` - **UPDATED: Slug-based event rooms, participation tracking - Phase 1.5** +- `backend/src/utils/email.js` - AWS SES email service with HTML templates +- `backend/src/utils/auth.js` - Token generation utilities +- `backend/src/middleware/auth.js` - Email verification middleware +- `backend/src/middleware/validators.js` - **UPDATED: Social media URL validation - Phase 1.5** - `backend/src/server.js` - Express server with Socket.IO integration -- `backend/src/socket/index.js` - Socket.IO server (event/match rooms, 89% coverage) -- `backend/prisma/schema.prisma` - **UPDATED: Extended User model - Phase 1.5** -- `backend/prisma/migrations/20251113151534_add_wsdc_and_email_verification/` - **NEW migration** +- `backend/prisma/schema.prisma` - **UPDATED: 7 tables (social, location, event_participants, slugs) - Phase 1.5** +- `backend/prisma/migrations/20251113151534_add_wsdc_and_email_verification/` - Phase 1.5 migration +- `backend/prisma/migrations/20251113202500_add_event_slug/` - **NEW: Event slugs migration - Phase 1.5** **Config:** - `docker-compose.yml` - nginx, frontend, backend, PostgreSQL @@ -135,21 +148,25 @@ ## Database Schema (Implemented - Prisma) -6 tables with relations: +7 tables with relations: - `users` - **EXTENDED in Phase 1.5:** - Base: id, username, email, password_hash, avatar, created_at, updated_at - **WSDC:** first_name, last_name, wsdc_id - **Email Verification:** email_verified, verification_token, verification_code, verification_token_expiry - **Password Reset:** reset_token, reset_token_expiry -- `events` - id, name, location, start_date, end_date, description, worldsdc_id + - **Social Media:** youtube_url, instagram_url, facebook_url, tiktok_url + - **Location:** country, city +- `events` - id, **slug (unique)**, name, location, start_date, end_date, description, worldsdc_id, participants_count +- `event_participants` - **NEW in Phase 1.5:** id, user_id, event_id, joined_at (many-to-many) - `chat_rooms` - id, event_id, match_id, type (event/private), created_at - `messages` - id, room_id, user_id, content, type, created_at - `matches` - id, user1_id, user2_id, event_id, room_id, status, created_at -- `ratings` - id, match_id, rater_id, rated_id, score, comment, created_at +- `ratings` - id, match_id, rater_id, rated_id, score, comment, would_collaborate_again, created_at **Migrations:** - `20251112205214_init` - Initial schema -- `20251113151534_add_wsdc_and_email_verification` - **Phase 1.5 migration** +- `20251113151534_add_wsdc_and_email_verification` - Phase 1.5 (email, WSDC, social, location) +- `20251113202500_add_event_slug` - **Phase 1.5 (event security - unique slugs)** **Seed data:** 3 events, 2 users, event chat rooms @@ -291,9 +308,14 @@ RUN apk add --no-cache openssl ## Quick Reference - Frontend Routes - `/login` - Login page -- `/register` - Registration page -- `/events` - Event list -- `/events/:id/chat` - Event chat (public) +- `/register` - Two-step registration (WSDC lookup + form) +- `/verify-email` - Email verification (link + PIN code) +- `/forgot-password` - Request password reset +- `/reset-password/:token` - Reset password with token +- `/profile` - Edit user profile (social media, location) +- `/:username` - Public profile view +- `/events` - Event list (joined events first) +- `/events/:slug/chat` - Event chat (public, real-time Socket.IO) - `/matches/:id/chat` - Private 1:1 chat + WebRTC mockup - `/matches/:id/rate` - Rate partner - `/history` - Match history @@ -334,5 +356,12 @@ RUN apk add --no-cache openssl **Last Updated:** 2025-11-13 **Phase 1 Status:** ✅ COMPLETED - Backend Foundation (Express + PostgreSQL + JWT + Socket.IO) -**Phase 1.5 Status:** ✅ COMPLETED - Email Verification & WSDC Integration (AWS SES + Password Reset + WSDC API) +**Phase 1.5 Status:** ✅ COMPLETED - Email Verification & WSDC Integration & User Profiles & Security + - AWS SES email verification (link + PIN) + - Password reset workflow + - WSDC API integration + - User profiles (social media, location) + - Public profiles (/{username}) + - Event participation tracking + - Event security (unique slugs, no ID enumeration) **Next Phase:** Phase 2 - Core Features (Matches API + Ratings + WebRTC) diff --git a/docs/TODO.md b/docs/TODO.md index 40fbad9..96c0760 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -6,9 +6,9 @@ ## 🎯 CURRENT STATUS -**Phase:** 1 (Backend Foundation) - ✅ COMPLETED +**Phase:** 1.5 (Email & WSDC & Profiles & Security) - ✅ COMPLETED **Next Phase:** 2 (Core Features) - ⏳ PENDING -**Progress:** ~50% complete +**Progress:** ~65% complete ### ✅ Completed - Phase 0: Frontend mockup with all views @@ -18,6 +18,14 @@ - JWT authentication (register, login) - Socket.IO real-time chat (event & match rooms) - Comprehensive test coverage (81%+) +- Phase 1.5: Email & WSDC & Profiles & Security + - Email verification (AWS SES with link + PIN) + - Password reset workflow + - WSDC API integration (auto-fill registration) + - User profiles (social media links, location) + - Public profiles (/{username}) + - Event participation tracking (auto-save joined events) + - Event security (unique slugs, prevent ID enumeration) ### ⏳ Next Priority **Core Features** - Matches API + Ratings + WebRTC Signaling @@ -221,12 +229,13 @@ git commit -m "feat: description" | Phase | Status | Progress | Estimated Time | |-------|--------|----------|----------------| | Phase 0: Frontend Mockup | ✅ Done | 100% | ~8h (completed) | -| Phase 1: Backend Foundation | ⏳ Next | 0% | ~11-14h | -| Phase 2: Core Features | ⏳ Pending | 0% | ~15-20h | -| Phase 3: WebRTC P2P | ⏳ Pending | 0% | ~20-30h | -| Phase 4: MVP Finalization | ⏳ Pending | 0% | ~15-20h | +| Phase 1: Backend Foundation | ✅ Done | 100% | ~14h (completed) | +| Phase 1.5: Email & WSDC & Profiles | ✅ Done | 100% | ~12h (completed) | +| Phase 2: Core Features | ⏳ Next | 0% | ~15-20h | +| Phase 3: MVP Finalization | ⏳ Pending | 0% | ~15-20h | +| Phase 4: Extensions | ⏳ Pending | 0% | TBD | -**Overall Progress:** ~25% (1 of 4 core phases done) +**Overall Progress:** ~65% (Phase 0, 1, 1.5 completed) --- @@ -247,4 +256,4 @@ git commit -m "feat: description" --- -**Last Updated:** 2025-11-12 +**Last Updated:** 2025-11-13