Giter VIP home page Giter VIP logo

chitchat's Introduction

Welcome to ChitChat

it is a realtime chat application where users can chat with each other. It is created using Node.js, Express, MongoDB, Socket.io, Bcrypt, Jsonwebtoken, and Cookie-parser.

Packages installed

  1. express: To initialize express server
  2. socket.io: To create real time chat application
  3. nodemon: To restart server automatically
  4. dotenv: To use environment variables
  5. bcrypt: To hash password
  6. jsonwebtoken: To create token for authentication
  7. mongoose: To connect to MongoDB
  8. cookie-parser: To parse cookies passsed to req.body
  9. jwt are used to create token for authentication
  10. To generate a secure random number as your jwt secret key, use your bash and type: openssl rand -base64 32'

Backend

Backend is created using Node.js and Express. MongoDB is used as database. Socket.io is used to create real time chat application. Bcrypt is used to hash password. Jsonwebtoken is used to create token for authentication. Cookie-parser is used to parse cookies.

We used postman api to test our backend routes.

Backend files and folders:

  1. routes folder: contains auth.routes.js where we define our authentication routes(signup, login and logout) to be used in server.js
    messages.routes.js where we define our message routes (api/messages/send/id)to be used in server.js
    user.routes.js where we define our user routes to be used in server.js


  2. controllers folder: contains auth.controller.js where we define our authentication controller function(login, signup and logout) to be used in auth.routes.js
    messages.controller.js where we define our {sendMessage and getMessage} functions to be used in messages.routes.js
    user.controller.js where we define our {getUserForSidebar} functions to be used in user.routes.js


  3. db folder: contains connectToMongoDB.js where we connect to MongoDB database


  4. server.js: contains all the backend routes


  5. models folder: contains user.model.js where we define our user schema
    message model.js where we define our message schema
    conversation.model.js where we define our conversation schema


  6. middleware folder: contains protectRoute.js, this file protects the routes from unauthorized access


  7. utils folder: contains generateToken.js where the token used for authentication and security is generated

chitchat's People

Contributors

sumshi avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.