- ๐ฏ About the Project
- โจ Features
- ๐ ๏ธ Technology Stack
- ๐๏ธ Architecture
- ๐ Installation
- ๐ฑ Usage
- ๐ง Development
- ๐ API Documentation
- ๐ Security
- ๐ค Contributing
- ๐ License
T-Force is a comprehensive authentication and real-time chat platform developed for modern web applications. It provides a high-performance, secure, and scalable solution using Rust backend and Next.js frontend.
- Security: Modern encryption and authentication standards
- Performance: Rust's speed and Next.js optimizations
- Scalability: Microservice architecture and Docker support
- User Experience: Modern UI/UX design
- โ Email/Password Login: Secure user registration and login
- โ OAuth Integration: Social login with Google and GitHub
- โ Two-Factor Authentication (2FA): TOTP-based security
- โ Password Reset: Secure password reset via email
- โ Session Management: Multi-session control and termination
- โ JWT Token System: Secure token-based authentication
- โ WebSocket Connection: Instant messaging
- โ Room System: Private and public chat rooms
- โ Media Sharing: Image, video, and voice messages
- โ Message History: Persistent message storage
- โ Room Passwords: Secure private rooms
- โ Auto Reconnection: Automatic recovery on connection loss
- โ Profile Management: User information and profile pictures
- โ Role-Based Authorization: Admin and user roles
- โ User Status: Active/inactive user control
- โ Admin Panel: User management and system control
- โ Rate Limiting: API request rate limiting
- โ CORS Protection: Cross-origin request security
- โ SQL Injection Protection: ORM-based secure database operations
- โ XSS Protection: Frontend security measures
- โ Password Hashing: Secure password storage with Argon2
# Core Framework actix-web = "4.4.0" # Web framework actix-cors = "0.7.1" # CORS middleware actix-web-actors = "4.2.0" # WebSocket support # Database sea-orm = "1.1.14" # ORM postgres = "16-alpine" # Database # Authentication jsonwebtoken = "9.3.1" # JWT token argon2 = "0.5.2" # Password hashing oauth2 = "4.4.2" # OAuth integration # Other serde = "1.0.188" # Serialization tokio = "1.32.0" # Async runtime lettre = "0.11.18" # Email sending
{
"next": "15.5.0", // React framework
"react": "19.0.0", // UI library
"typescript": "5.0+", // Type safety
"tailwindcss": "3.4.0", // CSS framework
"shadcn/ui": "latest", // UI components
"react-hook-form": "7.62.0", // Form management
"jwt-decode": "4.0.0", // JWT parsing
"lucide-react": "0.541.0" // Icons
}- PostgreSQL 16: Primary database
- Docker & Docker Compose: Containerization
- Traefik: Reverse proxy and load balancer
- Nginx (production): Static file serving
- Let's Encrypt: Automatic SSL certificates
- GitHub Actions: CI/CD pipeline
- Prometheus: Metrics collection
- Grafana: Monitoring dashboard
- Docker Health Checks: Service monitoring
- Automated Backups: Database backup scripts
- Log Aggregation: Structured logging
- Cargo: Rust package manager
- npm/yarn: Node.js package manager
- ESLint & Prettier: Code formatting
- TypeScript: Type checking
- Sea-ORM: Database ORM
- Actix-Web: Web framework
- Tailwind CSS: Utility-first CSS
- Shadcn/UI: Component library
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Frontend โ โ Traefik โ โ Backend โ
โ (Next.js) โโโโโบโ (Reverse Proxy)โโโโโบโ (Rust) โ
โ Port: 3000 โ โ Port: 80 โ โ Port: 8080 โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Static Files โ โ Load Balancer โ โ PostgreSQL โ
โ & Assets โ โ & SSL/TLS โ โ Database โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
POST /api/auth/register # User registration
POST /api/auth/login # Login
POST /api/auth/logout # Logout
GET /api/auth/validate # Token validation
POST /api/auth/forgot # Password reset request
POST /api/auth/reset # Password reset
GET /api/user/me # Get user information
PUT /api/user/profile # Update profile
POST /api/user/avatar # Upload profile picture
GET /api/user/sessions # Active sessions
DELETE /api/user/session/:id # Terminate session
GET /api/chat/rooms # Get chat rooms
POST /api/chat/rooms # Create a new room
GET /api/chat/rooms/:id # Get room details
DELETE /api/chat/rooms/:id # Delete room
GET /api/chat/messages # Get message history
POST /api/chat/upload # Upload media
WS /ws # WebSocket connection
- Docker & Docker Compose: Container management
- Git: Version control
- Node.js 18+: Frontend development (optional)
- Rust 1.70+: Backend development (optional)
- Clone the project
git clone https://github.com/togisoft/t-force.git
cd t-force- Create environment file
cp env.prod.example .env.prod
# Edit the .env.prod file- Start development environment
# For development cp env.prod.example .env.dev ./scripts/dev.sh # For production ./scripts/prod-deploy.sh
- Access the application
- Frontend: http://localhost
- Backend API: http://localhost/api
- Traefik Dashboard: http://localhost:8080
- Grafana: http://grafana.localhost
# Create production environment file cp env.prod.example .env.prod # Start in production mode ./scripts/prod-deploy.sh
- Click on "Sign Up" tab on the main page
- Enter email, name and a strong password
- Complete email verification
- Sign in or use OAuth for quick login
- Access the dashboard
- Click on "New Room" button
- Set room name and password (optional)
- Invite friends by sharing the room code
- Start sending messages, images, videos and audio
- Go to profile settings
- Open "Two-Factor Authentication" section
- Scan QR code and enter verification code
- Store your backup codes in a safe place
# Backend development cd backend cargo run # Frontend development cd frontend npm install npm run dev # Database migration (handled automatically by prod-deploy.sh)
# Backend tests cd backend cargo test # Frontend tests cd frontend npm test # E2E tests npm run test:e2e
All scripts should be run from the project root directory:
# Start development environment ./scripts/dev.sh # Start production environment ./scripts/prod-deploy.sh # Create backup ./scripts/backup.sh # View logs ./scripts/logs.sh # Stop services ./scripts/stop.sh # Reset environment ./scripts/reset.sh
# Format check cargo fmt --check # Linting cargo clippy -- -D warnings # Run tests cargo test
# Format check npm run lint # Type checking npm run type-check # Build test npm run build
{
"name": "John Doe",
"email": "[email protected]",
"password": "securePassword123"
}{
"email": "[email protected]",
"password": "securePassword123"
}Response:
{
"user": {
"id": "uuid",
"email": "[email protected]",
"name": "John Doe",
"role": "user"
},
"token": "jwt_token_here"
}{
"type": "join_room",
"room_id": "room_uuid",
"password": "optional_password"
}
{
"type": "send_message",
"room_id": "room_uuid",
"content": "Hello, world!",
"message_type": "text"
}{
"type": "message",
"data": {
"id": "message_uuid",
"user": {
"id": "user_uuid",
"name": "John Doe"
},
"content": "Hello, world!",
"timestamp": "2024-01-01T12:00:00Z"
}
}- Password Hashing: Argon2 algorithm
- JWT Token: Secure token-based authentication
- Rate Limiting: API request rate limiting
- CORS: Cross-origin request security
- SQL Injection: Protection via ORM usage
- XSS: Frontend sanitization
# Critical security settings NEXTAUTH_SECRET=your-super-secret-key JWT_SECRET=your-jwt-secret DATABASE_URL=postgres://user:pass@localhost/db # OAuth settings GOOGLE_CLIENT_ID=your-google-client-id GOOGLE_CLIENT_SECRET=your-google-client-secret GITHUB_CLIENT_ID=your-github-client-id GITHUB_CLIENT_SECRET=your-github-client-secret
- Use strong passwords
- Enable 2FA
- Keep environment variables secure
- Use HTTPS (in production)
- Perform regular updates
- Fork the project
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow code standards
- Write tests
- Update documentation
- Write descriptive commit messages
This project is licensed under the MIT License. See the LICENSE file for details.
Developed with โค๏ธ



