Skip to content

imahmedismail/chatphoria

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

21 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Chatphoria ๐Ÿ’ฌ

A full-featured, real-time chat application built with Phoenix LiveView and Tailwind CSS, featuring both group rooms and WhatsApp-style direct messaging.

Phoenix Elixir LiveView Tailwind

โœจ Features

๐Ÿ’ฌ Chat Functionality

  • Real-time messaging - Instant message delivery using Phoenix PubSub
  • Group chat rooms - Create, join, and switch between public chat rooms
  • One-to-one messaging - WhatsApp-style direct messaging with conversation bubbles
  • Dual chat modes - Switch between group rooms and private conversations
  • Message history - Persistent chat history with timestamps
  • Typing indicators - See when other users are typing in real-time

๐ŸŽจ User Interface

  • WhatsApp-style conversations - Messages appear on right (you) and left (others)
  • Beautiful UI - Modern, responsive design with gradient backgrounds
  • Tabbed navigation - Clean switch between "Rooms" and "Direct" messaging
  • Smart flash messages - Auto-dismissing notifications with progress bars
  • Mobile responsive - Collapsible sidebar and touch-optimized interface
  • Color-coded avatars - Unique gradient avatars for each user

๐Ÿ‘ฅ User Management

  • User presence - Online/offline status tracking for all users
  • Simple authentication - Username/email registration system
  • User discovery - Browse and start conversations with other users
  • Session management - Persistent login sessions

๐Ÿ”ง Technical Features

  • LiveView hooks - Clean JavaScript integration for enhanced UX
  • Real-time updates - Instant UI updates without page refreshes
  • Database constraints - Robust data validation and relationships
  • Comprehensive testing - Full test suite for all chat functionality

๐Ÿš€ Quick Start

Prerequisites

  • Elixir 1.14 or later
  • Erlang/OTP 25 or later
  • PostgreSQL database

Installation

  1. Clone and setup:

    git clone <repository-url>
    cd chatphoria
    mix setup
  2. Start the server:

    mix phx.server
  3. Visit the app: Open localhost:4000 in your browser

๐ŸŽฅ Video Tutorial

Complete App Walkthrough

Watch this comprehensive demo showcasing all of Chatphoria's features:

![Watch the demo]

What you'll see in this video:

  • ๐Ÿ” User registration and authentication
  • ๐Ÿ’ฌ Group chat rooms vs Direct messaging
  • ๐ŸŽจ WhatsApp-style conversation interface
  • ๐Ÿ“ฑ Mobile responsive design
  • โšก Real-time messaging and typing indicators
  • ๐Ÿ”” Smart auto-dismissing notifications
  • ๐Ÿ‘ฅ User presence and online status

Video demonstrates both desktop and mobile experiences

Sample Data

The app comes with pre-seeded data including:

  • 3 sample users (alice, bob, charlie)
  • 3 chat rooms (General, Random, Tech Talk)
  • Welcome messages to get you started

๐ŸŽฎ How to Use

Getting Started

  1. Register: Enter a username and email on the home page
  2. Choose chat mode: Use the "Rooms" and "Direct" tabs in the sidebar

Group Chat Rooms

  1. Join rooms: Click on any room in the sidebar to join the conversation
  2. Create rooms: Click the "+ New" button next to "Rooms" to create your own room
  3. Room chat: Messages appear with usernames and avatars in chronological order

Direct Messaging

  1. Start conversations: Click the "+ New" button next to "Direct Messages"
  2. Select user: Choose from the list of available users to start a conversation
  3. WhatsApp-style chat: Your messages appear on the right (blue), theirs on the left (gray)

General Features

  1. See activity: Watch typing indicators and user presence updates
  2. Auto-dismiss notifications: Success/error messages dismiss automatically with progress bars
  3. Mobile friendly: Use the hamburger menu on mobile to access the sidebar

๐Ÿ—๏ธ Architecture

Database Schema

  • Users - Authentication and user profiles with online status
  • Rooms - Chat room management with privacy settings and ownership
  • Messages - Chat messages supporting both room and conversation contexts
  • Room Memberships - User-room relationships with roles (owner, member)
  • Conversations - One-to-one chat relationships with message timestamps
  • Database Constraints - Ensures messages belong to either rooms OR conversations

Key Components

  • ChatLive - Main LiveView handling dual chat modes (rooms & conversations)
  • Flash Auto-Dismiss Hook - JavaScript hook for enhanced flash message UX
  • UserSessionController - Simple authentication system
  • Chat Context - Business logic for rooms, messages, and conversations
  • Accounts Context - User management, authentication, and presence
  • Core Components - Reusable UI components with custom styling

