Skip to content

tend2infinity/Instafam-full-stack

Repository files navigation

Instafam-full-stack

A full stack social media web application in which you can actually post pictures, like posts, comment upon it, follow people and maintain a healthy social network!

  • Frontend Repository
    Do check this out!

  • Backend Repository
    Do check this out as well!

🔗 Live Demo

The hosted website can be found here


Tech Stack and Concepts used:

express git heroku mongodb React Material UI CssCloudinary


  • Frontend: Reactjs, Javascript, HTML, CSS, Materialize-Css
  • Backend: Nodejs, Expressjs, Jwt
  • Database: MongoDB, Cloudinary
  • Deployment: Heroku
  • Tools: Git

Database Design

We have used a NoSQL database(MongoDB) in which we are having two schemas Post and User. We have connected these two schemas at the relevant fields using (ObjectID).

APIs

Authentication

The authentication part of our app is done using JSON web tokens(JWT). Bcrypt package is used for hashing passwords. Every time during signup we store the hashed password in our User schema and everytime during login we generate a jwt token and store it in the localStorage. Then for accessing any protected API we send authorization header that includes the jwt token. We have implemented a middleware that checks whether the user is logged in or not by checking the authorization header, while accessing any protected API.

User APIs

These includes APIs ensuring following functionalities:

  • /user/:id To find a user with a particular ID
  • /follow To follow a particular user
  • /unfollow To unfollow a particular user
  • /updateprofilepic To update the profile picture of a user
  • /searchusers To search a user using a unique email

Post APIs

  • /allpost To retrieve all the posts from the Post schema
  • /allfollowpost To retrieve all the posts from those users which are followed by the logged in user.
  • /createpost To create a post with a title, body and a picture
  • /mypost To retrieve all the posts posted by logged in user
  • /like To like a paricular post
  • /dislike To dislike a post
  • /comment To comment upon a post
  • /deletepost/:postId To delete a post posted by logged in user
  • /deletecomment/:postId/:commentId To delete the comments posted by a logged in user

Cloudinary API

Cloudinary is a cloud based media storage and optimisation service. I have used it to store all kind of image media used in my application and this API returns the image url for any image media which I use in the frontend.

Features

SignIn and SignUp pages

There is a basic landing page that is my Login page , you can always navigate to the signup screen from here.

Home page

After logging in you will see a home screen and you can view all the posts there .

Navbar

The navbar at the top contains a home icon and other options like create post , my following posts , my profile , all of these are pretty much self explanatory.

Post

Each Post contains a header which includes name of the person who posted that, caption, text body, picture, like button and the comment section. The posts posted by a logged-in user also includes a delete button to delete that. All the comments posted by a logged in user also possess the delete button. The image URL for the posts are returned from the cloudinary API.

Profile Page

The profile contains information about the user's username, Email, followers, following, update profile picture button and a thumbnail of the posts posted by a user.

Other user's Profile

Contains all the information as on the Profile page and the button to follow or unfollow.

Search Feature

You can search the users using their email IDs.

Create Post

The interface to create a Post!

My following Tab

Shows all the posts posted by those users which are followed by logged in user.


Setting Up the Project 🔧

  • Frontend
  1. Clone the repo

    git clone https://github.com/tend2infinity/Instafam-full-stack
  2. Install NPM packages in server

    npm install
  3. Install NPM packages in client

    cd Client_side
    npm install
  4. Create a .env file using the template .env.template and add values accordingly.

Usage

  1. Switch to the Root directory and run the backend server

    npm start 
  2. Switch to the Frontend folder and run the frontend server

    cd Client_side
    npm start 

    Make sure you start the Backend server before the Frontend server to avoid unnecessary errors.


About

Instafam is a social media web application developed using MERN stack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published