Skip to content

A Custom Vibe Coded Solution for a Self Hosted Online Voice Community.

License

Notifications You must be signed in to change notification settings

DemonFiend/sgChat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

142 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

sgChat - Self-hosted Voice Community Application.

GitHub License GitHub Issues GitHub Stars

A modern, self-hosted chat platform that combines the best features of Discord, Revolt, and Guilded with real-time messaging capabilities.

๐Ÿš€ Live Demo

Demo is currently Down till all the core features are implemented.

All Features are Experimental until the Official V1.0.0 Release.

Features may experience visual bugs or unexpected behaviour, please report this via the issues section.

๐Ÿ”ง Technologies Used

Backend

  • Runtime: Node.js 20+ with TypeScript
  • API Framework: Fastify + Socket.IO
  • Database: PostgreSQL 16
  • Cache: Redis 7
  • Storage: MinIO (S3-compatible)
  • Voice/Video: LiveKit
  • Push Notifications: ntfy

Frontend

  • Desktop Client: Tauri 2.0 + SolidJS + TypeScript + Vite
  • Mobile Client: React Native (V2)
  • Web Client: SolidJS + TypeScript + Vite
  • Admin Panel: React-admin
  • Styling: Tailwind CSS + CSS Variables
  • State Management: SolidJS Signals + Custom Stores

๐Ÿ“‹ Features Implemented

๐Ÿ’ฌ Messaging

โœ… Real-time text messaging with Socket.IO
โœ… Message editing and deletion
โœ… Message reactions (emoji)
โœ… Message pinning
โœ… Message replies with cross-segment reference handling
โœ… File attachments with type/size validation
โœ… Typing indicators
โœ… Read receipts and unread message counts
โœ… Giphy integration (trending/search)

๐Ÿ“ž Voice & Video

โœ… Voice channels with LiveKit integration
โœ… Video streaming (permission-based)
โœ… Screen sharing (permission-based)
โœ… DM voice calls
โœ… Temporary voice channels (auto-cleanup when empty)
โœ… Voice state tracking (mute, deafen, streaming)
โœ… AFK channel auto-move
โœ… Voice participant management (move, disconnect, mute)
โœ… User limits and bitrate configuration

๐Ÿ“บ Live Streaming / Screen Share

โœ… Full-screen stream viewer overlay
โœ… Host preview (see your own stream)
โœ… Picture-in-Picture (PiP) mode via browser API
โœ… Minimize to audio-only mode (listen while browsing)
โœ… Stream audio controls (volume slider, mute)
โœ… Live viewer count display
โœ… Quality selection (720p, 1080p, Native)
โœ… Browser fullscreen support

๐Ÿ’Œ Direct Messages

โœ… DM channels with auto-creation on friendship
โœ… Message status tracking (sent/received/read)
โœ… DM voice calls
โœ… Friend system (requests, accept/reject)
โœ… User blocking

๐Ÿ  Server Management

โœ… Server creation, update, and deletion
โœ… Channel management with reordering
โœ… Category management with permission overrides
โœ… Role management with templates and bulk operations
โœ… Granular role-based permissions system
โœ… Channel permission overrides (role and user level)
โœ… Member management (kick, ban, timeout)
โœ… Invite system with expiration and max uses
โœ… Server transfer ownership
โœ… Welcome channel and announcement channels
โœ… Server popup configuration (welcome messages)
โœ… Audit logging for server actions

๐Ÿ” Security & Authentication

โœ… JWT access tokens + httpOnly refresh token cookies
โœ… Password hashing with Argon2
โœ… Password reset via email
โœ… Credential encryption (AES-GCM for "Remember me")
โœ… Rate limiting (per-endpoint)
โœ… Admin claim code system
โœ… Session management with token rotation

๐ŸŽจ User Experience

โœ… User status (online, idle, dnd, offline)
โœ… Custom status with text, emoji, and expiration
โœ… Themes (Dark, Light, OLED, Nord) with system preference detection
โœ… Avatar management with history tracking
โœ… Display names and profile customization
โœ… Timezone support (public/private)
โœ… User search by username
โœ… Presence coalescing (throttled updates)

๐Ÿ—๏ธ Infrastructure

