Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ConnectSphere — Real-Time Communication & Collaboration Platform

License: MIT Node.js TypeScript React Tailwind CSS WebRTC SFU Socket.IO Prisma ORM

Project: CodeAlpha Full Stack Development Internship — Task 4
Product: ConnectSphere Web Application
Version: 1.0.0
Target: Functional, secure, responsive, deployment-ready web application


1. Product Overview

ConnectSphere is an enterprise-grade full-stack real-time communication and team collaboration platform. It eliminates context-switching by unifying multi-user HD video calls, crystal-clear screen sharing, meeting-scoped chat, private file transfers, and an interactive synchronized whiteboard into one accessible browser workspace.

Every control performs genuine actions:

  • Real Multi-User Audio & Video: WebRTC SFU streaming via LiveKit Cloud with local preview fallback.
  • Genuine Screen Sharing: Captures displays, windows, or tabs via the browser DisplayMedia API.
  • Incremental Collaborative Whiteboard: Synchronizes vector strokes, geometric shapes, text annotations, and collaborator cursors with sub-20ms latency.
  • Meeting-Scoped Chat: Real-time Socket.IO messaging with sender identity, timestamps, and persistent history.
  • Secure File Sharing: In-meeting document exchange with MIME validation, 25MB limits, and path traversal protections.
  • Host Room Management: Unguessable room identifiers (cns-xxxx-xxxx), attendee capacity enforcement, and host-authorized termination ("End Meeting for All").

2. Technical Stack

Tier Technologies
Frontend React 19, TypeScript, Vite, Tailwind CSS, Lucide Icons, Canvas Confetti
Media Layer LiveKit Client SDK (livekit-client), WebRTC MediaStream API, Web Audio API Analyzer
Real-Time Events Socket.IO Client / Server (Chat, Whiteboard, Presence, Screen Share State)
Backend API Node.js, Express, TypeScript, Zod, Helmet, CORS, Multer, Rate Limiting
Media Server SDK LiveKit Server SDK (livekit-server-sdk) for server-side token generation
Database & ORM PostgreSQL (Production) + SQLite (Local Zero-Config Dev), Prisma ORM
Security JWT (7-day signed tokens), bcryptjs (12 salt rounds), DTLS-SRTP, input sanitization
Testing Jest, ts-jest, Supertest (14/14 automated test suites passing)

3. Quickstart Guide (Run Locally in 2 Minutes)

Step 1: Install Dependencies

Open a terminal in the project root:

# Install backend dependencies
cd backend
npm install

# Install frontend dependencies
cd ../frontend
npm install

Step 2: Seed the Database

Initialize the local SQLite database and pre-populate test users and demo rooms:

cd ../backend
npm run db:push
npm run db:seed

Step 3: Run the Development Servers

In two separate terminal windows:

Terminal 1 (Backend API & Socket Server):

cd backend
npm run dev
# Server running at http://localhost:5000
# Health check: http://localhost:5000/api/health

Terminal 2 (Frontend Client):

cd frontend
npm run dev
# App running at http://localhost:5173

Open http://localhost:5173 in your browser.


4. Pre-Configured Test Credentials

The database seed provides two accounts with full collaboration history:

Role Email Password Pre-seeded Permissions
Demo Host alex.host@connectsphere.com Password123! Host privileges, room creation, End Meeting authority
Demo Participant sarah.dev@connectsphere.com Password123! Active attendee, screen sharing, whiteboard, files
Demo Room Code cns-demo-room N/A Active collaborative room pre-loaded with chat & files

Tip: You can also click the "Quick Test Credentials" buttons on the Sign In page to populate credentials with one click.


5. LiveKit Cloud Configuration (Optional SFU Setup)

ConnectSphere works out of the box with native browser media preview. To enable global cloud SFU multi-user routing:

  1. Create a free account at https://cloud.livekit.io.
  2. Create a project and retrieve your keys from Settings ➔ Keys.
  3. Add them to backend/.env:
    LIVEKIT_URL=wss://your-project.livekit.cloud
    LIVEKIT_API_KEY=your_livekit_api_key
    LIVEKIT_API_SECRET=your_livekit_api_secret
  4. Restart the backend. The startup banner will confirm:
    🎥 LiveKit Configured: YES (Cloud SFU)
    

6. Switching Between SQLite & PostgreSQL

ConnectSphere includes a built-in schema switcher:

  • Use SQLite (Zero-Config Local Default):
    npm run db:use:sqlite
    npm run db:push
  • Use PostgreSQL (Production / Docker):
    # Start PostgreSQL container via docker-compose
    docker compose up -d
    
    # Switch Prisma to PostgreSQL
    npm run db:use:postgres
    
    # Set DATABASE_URL in backend/.env:
    # DATABASE_URL="postgresql://postgres:postgrespassword@localhost:5432/connectsphere_db"
    
    # Push schema
    npm run db:push

