A Real Time Chat Application created using VueJS

๐ŸŒ  Astro Chat ๐ŸŒ 

Real Time Chat Application created with VueJS, Express, Socket IO and MongoDB/Mongoose/Mongo Altas.

Astro Chat Demo

Demo

View the application at https://astro-chat-io.herokuapp.com/

Tech Stack

TechnologyDescriptionLink โ†˜๏ธHTML5Hyper Text Markup Languageโ€”-CSS3Cascading Style Sheetsโ€”-JavaScriptHigh Level, Dynamic, Interpreted Languageโ€”-SASSSyntactically Awesome Style Sheetshttps://sass-lang.com/BabelJavascript Compilerhttps://babeljs.io/WebpackJavascript Module Bundlerhttps://webpack.js.org/NodeJSOpen Source, Javascript Run Time Environment, Execute Javascript code for server sidehttps://nodejs.org/en/VueJSProgressive Javascript Frameworkhttps://vuejs.org/JestJavascript Testing Frameworkhttps://jestjs.io/ExpressWeb Framework for Node.jshttps://expressjs.com/MongoDBNoSQL Databasehttps://www.mongodb.com/

Features

  • Express as the web framework on the server
  • Implements stateless authentication with JWT tokens
  • Authenticates JWT and social authentication using Passport
  • Hashes passwords using the bcryptjs package
  • Enables real time communication to the server using Socket IO
  • MongoDB and Mongo Atlas is used for storing and querying data
  • Server logging is done with Winston and Morgan
  • Concurrently is used to run both the server and client at the same time
  • Vue JS is used as the frontend framework
  • Travis CI is incorporated for continuous integration
  • Heroku is used for production deployment

Installation

Running Locally

Ensure Node.js and NPM are installed

  1. Clone or Download the repository (Depending on whether you are using SSH or HTTPS)
$ git clone git@github.com:dalmatian315/astro-chat.git
$ cd astro-chat
  1. Install dependencies for root, client and server
You will need to npm install in each directory in order to install the node module needed for each part of the project
Directories Include: Root, Server & Client
  1. Add .env file to server folder and fill out details according to the .env.example. See configuration details for social auth and database setup: Note, this is mandatory for the application to run
  2. Set NODE_ENV=development and HEROKU_DEPLOYMENT=false
  3. Start the application
$ npm run dev

Your app should now be running on localhost:8080.

Run [Production Ready] Mode

Ensure Node.js and NPM are installed

This runs the application with the built production ready Vue files as well as running the express server in production mode serving up the compiled files.

  1. Clone or Download the repository (Depending on whether you are using SSH or HTTPS)
$ git clone git@github.com:dalmatian315/astro-chat.git
$ cd astro-chat
  1. Install dependencies for root, client and server
You will need to npm install in each directory in order to install the node module needed for each part of the project
Directories Include: Root, Server & Client
  1. Add .env file to server folder and fill out details according to the .env.example. See configuration details for social auth and database setup. Note, this is mandatory for the application to run
  2. Ensure you set NODE_ENV=production and HEROKU_DEPLOYMENT=false
  3. Start the application in the root folder of the project. Since itโ€™s running in production mode, you should not see any message such as: โ€œServer started at port 5000โ€
$ npm run start

Your app should now be running on the port you specified in the .env file. If none was specified it will default to port 5000.

Eg. localhost:5000.

Deploying to Heroku

Ensure you have Heroku CLI installed

  1. Login to heroku via the CLI
$ heroku login
  1. Create a new Heroku Application
$ heroku create
  1. Before pushing to heroku, you need to set up the config variables in other words the env variables you would use if you were doing this locally
  2. i. Go to Settings -> Reveal Config Vars
  3. ii. Add the config variables according to the .env.example
  4. iii. These Include
HEROKU_DEPLOYMENT=true
DATABASE_URL
FACEBOOK_CLIENT_ID
FACEBOOK_CLIENT_SECRET
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET
JWT_SECRET
NPM_CONFIG_PRODUCTION (Must be false)
PORT (Optional)
  1. iv. Ensure that you add NPM_CONFIG_PRODUCTION to false to allow installation of dev dependencies for post build to work correctly
  2. Commit any changes and push your code from local repo to your git
$ git add -A
$ git commit -m "insert message here"
$ git push heroku master
  1. Open the heroku app
$ heroku open

Note: You may also connect your github repo to the heroku and add automatic deployment on push to the github repo

Seeding Data

If at anytime in development youโ€™d like to quickly seed some dummy data you use the command below

$ npm run seed:data

Running Tests

Tests should be run before every commit to ensure the build is not broken by any code changes.

Running Both Client and Server Tests

In the root directory
$ npm run test

Running Client Tests

$ npm run client:test

Watching Server Tests

$ npm run server:test:watch

Configuration Setup

These configuration setups are necessary for the app to function correctly as intended. These configuration setups will be required to be added as environment variables for the server to make use of.

