evo-containerapp-web-messanger
Описание
Языки
- Vue42,2%
- Go32,8%
- TypeScript20,3%
- Dockerfile3,9%
- HTML0,8%
18 дней назад
18 дней назад
18 дней назад
18 дней назад
18 дней назад
18 дней назад
18 дней назад
18 дней назад
README.md
Web Messenger
A real-time web messenger application built with Golang (Fiber) backend and Vue.js 3 frontend.
📋 Project Overview
This is a modern, real-time messaging application featuring:
- Backend: Golang with Fiber v3 framework
- Frontend: Vue.js 3 with TypeScript and Vite
- Database: SQLite with GORM
- Real-time Communication: WebSocket support
- Markdown Support: Messages support Markdown formatting
- Modern UI: Telegram-inspired dark theme interface
🏗️ Architecture
Backend Structure
backend/
├── internal/
│ ├── cmd/ # Application entry point
│ ├── app/ # Application initialization
│ ├── domain/ # Business models and interfaces
│ ├── usecase/ # Business logic layer
│ ├── repository/ # Data access layer
│ └── delivery/ # HTTP handlers and WebSocket
├── data/ # SQLite database (auto-created)
├── go.mod
└── go.sum
Frontend Structure
frontend/
├── src/
│ ├── features/ # Feature modules (chat)
│ ├── shared/ # Shared utilities and composables
│ ├── types/ # TypeScript type definitions
│ ├── App.vue
│ └── main.ts
├── public/
├── index.html
├── package.json
├── vite.config.ts
└── tsconfig.json
🚀 Getting Started
Prerequisites
- Go: 1.21 or higher
- Node.js: 20 or higher
- npm or yarn
Backend Setup
- Navigate to the backend directory:
- Install dependencies:
- Run the backend server:
The backend server will start on http://localhost:8000
Frontend Setup
- Navigate to the frontend directory:
- Install dependencies:
- Start the development server:
The frontend will be available at http://localhost:3000
📦 Building for Production
Backend
The backend is already compiled when you run . For production:go run ./internal/cmd
Frontend
The built files will be in the directory.dist/
🔧 Configuration
Backend
- Port: 8000 (configurable in
)backend/internal/app/app.go - Database: SQLite at backend/data/messenger.db
- WebSocket:
endpoint/ws
Frontend
- Port: 3000 (configurable in
)frontend/vite.config.ts - API Proxy: Configured to proxy
and/apito backend/ws
🎯 Features
Real-time Messaging
- WebSocket-based real-time message delivery
- Automatic reconnection with exponential backoff
- Ping/pong heartbeat mechanism
Message Features
- Markdown support (bold, italic, code, links, lists)
- Message history with pagination
- Character limit (2000 characters)
- Timestamp display
User Experience
- Username management with localStorage persistence
- Responsive design
- Dark theme
- Connection status indicator
- Auto-scroll to latest messages
📡 API Endpoints
Messages
- Get message historyGET /api/v1/chat/default/messages?page=1&limit=50- Send a new messagePOST /api/v1/chat/default/messages
WebSocket
- WebSocket connection for real-time updatesWS /ws
🔒 Security
- CORS enabled for all origins (configure for production)
- Input validation on all endpoints
- XSS protection via DOMPurify
- Message length limits
🧪 Testing
Backend
Frontend
📝 Development Notes
Backend
- Follows Clean Architecture principles
- Dependency injection via constructors
- No global state
- Graceful shutdown handling
Frontend
- Feature-driven architecture
- Composition API with <script setup>
- TypeScript for type safety
- Composables for reusable logic
- No barrel files to avoid circular dependencies
🐛 Troubleshooting
Backend Issues
- Ensure Go 1.21+ is installed
- Check that port 8000 is not in use
- Verify database permissions in backend/data/
Frontend Issues
- Ensure Node.js 20+ is installed
- Clear
and reinstall if needednode_modules - Check that backend is running on port 8000
📄 License
This project is provided as-is for educational purposes.
🤝 Contributing
Contributions are welcome! Please follow the existing code style and architecture patterns.
📞 Support
For issues or questions, please refer to the code documentation or create an issue in the repository.