evo-containerapp-web-messanger-old
Описание
Языки
- Go59,8%
- Vue31,8%
- JavaScript4,6%
- CSS1,6%
- Shell1,2%
- Dockerfile0,8%
- Остальные0,2%
20 дней назад
20 дней назад
20 дней назад
20 дней назад
20 дней назад
20 дней назад
20 дней назад
20 дней назад
20 дней назад
20 дней назад
20 дней назад
README.md
Web Messenger Application
A real-time web messenger application built with Go backend and Vue.js frontend, featuring WebSocket support for instant messaging.
Features
Backend (Go)
- REST API for authentication and chat management
- WebSocket support for real-time messaging
- SQLite database with repository pattern
- User authentication with session management
- Avatar management for user profiles
- Integration tests for WebSocket functionality
Frontend (Vue.js)
- Single Page Application with Vue Router
- Real-time updates via WebSocket
- Chat list and individual chat views
- User authentication flow
- Responsive design with modern styling
- State management with Pinia
Project Structure
.
├── backend/ # Go backend application
│ ├── cmd/ # Application entry point
│ ├── internal/
│ │ ├── domain/ # Domain models and interfaces
│ │ ├── infrastructure/ # Database, WebSocket hub, server
│ │ ├── interfaces/ # HTTP and WebSocket handlers
│ │ └── usecase/ # Business logic
│ └── test/ # Integration tests
├── frontend/ # Vue.js frontend application
│ ├── src/
│ │ ├── components/ # Vue components
│ │ ├── composables/ # Vue composables
│ │ ├── router/ # Vue Router configuration
│ │ ├── stores/ # Pinia stores
│ │ └── views/ # Page views
├── Dockerfile # Multi-stage Docker build
├── docker-compose.yml # Local development setup
└── prompts/ # Development prompts
Prerequisites
- Docker and Docker Compose
- Node.js 18+ (for local frontend development)
- Go 1.21+ (for local backend development)
Quick Start with Docker
-
Clone the repository:
-
Start the application:
-
Access the application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8080
Local Development
Backend Setup
-
Navigate to backend directory:
-
Create environment file:
-
Install dependencies:
-
Run the backend:
Frontend Setup
-
Navigate to frontend directory:
-
Install dependencies:
-
Run the development server:
Running Tests
Backend Integration Tests
API Endpoints
Authentication
- Register a new userPOST /api/auth/register- Login userPOST /api/auth/login
Chats
- Get all chats for current userGET /api/chats- Create a new chatPOST /api/chats- Get chat detailsGET /api/chats/:id- Send a messagePOST /api/chats/:id/messages
WebSocket
- WebSocket connection for real-time updatesWS /ws
Environment Variables
Backend
- Server port (default: 8080)PORT- SQLite database path (default: ./data/messenger.db)DB_PATH- Secret key for JWT tokensJWT_SECRET
Docker Deployment
Build Docker Image
Run with Docker Compose
View Logs
Stop Services
Architecture
Backend Architecture
- Domain Layer: Business entities and interfaces
- Use Case Layer: Application business logic
- Infrastructure Layer: External dependencies (database, WebSocket)
- Interface Layer: HTTP and WebSocket handlers
Frontend Architecture
- Components: Reusable Vue components
- Views: Page-level components
- Composables: Reusable logic
- Stores: State management with Pinia
- Router: Navigation and route handling
Technology Stack
Backend
- Go 1.21+ - Programming language
- Gin - HTTP web framework
- Gorilla WebSocket - WebSocket implementation
- SQLite - Database
- JWT - Authentication
Frontend
- Vue 3 - JavaScript framework
- Vue Router - Routing
- Pinia - State management
- Vite - Build tool and dev server
- Axios - HTTP client
DevOps
- Docker - Containerization
- Docker Compose - Multi-container orchestration
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
License
This project is licensed under the MIT License.
Support
For issues and questions, please open an issue on the repository.