Local Environment Variables (.env file)

For development you will need a .env file for environmental variables.


Note: These are required for the application to be setup correctly

NODE_ENV=development
HEROKU_DEPLOYMENT=false

DATABASE_URL=DATABASE_URL

EXPRESS_SESSION_KEY=EXPRESS_SESSION_KEY
JWT_SECRET=JWT_SECRET

GOOGLE_CLIENT_ID=GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET=GOOGLE_CLIENT_SECRET

FACEBOOK_CLIENT_ID=FACEBOOK_CLIENT_ID
FACEBOOK_CLIENT_SECRET=FACEBOOK_CLIENT_SECRET

PORT=PORT

MongoDB & Mongo Atlas

A MongoDB URI is needed to connect to a MongoDB connection. The easiest way to do this is to use Mongo Atlas. If youโ€™d like to do this locally you can follow the instructions at (https://docs.mongodb.com/manual/installation/)

Mongo Atlas

  1. Select โ€˜Build a New Clusterโ€™ and follow the prompts
  2. When the Cluster has been created, click on โ€˜Connectโ€™
  3. Choose your connection method, for the purposes of this application we will use โ€˜Connect Your Applicationโ€™
  4. Next you will need to grab this connection string (Standard connection string). This is the URI that will be used as an environment variable

JWT Secret

The JWT Secret is required as a way to keep the JWT Token secure when the signature is hashed. This secret key should be secret to you and should be updated periodically.

Google

To setup google oauth, youโ€™ll need to configure some details through Google Cloud Platform

  1. Navigate to https://console.cloud.google.com/
  2. Using โ€˜APIs & Servicesโ€™, youโ€™ll need to enable the โ€˜Google+ APIโ€™
  3. Once enabled, click on โ€˜Credentialsโ€™
  4. Go to โ€˜OAuth Consent Screenโ€™, you will need to add the โ€˜Authorized Domainsโ€™ to authorize your domain with Google
  5. You will need to save the Client ID and Client Secret for use in the environment variables
  6. You will also need to add the domain you are using ie. localhost or heroku to both โ€˜Authorized Javascript Originsโ€™ and โ€˜Authorized Redirect URIsโ€™
  7. i. The redirect URIs are in the format of domain/api/auth/provider/redirect

Facebook

To setup facebook oauth, youโ€™ll need to configure some details through Facebook for Developers

  1. Login at https://developers.facebook.com/
  2. Go to โ€˜My Appsโ€™ and create a new app
  3. Navigate to Settings -> basic
  4. Save the App ID and App Secret for use in environment variables
  5. Add your app domain in โ€˜App Domainsโ€™
  6. Under Products -> Facebook Login -> Settings, Add your redirect URIs under โ€˜Valid OAuth Redirect URIsโ€™
  7. i. The redirect URIs are in the format of domain/api/auth/provider/redirect

Contribute

Built as a personal project for learning experience. Please feel free to contribute by creating issues, submitting new pull requests!

GitHub

View Github

Related Posts

Popular Posts

BrowserVideoEdit: A feature-rich video editor created using fabric.js and Next.js, all within the convenience of your web browser

A weather app that allows users to view real-time weather information based on their locations

Add Login and Register page into your Nuxt 3 project using Supabase authentication

A powerful Flutter package that allows you to easily create and control glitch effects

เด’เดฐเต‡เดฆเดฟเดตเดธเด‚ เดฐเดฃเตเดŸเตเดชเต‡เดฐเต†เดฏเตเด‚ เดชเต†เดฃเตเดฃเตเด•เดฃเตเดŸเต, เด•เต‹เดŸเตเดŸเดฏเด‚ เดชเต‚เดžเตเดžเดพเดฐเตโ€ เดธเตเดตเดฆเต‡เดถเดฟเดฏเดพเดฏ เดฆเดจเตเดคเดกเต‹เด•เตเดŸเดฑเตเดฎเดพเดฏเดฟ เดตเดฟเดตเดพเดนเด‚ เดฐเดœเดฟเดธเตเดฑเตเดฑเตผ เดšเต†เดฏเตเดคเต , เดชเดฟเดจเตเดจเต€เดŸเต เดตเต‡เดฃเตเดŸเต†เดจเตเดจเตเดตเต†เดšเตเดšเต.

A Library for Rendering 3D Models in React.js and Next.js Views

Recent Posts

เด‡เดŸเตเด•เตเด•เดฟเดฏเดฟเดฒเต† เดฎเดฒเดฏเต‹เดฐ เดฎเต‡เด–เดฒเด•เดณเดฟเตฝ เดฐเดพเดคเตเดฐเดฟเดฏเดพเดคเตเดฐ เดจเดฟเดฐเต‹เดงเดฟเดšเตเดšเต. เดฐเดพเดคเตเดฐเดฟ เดเดดเต เดฎเตเดคเตฝ เดฐเดพเดตเดฟเดฒเต† เด†เดฑเต เดตเดฐเต†เดฏเดพเดฃเต เดจเดฟเดฐเต‹เดงเดจเด‚

เดเดจเตเดคเดฏเดพเตผ เดˆเดธเตเดฑเตเดฑเดฟเตฝ เดชเตเดฐเดณเดฏเดคเตเดคเดฟเตฝ เดคเด•เตผเดจเตเดจ เดชเดพเดฒเดคเตเดคเดฟเดจเต เดชเด•เดฐเด‚ เดชเตเดคเดฟเดฏ เดชเดพเดฒเด‚ เดจเดฟเตผเดฎเตเดฎเดฟเด•เตเด•เตเดตเดพเตป เดคเดพเดคเตเด•เตเด•เดพเดฒเดฟเด• เดชเดพเดฒเด‚ เดชเตŠเดณเดฟเดšเตเดšเต เดจเต€เด•เตเด•เดฟ

Explore the Investment Opportunities: A Comprehensive Guide to Different Types of Mutual Funds

Title: Understanding Mutual Funds: A Beginner's Guide to Investing

เดคเต€เดตเตเดฐเดฎเดด เดฎเตเดจเตเดจเดฑเดฟเดฏเดฟเดชเตเดชเดฟเดจเตเดฑเต† เดชเดถเตเดšเดพเดคเดฒเดคเตเดคเดฟเตฝ เดธเด‚เดธเตเดฅเดพเดจเด‚ เดœเดพเด—เตเดฐเดคเดฏเดฟเตฝ

250,000 เด…เดชเต‡เด•เตเดทเด•เตพ เดตเตผเดฆเตเดงเดฟเดšเตเดšเดคเดฟเดจเดพเตฝ เดŸเตเดฐเดพเตปเดธเตโ€Œเดชเต‹เตผเดŸเตเดŸเต เด•เดฎเตเดฎเต€เดทเดฃเตผ เดชเดฐเดฟเดถเต‹เดงเดจ เดชเตเดจเดฐเดพเดฐเด‚เดญเดฟเด•เตเด•เตเด‚

เดเดฒเด•เตเด•เดฏเดฟเตฝ เด•เต€เดŸเดจเดพเดถเดฟเดจเดฟ เดธเดพเดจเตเดจเดฟเดงเตเดฏเด‚; เด†เดฑเดฐ เดฒเด•เตเดทเดคเตเดคเดฟเดฒเดงเดฟเด•เด‚ เดŸเดฟเตป เด…เดฐเดตเดฃ เดจเดถเดฟเดชเตเดชเดฟเด•เตเด•เดพเตป เดŸเต†เตปเดกเตผ เด•เตเดทเดฃเดฟเดšเตเดšเต เดฆเต‡เดตเดธเตเดตเด‚ เดฌเต‹เตผเดกเตโ€Œ

เดญเต€เดฎเตป เดชเดพเดฑเด•เตเด•เดทเดฃเด™เตเด™เตพ เด…เดŸเตผเดจเตเดจเต เดฆเต‡เดถเต€เดฏ เดชเดพเดคเดฏเดฟเดฒเต‡เด•เตเด•เต เดตเต€เดดเตเดจเตเดจเดคเต เดชเดคเดฟเดตเดพเด•เตเดจเตเดจเต. เด•เตเดŸเตเดŸเดฟเด•เตเด•เดพเดจเดคเตเดคเดฟเดจเตเด‚ เดฎเตเดฃเตเดŸเด•เตเด•เดฏเดคเตเดคเดฟเดจเตเดฎเดฟเดŸเดฏเดฟเตฝ เดจเดฟเดฒเดจเดฟเตฝเด•เตเด•เตเดจเตเดจเดคเต เดตเตป เด…เดชเด•เดŸ เดญเต€เดทเดฃเดฟ

เดšเด•เตเดฐเดตเดพเดคเดšเตเดšเตเดดเดฟ:เด…เดคเดฟเดถเด•เตเดคเดฎเดพเดฏ เดฎเดด เดตเดฐเตเดจเตเดจเต

เดชเตเดฒเดธเต เดตเตบ เดชเตเดฐเดตเต‡เดถเดจเด‚. เด…เด•เตเดทเดฏเดฏเดฟเตฝ เดคเดฟเด•เตเด•เดฟ เดคเดฟเดฐเด•เตเด•เต‡เดฃเตเดŸ, เดจเต†เดฑเตเดฑเดฟเดตเดฟเดฑเตเดฑเดฟ/เดœเดพเดคเดฟ เดคเต†เดณเดฟเดฏเดฟเด•เตเด•เดพเตป เดชเดคเตเดคเดพเด‚เดคเดฐเด‚ เดธเตผเดŸเตเดŸเดฟเดซเดฟเด•เตเด•เดฑเตเดฑเต เดฎเดคเดฟ