- Description!
- Technologies!
- Features!
- Prerequisites!
- Installation!
- API Documentation!
- Deployment!
- Contribute!
- Author!
- Licence!
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.
- Node.js
- Express
- Express-favicon
- Nodemon
- Node Schedule
- joi
- bcrypt.js
- jwt
- Nano ID
- Nodemailer
- otp-generator
- multer
- mongoose
- moment
- dotenv
- qrcode
- cors
- cloudinary
- axios
- ua-parser-js
- Handeling Register , Login , Logout
- Confirmation email via Gmail
- Forget & Reset Password
- 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
- Users List / online
- Block / un Block users
- Crud Comments (soft delete applied)
- Crud Reply (soft delete applied)
Before you begin, make sure that you have the following tools and technologies installed on your machine:
- Node.js
- MongoDB
- Git
- A code editor such as Visual Studio Code, Atom, or Sublime Text
- Postman for API Documentation
To install and run your social media backend API, follow these steps:
git clone https://github.com/Develekko/Social-Backend-Api.git
cd Social-Backend-Api
npm install
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
- Replace
ABSTRACT_API_KEY
with your own api key through URL
nodemon [your node app] or nodemon
or
npm run dev
The API documentation is provided through Postman JSON File
- Click Download raw file
- open Postman Desktop or through Postman Browser
- Go to File -> import or press CTRL+O
- You will find six main folders (
Auth
,User
,Admin
,post
,Comment
,Reply
) , each folder contains an API requests.
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.
- Create a run script in the
package.json
file Here
"scripts": {
"start": "node index.js"
},
- 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
- 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": "/"
}
]
}
- 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.
- Finally, you need to do the last important thing: add environment variables to your project through these steps .
1- go to you project settings
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.
Leave a β If you think this project is cool.
Housam Ramadan
This project is licensed under the MIT License. See the LICENSE file for more information.