Real-time Features

  • Phoenix PubSub - Message broadcasting for both rooms and conversations
  • LiveView - Real-time UI updates without page refreshes
  • Typing indicators - Context-aware indicators for rooms and conversations
  • Presence tracking - User online/offline status with visual indicators
  • Auto-scrolling - Messages automatically scroll to bottom on new content
  • State management - Seamless switching between chat contexts

๐ŸŽจ UI Design

The application features a modern, professional design with:

Visual Design

  • Gradient backgrounds - Beautiful blue-to-indigo gradients throughout
  • WhatsApp-style bubbles - Familiar chat interface for direct messages
  • Smart flash messages - Auto-dismissing notifications with countdown progress bars
  • Tabbed navigation - Clean switching between Rooms and Direct messaging
  • Color-coded avatars - Unique gradient avatars for each user

User Experience

  • Responsive design - Mobile-first approach with collapsible sidebar
  • Touch-optimized - Large tap targets and smooth animations
  • Context-aware UI - Different layouts for group vs. direct chats
  • Hover interactions - Progress bar pausing, button feedback
  • Typography hierarchy - Clear information organization and readability

Technical Implementation

  • Tailwind CSS - Utility-first styling with custom gradients
  • CSS animations - Smooth transitions and progress indicators
  • JavaScript hooks - Enhanced interactivity with LiveView integration
  • Mobile overlay - Proper z-indexing and backdrop handling

๐Ÿ”ง Development

Available Commands

# Setup project and database
mix setup

# Start development server
mix phx.server

# Run tests
mix test

# Reset database with fresh data
mix ecto.reset

# Build assets
mix assets.build

Project Structure

lib/
โ”œโ”€โ”€ chatphoria/
โ”‚   โ”œโ”€โ”€ accounts/          # User management & presence
โ”‚   โ”‚   โ”œโ”€โ”€ user.ex        # User schema with status
โ”‚   โ”‚   โ””โ”€โ”€ accounts.ex    # User context & authentication
โ”‚   โ””โ”€โ”€ chat/              # Chat functionality
โ”‚       โ”œโ”€โ”€ room.ex        # Room schema
โ”‚       โ”œโ”€โ”€ message.ex     # Message schema (dual context)
โ”‚       โ”œโ”€โ”€ conversation.ex# Conversation schema
โ”‚       โ”œโ”€โ”€ room_membership.ex # Room membership
โ”‚       โ””โ”€โ”€ chat.ex        # Chat context & business logic
โ”œโ”€โ”€ chatphoria_web/
โ”‚   โ”œโ”€โ”€ controllers/       # Authentication controllers
โ”‚   โ”œโ”€โ”€ live/              # LiveView components
โ”‚   โ”‚   โ””โ”€โ”€ chat_live.ex   # Main chat interface
โ”‚   โ””โ”€โ”€ components/        # UI components
โ”‚       โ””โ”€โ”€ core_components.ex # Enhanced flash messages
assets/
โ””โ”€โ”€ js/
    โ””โ”€โ”€ app.js             # LiveView hooks & JavaScript
priv/
โ””โ”€โ”€ repo/
    โ”œโ”€โ”€ migrations/        # Database schema evolution
    โ””โ”€โ”€ seeds.exs          # Sample data with conversations

๐Ÿš€ Deployment

Ready to run in production? Please check the Phoenix deployment guides.

๐Ÿ› ๏ธ Built With

๐Ÿ“ License

This project is open source and available under the MIT License.

๐ŸŽฏ What Makes Chatphoria Special

  • Dual Chat Modes - Seamlessly switch between group discussions and private conversations
  • WhatsApp-like UX - Familiar interface patterns that users already know and love
  • Real-time Everything - No page refreshes, just instant updates across all connected clients
  • Mobile-First Design - Works beautifully on phones, tablets, and desktops
  • Smart Interactions - Hover to pause timers, context-aware UI, intelligent notifications
  • Production Ready - Comprehensive testing, proper error handling, and scalable architecture

๐ŸŒŸ Screenshots

Group Chat Rooms

  • Traditional chat interface with usernames and timestamps
  • Room creation and management
  • Real-time typing indicators

Direct Messaging

  • WhatsApp-style message bubbles
  • Your messages on the right (blue), theirs on the left (gray)
  • Clean, distraction-free conversation view

Mobile Experience

  • Collapsible sidebar with hamburger menu
  • Touch-optimized interface
  • Responsive design that works on any screen size

Chatphoria - Where conversations come alive! ๐ŸŽ‰ The perfect blend of group collaboration and private messaging.

About

Chatphoria is a real-time chat application built with Elixir, Phoenix, and LiveView, offering seamless two-way messaging entirely without custom JavaScript. This project showcases channel-based messaging, topic-based pub/sub communication, and LiveView-powered interfaces for instantly updated chat rooms and user interactions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors