Skip to content

Nawab-AS/chat-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hackatime Badge

Chat App

This is a simple chat app that uses websockets, and a postgreSQL database. The purpose of this project is to allow me to independantly learn how to use websockets and postgres.

Live Demo

Want to see a live demo? Head on over to chat.nawab-as.software

Installation

  1. Install this repository through git by
git clone https://github.com/Nawab-AS/chat_app.git
cd ./chat_app
  1. install node modules by
npm i

Usage

  1. Create a postgreSQL database. there are multiple ways of doing this, one way to do this is by using the createdb command in your terminal,

    This is not the only way to setup a PostgreSQL database, hense, you are not limited to only this method and can do it is any way you please

    createdb <database_name>

    Replace <database_name> with the desired name for your database. You may need to adjust user permissions or connection settings depending on your PostgreSQL setup.

  2. Run setup.sql on the database through pgadmin, dbeaver, psql, etc to setup tables, functions and procedures

  3. Create a .env file in the root directory that constains the following.

Caution

The actual valus of the .env file should never be shared with anyone otherwise it could lead to a security breach

SESSION_KEY="<insert your session secret>"
DATABASE_URI="postgres://<username>:<password>@<host>:<port>/<database name>"
  • SESSION_KEY is a random cryptographically generated string that is used to authorize login sessions and encrypt user passwords, Because of this, it is essential that it remains the same and isn't leaked.
  • DATABASE_URI contains the necessary credentials to access your database.

Optionaly, you can use cloudflare turnstiles (similar to captcha). Simply create a site and secret here and add the following to your .env file

CAPTCHA_SITE_KEY="<insert your site key>"
CAPTCHA_SECRET_KEY="<insert your secret key>"

Now captcha will be require during login and sign up.

  1. Run the server using the following command in terminal
npm run start

optionally you can also use the heroku cli as well with

heroku local

Screenshots

These are some sample screenshots

Login page

Login Page

Signup page

Signup Page

Chat page

Chat Page

Add friend menu

Add Friend Menu

Questions or Concerns

For any questions or concerns please email me at nawab-as@hackclub.app

About

Resources

Stars

Watchers

Forks

Contributors