Skip to content

rafmme/anony-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

anony-chat

Anonymous Real-Time Messaging Chat Platform

Chat with strangers anonymously.
View Demo

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. License

About The Project

A real-time messaging platform for chatting anonymously:

Given requirements

  • A user can create an account
  • A user login into their account
  • A user can chat with other online users in real-time via websockets

Built With

  • Go
  • PostgreSQL
  • Websocket
  • Vanilla JS
  • Postman

API Swagger Docs

https://chatty-5o1n.onrender.com/docs

Endpoints:

Create an account

POST /api/v1/auth/signup

Example request body:

{
    "email": "test.user@gmail.com",
    "password": "HelloMrWsa@88",
    "confirmPassword": "HelloMrWsa@88"
}

Required fields: emailpassword, confirmPassword

Login into an account

POST /api/v1/auth/login

Example request body:

{
    "email": "test.user@gmail.com",
    "password": "HelloMrWsa@88"
}

Required fields: emailpassword

Websocket connection Url

WS /ws/chat?auth_token=token_here

Required query param: auth_token

HTTP Response Status codes:

  • 200 for OK
  • 201 for new user account successfully created
  • 400 for Bad requests
  • 401 Unauthorized
  • 404 for Not found requests, when a resource can't be found to fulfill the request
  • 409 for conflicting requests
  • 500 for Internal Server Error

(back to top)

Getting Started

Prerequisites

  • To run this project, make sure you have Go and PostgreSQL installed on your machine.

Installation

  1. Clone the repo

    git clone https://github.com/rafmme/anony-chat.git
  2. Rename the .env.sample file to .env and populate the variables with the right data

     PORT="6777"
     DB_HOST="127.0.0.1"
     DB_PORT="5432"
     DB_NAME="chatapp"
     DB_USER="user"
     DB_PASSWORD="password"
     SECRET_KEY="KeepAtItBoy!"
     BOT_KEY="xssduifgATA4qwer6078-99y7654wsxghcvr5rfvhvmgcvv"
    
  3. Run this command make run or make start to start up the application.

(back to top)

Usage

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)