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.
- ✨ 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
- 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
- Elixir 1.14+
- Erlang/OTP 25+
- Node.js 16+ (for asset compilation)
-
Install dependencies:
mix deps.get
-
Compile assets:
mix assets.deploy
-
Start the server:
mix phx.server
-
Open in your browser:
http://localhost:4000
- Enter a nickname on the homepage
- Click the "Create Room" button
- You'll be redirected to the new room automatically
- Share the room link via the "Copy Link" button
- Enter a nickname on the homepage
- Enter the room ID
- Click the "Join Room" button
- 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
# 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
# Room-specific messaging via Phoenix PubSub
Phoenix.PubSub.broadcast(Driftchat.PubSub, "room:#{room_id}", message)
- Files are temporarily stored in base64 format
- Data URLs are used for image previews
- No persistent storage (privacy by design)
- CSRF protection enabled
- File size limit (10MB)
- XSS protection
- Secure room IDs generated with
:crypto.strong_rand_bytes
mix test
mix format
mix credo
# 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
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 🚀