meesahil7 / innobyte

Repository from Github https://github.commeesahil7/innobyteRepository from Github https://github.commeesahil7/innobyte

Full Stack Application

This is a full stack application built with a React frontend and a Node.js/Express backend. The application includes user authentication features such as signup, login, and OTP verification for secure actions.

Table of Contents

Getting Started

Prerequisites

Make sure you have the following software installed on your machine:

  • Node.js (version >= 14.x)
  • Yarn (version >= 1.x)

Installation

  1. Clone the repository:

    git clone https://github.com/meesahil7/innobyte.git

  2. Install dependencies for both the frontend and backend.

Running the Application

Frontend

To run the frontend:

  1. Navigate to the ./client directory: cd client

  2. Set the baseUrl in ./src/config/baseURL.js directory: change the value of baseUrl variable to api base url of backend

  3. Install the dependencies: yarn

  4. Start the development server: yarn dev

Backend

To run the backend

  1. Navigate to ./server directory: cd ./server

  2. Install the dependencies: yarn

  3. Start the development server: yarn dev

Environment Variables

Set up the following environment variables in your backend. Create a .env file in the ./server directory with the following content:

  • PORT=your_port_number
  • MONGO_URI=your_mongodb_connection_string
  • JWT_SECRET=your_jwt_secret_key
  • USER=your_email_service_user
  • PASSWORD=your_email_service_password

** This password in env file can be generated by visiting manage your google account settings and searching for "app password". In other SMTP servers this will be different.

Backend API Routes

The backend authentication routes are:

  • POST baseUrl/auth/signup - Route to sign up a new user.
  • POST baseUrl/auth/verifyEmail - Route to verify a user's email with OTP.
  • POST baseUrl/auth/login - Route to log in a user.
  • POST baseUrl/auth/verifyLogin - Route to verify a user's action with OTP after login.
  • POST baseUrl/auth/resendOtp/:id - Route to resend OTP.
  • POST baseUrl/auth/logout - Route to log out a user.

Features

  • Signup: Users can sign up and will be asked to verify their email with an OTP.
  • Login: Users can log in and will be asked to verify their actions with an OTP.
  • Email Verification: After signing up, users must verify their email address using an OTP sent to their email.
  • Edge Case Handling: Various edge cases are covered to ensure robust authentication flows.

About


Languages

Language:JavaScript 92.1%Language:CSS 6.9%Language:HTML 1.0%