โœ… Message archiving to MinIO cold storage (gzip compressed)
โœ… Message segmentation for efficient history management
โœ… Retention policies (time-based and size-based)
โœ… Message export (JSON/CSV with date range filtering)
โœ… Storage statistics per channel/DM
โœ… Event bus system (pub/sub for real-time events)
โœ… SSE fallback gateway with sequence tracking
โœ… Idempotency support (Idempotency-Key header)
โœ… Redis caching (sessions, presence, voice state)
โœ… Health checks
โœ… Client-side message caching with ETag/hash-based sync
โœ… Debounced ACK requests (reduces server load)

๐Ÿ”” Notifications

โœ… Push notifications via ntfy
โœ… Mention notifications
โœ… Friend request notifications
โœ… Reaction notifications
โœ… Priority levels

๐Ÿ”ฎ Planned Features (TODO List)

๐Ÿ’ฌ Messaging Improvements

  • Message search functionality with filters
  • Custom emoji support (server-specific)
  • Sticker packs
  • Message scheduling UI (backend supports queued_at)
  • Rich text editor (markdown rendering exists)

๐Ÿ” Security & Privacy

  • Two-factor authentication (2FA/TOTP)
  • Device tracking and session management UI
  • Message encryption at rest
  • End-to-end encryption for voice/video calls

๐ŸŽจ User Experience

  • Comprehensive keyboard shortcuts
  • Accessibility improvements (screen readers, ARIA labels)
  • Language localization (i18n)
  • Theme customization with live preview

๐Ÿ—๏ธ Infrastructure & Performance

  • Load balancing and horizontal scaling
  • CDN integration for media files
  • Analytics dashboard for server metrics
  • Advanced database optimization

๐ŸŽค Voice & Video Enhancements

  • Audio Check
  • Bringing in Video (Webcam)
  • Virtual backgrounds and effects

โš ๏ธ Known Limitations

Screen Share Audio Capture (Browser Limitation)

The getDisplayMedia() browser API has inherent limitations for audio capture:

Share Type Audio Behavior
Browser Tab Captures tab audio only
Window No isolated app audio (system audio or nothing)
Entire Screen Captures all system audio

Why can't I share audio from a specific app (Spotify, YouTube, etc.)?

Browsers intentionally do not expose per-application audio routing for privacy and security reasons. The getDisplayMedia() API cannot isolate audio streams from individual applications.

Workarounds:

  • Share a browser tab if your content is web-based (captures that tab's audio only)
  • Use system audio and close other audio sources
  • For advanced use cases, a native desktop application or browser extension with elevated permissions would be required

๐Ÿš€ Getting Started

Prerequisites

  • Docker & Docker Compose
  • Node.js 20+
  • pnpm 8+

Development

# Install dependencies
pnpm install

# Start development servers
pnpm dev

# Build all packages
pnpm build

Production Deployment

# Configure environment
cp docker/.env.example docker/.env
# Edit docker/.env with your settings

# Start all services
cd docker
docker-compose up -d

Project Structure

sgchat/
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ shared/          # Shared types, validators, constants
โ”‚   โ”œโ”€โ”€ api/             # Fastify server (main API)
โ”‚   โ”œโ”€โ”€ client-core/     # Shared React components
โ”‚   โ”œโ”€โ”€ client-desktop/  # Tauri desktop app
โ”‚   โ”œโ”€โ”€ client-web/      # Web fallback client
โ”‚   โ”œโ”€โ”€ client-mobile/   # React Native (V2) - Mobile client
โ”‚   โ””โ”€โ”€ admin/           # React-admin dashboard for admins
โ”œโ”€โ”€ docker/              # Docker compose and configs
โ”œโ”€โ”€ themes/              # Bundled themes
โ””โ”€โ”€ docs/                # Documentation

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

Fork the repository Create a feature branch (git checkout -b feature/AmazingFeature) Commit your changes (git commit -m 'Add some AmazingFeature') Push to the branch (git push origin feature/AmazingFeature) Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

Built with modern web technologies Real-time communication powered by Fastify and Socket.IO Self-hosted push notifications through ntfy

Proof of concept Photos:

Login: https://imgur.com/a/KkAJ8FL Friends/DMs: https://imgur.com/a/HQFJlbd Server: https://imgur.com/a/SGehJfG Server options: https://imgur.com/a/h1hMYsE Server permissions: https://imgur.com/a/z1mE8W1

About

A Custom Vibe Coded Solution for a Self Hosted Online Voice Community.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •