A real-time chat application built with Rust (Axum) backend and React frontend.
- 🔐 User Authentication (Registration/Login)
- 💬 Real-time Messaging
- 👥 Friend Management System
- 🏢 Group Chat
- 📁 File Upload and Sharing
- 🎤 Voice Messages
- 📷 Image and Video Sharing
- 🔔 Real-time Notifications
- 📱 Responsive Design
- Rust - Systems programming language
- Axum - Modern async web framework
- PostgreSQL - Primary database
- Redis - Caching and session storage
- WebSocket - Real-time communication
- JWT - Authentication
- SQLx - Database ORM
- React 19 - UI framework
- TypeScript - Type safety
- Tailwind CSS - Styling framework
- Vite - Build tool
- Socket.IO - WebSocket client
- Axios - HTTP client
- Rust 1.70+
- Node.js 18+
- PostgreSQL 13+
- Redis 6+
-
Clone the repository
git clone <repository-url> cd rusty-chat
-
Setup database
# Run database setup script ./scripts/setup_db.sh # Or setup manually createdb rusty_chat psql -d rusty_chat -f migrations/001_initial.sql
-
Configure environment variables
# Copy environment template cp .env.example .env # Edit .env file and set your database and Redis connection info
-
Start Redis
# macOS brew services start redis # Linux sudo systemctl start redis # Or run directly redis-server
-
Install frontend dependencies
cd frontend npm install -
Start development servers
Backend (Terminal 1):
cargo run
Frontend (Terminal 2):
cd frontend npm run dev -
Access the application
- Frontend: http://localhost:5173
- Backend API: http://localhost:3000
rusty-chat/
├── src/ # Rust backend source code
│ ├── handlers/ # API handlers
│ ├── models/ # Data models
│ ├── services/ # Business logic
│ ├── config.rs # Configuration management
│ ├── database.rs # Database connection
│ ├── websocket.rs # WebSocket handling
│ └── main.rs # Application entry point
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── contexts/ # React Context
│ │ ├── pages/ # Page components
│ │ ├── services/ # API services
│ │ └── types/ # TypeScript types
│ └── public/ # Static assets
├── migrations/ # Database migrations
├── scripts/ # Utility scripts
└── uploads/ # File upload directory
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/refresh- Refresh token
GET /api/users/me- Get current user infoGET /api/users/search- Search users
GET /api/friends- Get friends listPOST /api/friends/requests- Send friend requestPOST /api/friends/requests/:id/accept- Accept friend requestPOST /api/friends/requests/:id/reject- Reject friend requestDELETE /api/friends/:id- Remove friend
GET /api/groups- Get groups listPOST /api/groups- Create groupGET /api/groups/:id/members- Get group membersPOST /api/groups/:id/members- Add group memberDELETE /api/groups/:id/members/:user_id- Remove group member
GET /api/messages/:chat_id- Get chat messagesPOST /api/messages- Send message
POST /api/upload- Upload fileGET /api/files/:id- Download file
authenticate- Authenticationjoin_chat- Join chat roomleave_chat- Leave chat roomsend_message- Send messagetyping_indicator- Typing status indicator
new_message- New messagetyping_indicator- Typing statususer_online- User onlineuser_offline- User offlinefriend_request- Friend requestgroup_invitation- Group invitation
# Run tests
cargo test
# Check code
cargo clippy
# Format code
cargo fmtcd frontend
# Run tests
npm test
# Code linting
npm run lint
# Build for production
npm run build# Build frontend
cd frontend
npm run build
# Build backend
cargo build --release# Build image
docker build -t rusty-chat .
# Run container
docker run -p 3000:3000 rusty-chat# Start all services (database, redis, app)
docker-compose up -d
# Stop all services
docker-compose down# Use the development script for automatic setup
./scripts/dev.sh- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or suggestions, please create an Issue or contact the project maintainers.