7. Automated Testing & Verification

Run the comprehensive integration test suite covering authentication, meetings, media token generation, security rate limits, and health checks:

cd backend
npm test

Verified Test Results:

PASS tests/meeting.test.ts (5.941 s)
  Meeting API & Room Management
    ✓ should create a new meeting room with unguessable code (40 ms)
    ✓ should retrieve meeting details by room code (17 ms)
    ✓ should return 404 for non-existent room code (13 ms)
    ✓ should join meeting and return participant record (29 ms)
    ✓ should issue media token for meeting (22 ms)
    ✓ should end meeting when requested by host (42 ms)

PASS tests/auth.test.ts
  Authentication API
    ✓ should register a new user successfully (458 ms)
    ✓ should reject registration with duplicate email (13 ms)
    ✓ should login an existing user with correct credentials (414 ms)
    ✓ should reject login with incorrect password (395 ms)
    ✓ should access protected profile with valid token (15 ms)
    ✓ should reject protected route without auth token (14 ms)

PASS tests/health.test.ts
  Health Check Endpoint
    ✓ should return 200 and healthy status (43 ms)
    ✓ should return API discovery info at root / (14 ms)

Test Suites: 3 passed, 3 total
Tests:       14 passed, 14 total

8. Frontend Production Build Check

Verify that the frontend builds without TypeScript or bundling errors:

cd frontend
npm run build

Output:

✓ 1979 modules transformed.
dist/index.html                   1.04 kB │ gzip:   0.65 kB
dist/assets/index.css            39.43 kB │ gzip:   7.62 kB
dist/assets/index.js            952.99 kB │ gzip: 258.08 kB
✓ built in 13.88s

9. Project Directory Structure

ConnectSphere/
├── backend/
│   ├── prisma/
│   │   ├── schema.prisma             # SQLite schema (default local dev)
│   │   └── schema.postgresql.prisma  # PostgreSQL schema (production)
│   ├── src/
│   │   ├── config/                   # Environment & provider validation
│   │   ├── controllers/              # Auth, meetings, files, whiteboard, history
│   │   ├── db/                       # Prisma client & database seed
│   │   ├── middleware/               # JWT auth, rate limiter, multer, error handler
│   │   ├── routes/                   # REST API routes
│   │   ├── services/                 # LiveKit SDK token service, storage service
│   │   ├── socket/                   # Socket.IO real-time collaboration engine
│   │   ├── types/                    # Backend TypeScript interfaces
│   │   ├── utils/                    # Password hashing, JWT, room codes, logger
│   │   └── server.ts                 # Express & Socket.IO server initialization
│   ├── tests/                        # Automated Jest / Supertest test suites
│   ├── .env.example                  # Backend environment template
│   └── package.json
├── frontend/
│   ├── src/
│   │   ├── api/                      # Client API methods
│   │   ├── components/
│   │   │   ├── common/               # Navbar, Button, Modal
│   │   │   ├── meeting/              # ControlsBar, VideoTile, ParticipantGrid, etc.
│   │   │   └── whiteboard/           # Synchronized Canvas drawing engine
│   │   ├── context/                  # AuthContext, MediaContext, MeetingContext
│   │   ├── pages/                    # Landing, Login, Dashboard, PreJoin, Meeting, History, Profile
│   │   ├── types/                    # Frontend models & state declarations
│   │   ├── utils/                    # Class merge & formatters
│   │   ├── App.tsx                   # Central router & context wrappers
│   │   └── main.tsx
│   ├── tailwind.config.js            # Custom dark SaaS theme
│   ├── vite.config.ts                # Dev server & reverse proxy configuration
│   └── package.json
├── docs/
│   ├── ARCHITECTURE.md               # High-level architecture & Socket.IO contract
│   ├── API.md                        # Complete REST API reference
│   └── DEPLOYMENT.md                 # Production deployment & DevOps guide
├── docker-compose.yml                # PostgreSQL service container
├── .env.example                      # Root environment variables reference
├── .gitignore                        # Standard ignore rules
├── package.json                      # Workspace scripts
└── README.md                         # Main product documentation

10. Deliverable Packaging

As specified in Task 4 requirements, the verified, complete project source is packaged into:

ConnectSphere_CodeAlpha_Task4.zip

This archive excludes heavy temporary folders (node_modules, dist, .env, temporary cache files) and contains everything necessary for clean installation, testing, and deployment.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages