Skip to content

metehansaral/driftchat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DriftChat

DriftChat is a temporary chat room application built with Elixir Phoenix LiveView. Users can set a nickname to generate unique 64-character links and share them to chat in real-time.

Details

  • Temporary Chat Rooms: Instant chat without persistent storage
  • 🔗 Unique Links: Secure 64-character room IDs
  • 💬 Real-Time Messaging: Instant messaging with Phoenix LiveView
  • 📁 File Sharing: Preview support for image files
  • 📱 Mobile-Friendly: iOS-style responsive design
  • 🎨 Modern Interface: Sleek and minimal design with Tailwind CSS

Technologies

  • Elixir – Functional programming language
  • Phoenix Framework – Web development framework
  • Phoenix LiveView – Real-time web application support
  • Tailwind CSS – Utility-first CSS framework
  • GenServer – Chat room process management
  • Phoenix PubSub – Real-time messaging system

Installation

Requirements

  • Elixir 1.14+
  • Erlang/OTP 25+
  • Node.js 16+ (for asset compilation)

Steps

  1. Install dependencies:

    mix deps.get
  2. Compile assets:

    mix assets.deploy
  3. Start the server:

    mix phx.server
  4. Open in your browser:

    http://localhost:4000
    

Usage

Creating a New Room

  1. Enter a nickname on the homepage
  2. Click the "Create Room" button
  3. You'll be redirected to the new room automatically
  4. Share the room link via the "Copy Link" button

Joining an Existing Room

  1. Enter a nickname on the homepage
  2. Enter the room ID
  3. Click the "Join Room" button

Messaging

  • Use the input field at the bottom to send text messages
  • Click the attachment icon to share files
  • Image files are displayed with previews automatically

Architecture

Chat Room Management

# Each chat room runs as a GenServer process
Driftchat.ChatRoom
├── User management
├── Message history
└── File sharing

# Room processes are managed via Dynamic Supervisor
Driftchat.RoomSupervisor
├── Room creation
├── Room termination
└── Room status checking

Real-Time Communication

# Room-specific messaging via Phoenix PubSub
Phoenix.PubSub.broadcast(Driftchat.PubSub, "room:#{room_id}", message)

File Handling

  • Files are temporarily stored in base64 format
  • Data URLs are used for image previews
  • No persistent storage (privacy by design)

Security

  • CSRF protection enabled
  • File size limit (10MB)
  • XSS protection
  • Secure room IDs generated with :crypto.strong_rand_bytes

Development

Run Tests

mix test

Code Formatting

mix format

Linting

mix credo

Deployment

Production Build

# Install dependencies for production
MIX_ENV=prod mix deps.get --only prod

# Compile assets
MIX_ENV=prod mix assets.deploy

# Create release
MIX_ENV=prod mix release

Environment Variables

export SECRET_KEY_BASE="your-secret-key"
export PHX_HOST="your-domain.com"
export PORT=4000

DriftChat – Secure and fast communication through temporary chat rooms 🚀

About

secure and fast communication through temporary chat rooms

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published