All Projects → OmarElGabry → Chat.io

OmarElGabry / Chat.io

Licence: mit
A Real Time Chat Application built using Node.js, Express, Mongoose, Socket.io, Passport, & Redis.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Chat.io

Mean Angular4 Chat App
MEAN stack with Angular 4 Chat App
Stars: ✭ 41 (-96.91%)
Mutual labels:  mongoose, express, chat, socket
Jianshu
仿简书nx+nodejs+nestjs6+express+mongodb+angular8+爬虫
Stars: ✭ 296 (-77.66%)
Mutual labels:  mongoose, redis, express, passport
Mern Passport
A boilerplate example of using passport.js for authenticating a MERN application
Stars: ✭ 214 (-83.85%)
Mutual labels:  mongoose, express, passport
Practice
💦 你没有见过的终极实战
Stars: ✭ 283 (-78.64%)
Mutual labels:  mongoose, redis, express
Nest Angular
NestJS, Angular 6, Server Side Rendering (Angular Universal), GraphQL, JWT (JSON Web Tokens) and Facebook/Twitter/Google Authentication, Mongoose, MongoDB, Webpack, TypeScript
Stars: ✭ 307 (-76.83%)
Mutual labels:  mongoose, express, passport
Blog Service
blog service @nestjs
Stars: ✭ 188 (-85.81%)
Mutual labels:  mongoose, redis, express
Vuesocial
something like QQ、weibo、weChat(vue+express+socket.io仿微博、微信的聊天社交平台)
Stars: ✭ 189 (-85.74%)
Mutual labels:  mongoose, express, socket
Express Graphql Mongodb Boilerplate
A boilerplate for Node.js apps / GraphQL-API / Authentication from scratch - express, graphql - (graphql compose), mongodb (mongoose).
Stars: ✭ 288 (-78.26%)
Mutual labels:  mongoose, redis, express
Mern Boilerplate
Fullstack boilerplate with React, Redux, Express, Mongoose, Passport Local, JWT, Facebook and Google OAuth out of the box.
Stars: ✭ 112 (-91.55%)
Mutual labels:  mongoose, express, passport
Node Express Mongoose Demo
A simple demo app using node and mongodb for beginners
Stars: ✭ 4,976 (+275.55%)
Mutual labels:  mongoose, express, passport
Meantorrent
meanTorrent - MEAN.JS BitTorrent Private Tracker - Full-Stack JavaScript Using MongoDB, Express, AngularJS, and Node.js, A BitTorrent Private Tracker CMS with Multilingual, and IRC announce support, CloudFlare support. Demo at:
Stars: ✭ 438 (-66.94%)
Mutual labels:  mongoose, express, passport
Node Express Mongoose
A boilerplate application for building web apps using node and mongodb
Stars: ✭ 1,221 (-7.85%)
Mutual labels:  mongoose, express, passport
Lad
👦 Lad is the best Node.js framework. Made by a former Express TC and Koa team member.
Stars: ✭ 2,112 (+59.4%)
Mutual labels:  mongoose, redis, passport
Ecommerce Site Template
A beautiful e-commerce template powered by React, Redux and other modern web tech.
Stars: ✭ 167 (-87.4%)
Mutual labels:  mongoose, express, passport
Saas
Build your own SaaS business with SaaS boilerplate. Productive stack: React, Material-UI, Next, MobX, WebSockets, Express, Node, Mongoose, MongoDB. Written with TypeScript.
Stars: ✭ 2,720 (+105.28%)
Mutual labels:  mongoose, express, passport
Node Express Mongoose Passport Jwt Rest Api Auth
Node, express, mongoose, passport and JWT REST API authentication example
Stars: ✭ 146 (-88.98%)
Mutual labels:  mongoose, express, passport
Saea
SAEA.Socket is a high-performance IOCP framework TCP based on dotnet standard 2.0; Src contains its application test scenarios, such as websocket,rpc, redis driver, MVC WebAPI, lightweight message server, ultra large file transmission, etc. SAEA.Socket是一个高性能IOCP框架的 TCP,基于dotnet standard 2.0;Src中含有其应用测试场景,例如websocket、rpc、redis驱动、MVC WebAPI、轻量级消息服务器、超大文件传输等
Stars: ✭ 318 (-76%)
Mutual labels:  redis, chat, socket
Node Express Mongodb Jwt Rest Api Skeleton
This is a basic API REST skeleton written on JavaScript using async/await. Great for building a starter web API for your front-end (Android, iOS, Vue, react, angular, or anything that can consume an API). Demo of frontend in VueJS here: https://github.com/davellanedam/vue-skeleton-mvp
Stars: ✭ 603 (-54.49%)
Mutual labels:  mongoose, redis, express
Es6 Express Mongoose Passport Rest Api
Lightweight boilerplate for Node RESTful API, ES6, Express, Mongoose and Passport 🎁
Stars: ✭ 36 (-97.28%)
Mutual labels:  mongoose, express, passport
Chatter
A chatting app using socket.io
Stars: ✭ 53 (-96%)
Mutual labels:  express, socket

