Social Media Posts Application

Venkata Naveen Varma V
2 min readDec 27, 2022

--

The App is a simple social media application that allows users to post interesting events that happened in their lives. We make use of MongoDb, Express, Reacts, Nodejs (MERN)

A Full CRUD application, we perform on posts of users. This medium post is mainly focused on the server side of the application.

Checkout the application at → Social posts app

Index

  1. npm modules used
  2. Database
  3. Features/operations
  4. Run the server (nodejs) locally
  5. Run the frontend (reactjs) locally
  6. End application
  7. Platforms used to host the Server and frontend
  8. Usefull Links

1. npm Module

  • body-parser : Enables us to send post requests
  • cors : Enables cross origin requests
  • express : Framework for routing of our application
  • mongoose : To create models

2. Database

We use MongoDB (Cloud Atlas), which is free to host database.

3. Features/operations in the application

Users must be able to,

  • Share post details with an image
  • Like the posts
  • delete posts
  • update posts

4. Running the Application Server locally

  1. Download the Code from Github
  2. Add a ‘.env’ file with the required environment variables, they are
    - DB_CONNECTION_URL ( your unique URL from MongoDB website)
  3. Run the command, in the terminal
    >> npm install
    (This installs all the dependencies based on package.json file)
  4. Then run the command
    >> npm start or node index.js
    (This starts the server on port 3000, by default)

Now, the server is ready to receive the requests.

5. Running the Application React Front-end locally

For the front-end of the application we use reactjs

  1. Download the code from social posts app-Github
  2. Run the command
    >> npx i
    (This installs all the required dependencies)
  3. Run the command
    >> npm start
    (This starts the reatjs app)

Use can now use the application locally from your system.

→ Make sure to run your server first, because frontend does not do much without the server :)

6. End Application

  • Enter the post details and you can see that the data is being stored in MongoDb and displayed on the page instantly.
  • You can give likes to posts and delete a post as well.
  • To update the post, click on the three dots on the post and you can edit the post

Checkout the application at → Social posts app

Social posts application

7. Platforms used to host the website (Obviously free sites ☺️)

8. Links

Checkout the live application at → Social posts app

- Frontend (reactjs) Code in Github Repo → social posts app frontend code
- Server (nodejs) Code in Github Repo → social posts app server code
- Hosted Server Link : https://social-posts-application.onrender.com/

Any doubts/questions feel free to ask in comments.

Check my other projects in “Github” and “Medium”.

--

--