/gochat

A Golang and React chat application

Primary LanguageGo

gochat

A Golang and React chat application backed by MySQL

Setup

Prerequisites

Configure database

  • Log in to MySQL and create a database 'chat' by running create database chat
  • Import the chat database structure by running mysql -u <username> -p chat < config/chat_database.sql, replacing <username> with your MySQL username
  • Export the database data source name used for connecting by running export CHAT_DB_DSN="<username>:<password>@/chat?charset=utf8&parseTime=true", replacing <username> and <password> with your MySQL credentials

Install dependencies

  • run go install
  • run yarn install or npm install
  • run webpack

Start server

go run server.go

Features

  • Persistent database stores username and messages
  • Supports multiple connections and broadcasted messages through websockets
  • On login, shows new (unseen by that user) messages by default. The user may then choose to display all messages.

Resources

Looking ahead

Application

  • Incorporate user authentication
  • Allow user to select number of lines to display in chatroom
  • Add mute feature

Implementation

  • Add config file for more customizable usage
  • Add testing