Screenshot

chat.io

Dependency Status Scrutinizer Code Quality Code Climate FOSSA Status

A Real Time Chat Application built using Node.js, Express, Mongoose, Socket.io, Passport, & Redis.

Index

Demo

Check Demo

Features

Installation

Running Locally

Make sure you have Node.js and npm installed.

  1. Clone or Download the repository

    $ git clone https://github.com/OmarElGabry/chat.io.git
    $ cd chat.io
    
  2. Install Dependencies

    $ npm install
    
  3. Edit configuration file in app/config/config.json with your credentials(see Setup Configurations).

  4. Download and Install Redis.

  5. Running Redis Server(as Admin)

    $ redis-server
    
  6. Start the application

    $ npm start
    

Your app should now be running on localhost:3000.

Deploying to Heroku

Make sure you have the Heroku Toolbelt installed.

  1. Create a new Heroku application, and push your chat application to a Git remote repository

    $ heroku create
    $ git push heroku master
    

    or

    Deploy to Heroku

  2. Now, you need to set up configuration variables on Heroku.

    1. Go to Settings -> Reveal Config Vars.
    2. Add configuration variables. All needed variables are inside app/config/index.js. Typically, these are the configuration variables you need to assign: { dbURI, sessionSecret, facebookClientID, facebookClientSecret, twitterConsumerKey, twitterConsumerSecret }(see Setup Configurations).
  3. One last step is to add Redis as an Add-on on Heroku.

    1. Go to Resources -> Add-ons
    2. Select Heroku Redis

    You need to setup a billing account even if the add-on is free.

  4. Open your chat application in the browser

    $ heroku open
    

How It Works

Setup Configurations

The configurations on production will be assigned from Environment Variables on Heroku, while the development configurations reside inside app/config/config.json file.

MongoDB & MongoLab

You need to create a database on MongoLab, then create a database user, get the MongoDB URI, and assign it to dbURI.

Facebook & Twitter

You need to register a new application on both Facebook and Twitter to get your tokens by which users can grant access to your application, and login using their social accounts.

Registering the app on Facebook
  1. Go to Facebook Developers
  2. Add new app, and fill the required information.
  3. Get your App ID, App Secret.
  4. Go to Add Product -> Facebook Login -> Valid OAuth redirect URIs
  5. Add Valid Callback URIs
  6. Go to App Review -> Make your application public.

Now, you can assign the App ID to facebookClientID, and App Secret to facebookClientSecret.

Registering the app on Twitter
  1. Go to Twitter Apps
  2. Create new app, and fill the required information.
  3. Add Website & Callback URL
  4. Get your Consumer Key, Consumer Secret.

Now, you can assign the Consumer Key to twitterConsumerKey, and Consumer Secret to twitterConsumerSecret.

The Callback URL

Session

The session needs a random string to make sure the session id in the browser is random. That random string is used to encrypt the session id in the browser, Why? To prevent session id guessing.

Database

Mongoose is used to interact with a MongoDB that's hosted by MongoLab.

Schemas

There are two schemas; users and rooms.

Each user has a username, passowrd, social Id, and picture. If the user is logged via username and password, then social Id has to be null, and the if logged in via a social account, then the password will be null.

Each room has a title, and array of connections. Each item in the connections array represents a user connected through a unique socket; object composed of {userId + socketId}. Both of them together are unique.

Models

Each model wraps Mongoose Model object, overrides and provides some methods. There are two models; User and Room.

Session

Session in Express applications are best managed using express-session package. Session data are stored locally on your computer, while it's stored in the database on the production environment. Session data will be deleted upon logging out.

User Authentication

User can login using either a username and password, or login via a social account. User authentication is done using Passport. Passport has extensive, and step-by-step documentation on how to implement each way of authentication.

Sockets

Having an active connection opened between the client and the server so client can send and receive data. This allows real-time communication using TCP sockets. This is made possible by Socket.io.

The client starts by connecting to the server through a socket(maybe also assigned to a specific namespace). Once connections is successful, client and server can emit and listen to events.

There are two namespaces used; /rooms and /chatroom.

Logger

And It doesn't go without saying, you need to monitor your application. Winston can log and catch Uncaught Exceptions. All logs are displayed in the console, and saved in debug.log file.

On Heroku, you can monitor the logs by clicking on More -> View Logs on the top left of your application dashboard.

Support

I've written this script in my free time during my studies. If you find it useful, please support the project by spreading the word.

Contribute

Contribute by creating new issues, sending pull requests on Github or you can send an email at: [email protected]

License

Built under MIT license.

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].