How datpham0412/go-realtime-chat works
Main Components
• Frontend:
• Represented by the "frontend" directory and all Vue.js components. This layer includes the main application (App.vue), components for chat features (ChatRoom, MessageList, MessageForm, Login, etc.), and routing configuration.
• Backend:
• Represented by main.go and the "server" directory containing the Go code for handling GraphQL calls, resolvers, authentication, and other server logic.
• GraphQL API:
• GraphQL layer which uses gqlgen. Include both queries and subscriptions handling.
• Redis:
• An external component for Redis since it is used for persisting chat messages and enabling real-time capabilities.
• GitHub OAuth:
• GitHub as an OAuth external authentication provider integrated into the backend.
• Docker & Deployment Orientation:
• Docker containerization elements – Dockerfiles for both the backend and frontend, and docker-compose configurations. Also include the deployment configuration for Fly.io.
• External Communication / WebSockets:
Relationships and Data Flow
• Clients (web browsers) interact with the Frontend (Vue.js) which communicates with the Backend via HTTP/GraphQL over WebSockets.
• The GraphQL API in the backend interfaces with Redis to store and retrieve chat history.
• The authentication layer interfaces with GitHub via OAuth, and the backend manages these auth requests.
Architectural Patterns and Key Technologies
• The client/server separation is distinct. On the client side, use component-based design as seen with Vue.js.
• The backend encapsulates GraphQL APIs using gqlgen, following a modular design (resolvers, models, custom directives) evident from the files in the server directory.
• Containerization is present. Emphasize Docker, docker-compose, and additional deployment scripts (fly.toml, render.yaml).
• Use of GitHub OAuth for secure authentication in a microservices-like setup.