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
