Skip to content

This is the backend API for a social media application that provides a range of powerful features for users. The API is designed to provide a seamless and efficient experience, allowing users to interact with the app in meaningful ways.

Notifications You must be signed in to change notification settings

Develekko/Social-Backend-Api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Social-Backend-Api

image

πŸƒβ€β™‚οΈ Quick Start

πŸ“ Description

This is the backend API for a social media application that provides a range of powerful features to users. API is designed to provide a seamless and efficient experience, allowing users to interact with the app in meaningful ways.

πŸ’» Technologies

πŸŽ‰ Features

1- Authentication and Authorization:

  • Handeling Register , Login , Logout
  • Confirmation email via Gmail
  • Forget & Reset Password

2- User Profile Management:

  • user connections ( Get All List ,Get Mutal, Request , Accept , Remove)
  • user profile & other's profile
  • update user info
  • Delete Account
  • recover Account ( 30 day max ) throuh email sent after deleting

3- Admin Management:

  • Users List / online
  • Block / un Block users

4- Post Management:

  • Crud Posts (soft delete applied)
  • Linkedin reactions simulator image image image image image image

5- Comment Management:

  • Crud Comments (soft delete applied)

6- Reply Management:

  • Crud Reply (soft delete applied)

πŸ“‹ Prerequisites

Before you begin, make sure that you have the following tools and technologies installed on your machine:

βš™οΈ Installation

To install and run your social media backend API, follow these steps:

1. Clone the repository

git clone https://github.com/Develekko/Social-Backend-Api.git
cd Social-Backend-Api

2. Install dependencies

npm install

3. Set up environment variables

Note: environment variables(.env) located into config file

PORT=<Your_PORT_Number>
DB_URL=<mongodb_url>
BARER_KEY=<BEARER>
TOKEN_SIGNATURE=<SIGNATURE>
CONFIRM_EMAIL_SIGNAUTRE=<SIGNATURE>
SALT_ROUNDS=<SALT_ROUNDS>
GMAIL_EMAIL=<GMAIL_EMAIL>
GMAIL_PASSWORD=<GMAIL_APP_PASSWORD>
CLOUDINARY_NAME=<CLOUDINARY_NAME>
CLOUDINARY_KEY=<CLOUDINARY_KEY>
CLOUDINARY_SECRET=<CLOUDINARY_SECRET>
INTERNET_INFO=https://ipgeolocation.abstractapi.com/v1/?api_key=<ABSTRACT_API_KEY>
  • Replace <Your_PORT_Number> with the port number you want your server to listen on , for example (5000)
  • Replace <mongodb_url> with your MongoDB Cloud URL

Note: To get MongoDB the Cloud URL, follow these steps through URL

  • Replace <BEARER> with any secret key for example (bearer_{Token})
  • Replace <SIGNATURE> with any secret key for example (UhzOXjiSgTWDZbXUSRnh)

Note: In JSON Web Tokens (JWT), the signature is a string of characters that is used to verify the authenticity of the token.

  • Replace <SALT_ROUNDS> with number between 1-20

Note: A commonly used hashing algorithm for password storage is bcrypt, and a minimum of 10 salt rounds is generally recommended. However, some security experts recommend using a higher number of salt rounds , such as 12 or 14, to provide additional security against brute-force attacks. Read More...

  • Replace <GMAIL_EMAIL> with your Google Account
  • Replace <GMAIL_APP_PASSWORD> with your Google App password

Note: follow these steps : URL

  • Replace <CLOUDINARY_NAME>, CLOUDINARY_KEY,CLOUDINARY_SECRET with keys in your cloudinary Account . Follow these steps on this URL

image

  • Replace ABSTRACT_API_KEY with your own api key through URL

4. Start the server

nodemon [your node app]  or  nodemon

or

npm run dev

πŸ“– API Documentation

The API documentation is provided through Postman JSON File

Follow These Steps

  1. Click Download raw file

image

  1. open Postman Desktop or through Postman Browser
  • Go to File -> import or press CTRL+O

image image

  1. You will find six main folders (Auth,User,Admin,post,Comment,Reply) , each folder contains an API requests.

image

πŸš€ Deployment

Before you begin, Make sure that you don't have any issues or errors before deploying your project.

You need to remove config or .env file before deployment because of the sensitive data.

What do you need ?

  1. Create a run script in the package.json file Here
"scripts": {
        "start": "node index.js"
    },
  1. Add an "engines" section to your package.json file Here
"engines": {
  "node": "16.14.0"
},

Note : To check the version of Node.js installed on your system, you can use the node -v command.

node -v
  1. Create a vercel.json file and put it in the root of your project folder and then add the code below
{
    "version": 2,
    "builds": [
       { "src": "./index.js", "use": "@vercel/node" }
    ],
    "routes": [
        {
          "src": "/(.*)",
          "dest": "/"
        }
      ]
 }
  1. For our Deployment , we gonna use vercel

Note: Vercel is a cloud platform for building, deploying, and scaling web applications. It provides a seamless deployment experience for front-end frameworks like React, Angular, and Vue.js, as well as serverless functions and full-stack applications.

  • Follow these steps from Ada Cheng article

  • Once you reach here, congratulations! You deployed your project successfully.

image

  • Finally, you need to do the last important thing: add environment variables to your project through these steps .

1- go to you project settings

image

2- You can either add variables one by one,Β  copy and paste the whole file, or import your .env file Read More.

3- After submitting your environment variables, you may need to redeploy your Vercel project.

πŸ‘ Contribute

Leave a ⭐ If you think this project is cool.

πŸ‘¨β€πŸ’» Author

Housam Ramadan

image

πŸ”“ Licence

This project is licensed under the MIT License. See the LICENSE file for more information.

About

This is the backend API for a social media application that provides a range of powerful features for users. The API is designed to provide a seamless and efficient experience, allowing users to interact with the app in meaningful ways.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published