Frontend Overview

The Enclavr frontend is a modern React 19 application built with Next.js 16, featuring real-time chat and voice communication capabilities.

Key Statistics

MetricValue
FrameworkNext.js 16.1.6
React19.2.4
Components36 UI + 34 feature
Custom Hooks27
API Endpoints230+
Routes19
Test Files67

Project Structure

frontend/
├── src/
│   ├── app/                    # Next.js App Router
│   │   ├── login/              # Login page
│   │   ├── register/          # Registration page
│   │   ├── rooms/             # Main rooms page
│   │   ├── dm/                # Direct messages
│   │   ├── explore/           # Room discovery
│   │   ├── account/           # Account management
│   │   ├── settings/           # App settings
│   │   ├── notifications/      # Notification center
│   │   ├── forgot-password/    # Password recovery
│   │   ├── reset-password/    # Password reset
│   │   ├── two-factor/        # 2FA verification
│   │   ├── layout.tsx         # Root layout
│   │   └── page.tsx           # Home (redirects)
│   ├── components/             # 70 React components
│   │   ├── Chat.tsx
│   │   ├── VoiceChat.tsx
│   │   ├── MessageItem.tsx
│   │   └── ... (51+ more)
│   ├── hooks/                  # Custom React hooks
│   │   ├── useWebRTC.ts       # Voice chat
│   │   ├── useChat.ts         # Chat WebSocket
│   │   ├── usePresence.ts     # Presence tracking
│   │   ├── useDM.ts           # Direct messages
│   │   └── ... (22 more)
│   ├── lib/
│   │   ├── api.ts             # Main API client
│   │   ├── store.ts           # Zustand stores
│   │   └── webrtc/            # WebRTC utilities
│   └── types/
│       └── index.ts           # TypeScript interfaces
├── e2e/                       # Playwright tests
├── package.json
└── next.config.js

Routes

PathDescription
/Root - redirects to /login or /rooms
/loginLogin page
/registerRegistration page
/roomsMain rooms page (voice + chat)
/dmDirect messages page
/exploreExplore rooms and discovery
/accountUser account management
/settingsApplication settings
/notificationsNotification center
/forgot-passwordPassword recovery request
/reset-passwordPassword reset with token
/two-factorTwo-factor authentication verification
/appearanceTheme and appearance customization
/keyboard-shortcutsKeyboard shortcuts reference
/profileUser profile page
/not-foundCustom 404 page
/loadingLoading state page
/errorError boundary page
/global-errorGlobal error boundary page

Error Monitoring (Sentry)

The frontend integrates Sentry for error tracking and performance monitoring.

Configuration

SettingValue
Client DSNNEXT_PUBLIC_SENTRY_DSN env var
EnvironmentNEXT_PUBLIC_SENTRY_ENVIRONMENT (default: development)
ReleaseGit commit SHA or VERSION env var
Traces Sample Rate100%
Replay Sample Rate10% sessions, 100% on error

Error Filtering

The beforeSend hook automatically drops noise events:

API Error Tracking

The API client (base.ts) automatically tracks:

Components

Development Commands

# Install dependencies
bun install

# Start dev server
bun run dev

# Run tests
bun run test:run
bun run test:e2e

# Lint
bun run lint