Skip to content

A Real-time chat application utilizing WebSockets, crafted with Go(lang) for the backend and React.js for the frontend.

Notifications You must be signed in to change notification settings

aayushxrj/gochat

Repository files navigation

GoChat

GoChat is a real-time chat application built with Go for the backend and React for the frontend. It uses WebSockets for real-time communication between clients and the server.

Screenshot (767)

Screenshot (769)

Quick Start

Clone the Repository

git clone https://github.com/aayushxrj/gochat

Navigate to the Project Directory

cd ./gochat/

Now you can get the app up and running. You can do this either by running it locally on your machine or via Docker or within a GitHub Codespace.

Local Usage

To get started with GoChat, you need to have Go and Node.js installed on your machine. Go is used for running the backend server, and Node.js is used for managing frontend dependencies and running the development server.

  1. Install Prerequisites
  • Go (1.22.2 or later)
  • Node.js (19.8.1 or later)
  1. Start the backend server
cd src/backend/
go run .
  1. Start the frontend development server

Open a new terminal session and run:

npm install
npm run dev

You can access the app at http://localhost:5173/

Docker Usage

If you have Docker installed and running, you can also run the application using Docker. Follow these steps:

Using Docker Compose

Directly pull and run from Docker Hub (recommended):

docker-compose up

or Build and run the Docker image locally:

docker-compose up --build

You can access the app at http://localhost:5173/

GitHub Codespaces Usage

If you're running this inside a GitHub Codespace, follow these steps to get the app up and running:

  1. Execute the following command in the terminal to get the Codespace name:
export $CODESPACE_NAME
  1. Copy the output and add it to the .env file in the root directory of the project. Your dotenv file should look like this:
VITE_CODESPACE_NAME=your_codespace_name
  1. Build and run the Docker image:
docker-compose up --build

You can then access the app at https://your_codespace_name-5173.app.github.dev/

Using the Application

Screenshot (768)

  • Join the chat

When you first open the GoChat application, you will be prompted to enter a username. Enter a username of your choice and click "Join" to enter the chat room.

  • Send a message

Once in the chat room, you can start typing messages in the input field at the bottom of the screen and click the "Send" button to send a message.

  • Receive messages

Messages from other users will appear in real-time. You can see who sent each message along with the message content.

Contributing

Contributions to GoChat are welcome! If you have an idea for an improvement or have found a bug, please open an issue or submit a pull request

License

GoChat is open-source software licensed under the MIT license.

About

A Real-time chat application utilizing WebSockets, crafted with Go(lang) for the backend and React.js for the frontend.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published