Skip to content

Cryzek/Natter

Repository files navigation

Natter

Natter is an IRC like chat application. Natter is built using MEAN software stack. In it's current implementation, the app works in the following manner :-

  • Instead of a registration route/view, new users are registered when they login with a unique username and a password(of their choice). Thereafter, the user has to login with the same username-password combination.
  • A user can view all users registered to Natter DB.
  • Upon clicking on a user, one can start chatting with him/her.

On the client side :

The different states(ui-router states) are :-

  1. userauth - Presents the authorization view.
  2. home - The home view.
  3. home.listusers - Lists all the users on the Natter app.
  4. home.listgroups - Lists the groups. This feature is yet to be built.
  5. home.natter - Presents the conversation view that allows chatting with another user.

On the server side :

Although, listed in the package.json file, different modules used in the app are -

  1. express - Well, it wouldn't be a MEAN app without express, would it?
  2. socketio - Create and handle sockets for bi-directional communication.
  3. mongoose - Mongoose provides a very easy api to work with mongodb via its schemas and models.
  4. express-session - Managing user sessions. Sessions are persisted in the database rather than saving them in cookies.
  5. connect-mongo - Used for storing sessions in DB.
  6. dotenv - exposes environment variables from the .env file.
  7. body-parser - Used to access form/json data sent by the client.
  8. crypto - Lastly, I have used the crypto module for password authentication.

Different techniques that I learnt and implemented in Natter :

  • Using socketio - My first hands on with sockets in javascript. Much easier than sockets in c. Socketio provides a great API to exchange data to-and-forth between the client and server.
  • Salt and hashing - For a new user, the passwords are mixed with salt(random bytes) and hashed. Finally the password hash and the salt are stored in the database. On login , the passsword is again salt-and-hashed(salt used from the database). The password hash generated is matched against the one stored in the database to authenticate the user.
  • Using the ui-router and ng-animate.

JS.Happy coding.|-_-|

Releases

No releases published

Packages

No packages published