Skip to content

Latest commit

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Stack overflow clone using MERN stack

Table of contents

General info

  • Developed a feature-rich Q&A platform similar to Stack Overflow using the MERN stack (MongoDB, Express.js, React.js, Node.js)
  • Developed a responsive platform accross all devices including mobiles & tablets.
  • Implemented secure user authentication and authorization with sign-up, login, password management, and JWT-based tokens.
  • Enabled extensive user interaction with question asking, editing, deletion, voting, answering, and profile management.
  • Integrated Stripe for secure payment processing for different subscription.
  • Integrated an AI chatbot for interactive learning and engagement, with email verification for secure access.
  • Enhanced user experience with dynamic theme personalization (day/night mode, auto-theme based on time/weather).
  • Leveraged Node.js, Express.js, Bcrypt.js, and other technologies for a robust and scalable backend foundation.
  • Employed Redux Toolkit for efficient state management and data flow.
  • Incorporated Axios for simplified API communication.

Technologies

  • MERN stack
  • React JS
  • Redux Toolkit, React Router,Axios.
  • Node JS., Express JS.
  • Bcrypt js, Json Web Token (JWT).
  • Stripe Payment.
  • Geolocation , weather api , Open AI

Setup

  1. Set up environment variables:
    • Create a .env file in the client directory.

    • Add the following variables to the .env file, replacing the placeholder values with your actual credentials:

      REACT_APP_SHARE_URL="Your Website URL" (optional, default value "http://localhost:3000")
      REACT_APP_URL="your backend URL" (default value "http://localhost:4000")
      REACT_APP_API_KEY="Open weather API key"
      REACT_APP_STRIPE_PUBLISHABLE_KEY="Your stripe publishable key"
      
    • Create a .env file in the server directory.

    • Add the following variables to the .env file, replacing the placeholder values with your actual credentials:

      PORT="port number on which you want to run" (default value "4000")
      MONGODB_URI="your_mongo_uri"
      JWT_SECRET="your_secret_key"
      SMTP_HOST="smtp.gmail.com"
      SMTP_PORT=587
      SMTP_MAIL="your email"
      SMTP_PASSWORD= "your email app key"
      OPEN_AI_KEY= "your open AI key"
      STRIPE_SECRET_KEY="your Stripe secret Key"
      
  2. Install dependencies and run server:

Frontend

 cd ../client
npm install
npm start

Backend

cd ../server
npm install
npm start

API Endpoints

API Endpoints

EndpointDescriptionMethodRequest BodyResponse Format (Example)Authentication
/Welcome messageGETNoneJSON (message: string)None
/user/signupUser signupPOST{ name: string, email: string, password: string }JSON (user details and authentication token)None
/user/loginUser loginPOST{ email: string, password: string }JSON (user details and authentication token)None
/user/getAllUsersGet all usersGETNoneJSON (array of user objects)Required
/user/updateUpdate user profilePATCH{ name?: string, about?: string, tags?: string[], password?: string }JSON (updated user details)Required
/user/deleteDelete user profileDELETENoneJSON (message: string)Required
/questionsGet all questionsGETNoneJSON (array of question objects)None
/questionsPost a questionPOST{ questionTitle: string, questionBody: string, questionTags: string[] }JSON (posted question object)Required
/questions/:idDelete a questionDELETENoneJSON (message: string)Required
/questions/vote/:idVote (upvote/downvote) on a questionPATCH{ value: 'upVote' or 'downVote' }JSON (updated question object)Required
/answers/post/:idPost an answer to a questionPATCH{ answerBody: string, userAnswered: string, userId: string, noOfAnswers: number }JSON (updated question object)Required
/answers/delete/:idDelete an answer to a questionPATCH{ answerId: string, noOfAnswers: number }JSON (message: string)Required
/subscriptionMake payment for subscriptionPOST{ priceId: string, plan: string }JSON (payment session details)Required
/subscription/cancelCancel subscriptionPATCHNoneJSON (updated user details)Required
/subscription/:sessionIdUpdate subscription plan after payment successPATCHNoneJSON (updated user details)None
/chatai/askAsk question to AIPOST{ question: string }JSON (response from AI)Email Verification
/chatai/sendotpSend OTP for email verificationPOST{ email: string }JSON (message: string)None
/chatai/verifyotpVerify OTP for email verificationPOST{ email: string, otp: string }JSON (authentication token)None

Note : For endpoints marked with "Email Verification", the email field is required in the request body.

** For payment you can use this dummy stripe card number:- 4000003560000008

About

stackoverflow clone using MERN Stack

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages