evo-containerapp-web-messanger-old

0

Описание

Языки

  • Go59,8%
  • Vue31,8%
  • JavaScript4,6%
  • CSS1,6%
  • Shell1,2%
  • Dockerfile0,8%
  • Остальные0,2%
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

  1. Clone the repository:

  2. Start the application:

  3. Access the application:

Local Development

Backend Setup

  1. Navigate to backend directory:

  2. Create environment file:

  3. Install dependencies:

  4. Run the backend:

Frontend Setup

  1. Navigate to frontend directory:

  2. Install dependencies:

  3. Run the development server:

Running Tests

Backend Integration Tests

API Endpoints

Authentication

  • POST /api/auth/register
    - Register a new user
  • POST /api/auth/login
    - Login user

Chats

  • GET /api/chats
    - Get all chats for current user
  • POST /api/chats
    - Create a new chat
  • GET /api/chats/:id
    - Get chat details
  • POST /api/chats/:id/messages
    - Send a message

WebSocket

  • WS /ws
    - WebSocket connection for real-time updates

Environment Variables

Backend

  • PORT
    - Server port (default: 8080)
  • DB_PATH
    - SQLite database path (default: ./data/messenger.db)
  • JWT_SECRET
    - Secret key for JWT tokens

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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests
  5. 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.