Real-time terminal-based chat application for Mac users
- โ User registration and login (JWT token)
- โ Real-time WebSocket communication
- โ Terminal-based chat client
- โ Message history stored in database
- โ User join/leave notifications
# Install dependencies
pip3 install -r requirements.txt
# Create .env file
echo "SECRET_KEY=your_super_secret_key_here" > .env
# Start server
python3 server.py
# Start client in new terminal
python3 terminal_client.py- Register or login
- Type message and press Enter
- Type
quitto exit
POST /register- User registrationPOST /login- User login and JWT token
connect- Connection establishedjoin- Join chat roommessage- Send messageleave- Leave room
- โ
User registration (
/register) - โ
User login (
/login) - โ JWT token verification
- โ WebSocket connection
- โ Real-time messaging
- โ Terminal client interface
- โ Message database storage
- โ Multi-user support
# Register test
curl -X POST http://localhost:8080/register \
-H "Content-Type: application/json" \
-d '{"username": "testuser", "password": "testpass123"}'
# Login test
curl -X POST http://localhost:8080/login \
-H "Content-Type: application/json" \
-d '{"username": "testuser", "password": "testpass123"}'# Terminal 1: Server
python3 server.py
# Terminal 2: Client 1
python3 terminal_client.py
# Terminal 3: Client 2
python3 terminal_client.py
# Terminal 4: Client 3
python3 terminal_client.py# 3 users automated test (elif, sercan, lordi)
python3 test_multi_user.py# Automatically starts 3 clients
./quick_test.sh- โ User registration and login
- โ JWT token acquisition
- โ WebSocket connection
- โ Message sending/receiving
- โ 3 users connect simultaneously (Elif, Sercan, Lordi)
- โ Elif sends loving messages to Sercan โค๏ธ
- โ Sercan responds romantically ๐
- โ Lordi sends playful messages like a funny kid ๐
- โ Real-time communication tested
- โ User join/leave notifications
- โ WebSocket polling works
- โ Message latency < 1 second
- โ Database records correct
- โ Connection drop/reconnect
test_multi_user.py- Automated multi-user testquick_test.sh- Quick test scriptterminal_client.py- Manual test client
- Private messaging (DM)
- Multiple chat rooms
- File sharing
- Emoji support
- Message editing/deletion
- Friend add/remove
- User profiles
- Online status
- Message search
- Notification system
- Post sharing
- Homepage (latest/friend posts)
- Post like/dislike
- Comment system
- Hashtag support
broccoli/
โโโ server.py # Main Flask server
โโโ models.py # Database models (User, Message)
โโโ routes.py # API endpoints (/register, /login)
โโโ socket_events.py # WebSocket event handlers
โโโ terminal_client.py # Terminal chat client
โโโ test_multi_user.py # Automated multi-user test
โโโ quick_test.sh # Quick test script
โโโ requirements.txt # Python dependencies
โโโ .env # Environment variables (SECRET_KEY)
โโโ proje.db # SQLite database
โโโ .gitignore # Git ignore file
โโโ LICENSE # MIT License
โโโ README.md # Turkish README
โโโ README_EN.md # English README
โโโ assets/ # Project assets
โโโ broccoli-logo.png
โโโ database-diagram.png
- Flask - Web framework
- Flask-SQLAlchemy - Database ORM
- Flask-SocketIO - WebSocket support
- PyJWT - JWT authentication
- SQLite - Database
- Eventlet - Async server
- Python - Terminal client
- SocketIO-client - WebSocket client
- Requests - HTTP client
- JWT tokens for authentication
- Password hashing with werkzeug
- CORS enabled for cross-origin requests
# Install dependencies
pip3 install -r requirements.txt
# Set environment
export FLASK_ENV=development
export SECRET_KEY=your_secret_key
# Run server
python3 server.py# Database is auto-created on first run
# Location: proje.db (SQLite)
# Tables:
# - users (id, username, password_hash, created_at)
# - messages (id, user_id, content, timestamp)Register a new user
{
"username": "newuser",
"password": "password123"
}Login and get JWT token
{
"username": "existinguser",
"password": "password123"
}join- Join chat roommessage- Send messageleave- Leave room
user_joined- User joined notificationuser_left- User left notificationmessage- New message received
-
Port 8080
- Server uses port 8080 by default
- Check if port is available
-
JWT token errors:
- Ensure SECRET_KEY is set in .env
- Check token expiration
-
WebSocket connection failed:
- Verify server is running
- Check firewall settings
-
Database errors:
- Delete proje.db to reset
- Check file permissions
- Fork the repository
- Create feature branch
- Make changes
- Test thoroughly
- Submit pull request
MIT License - see LICENSE file for details
Made with โค๏ธ for Mac users who love terminal-based applications
