Code Monkey home page Code Monkey logo

accredian's Introduction

Referral System - Learn & Earn

Table of Contents

  1. Introduction
  2. Features
  3. Tech Stack
  4. Getting Started
  5. API Documentation
  6. Environment Variables
  7. Deployed URLs

Introduction

The Referral System - Learn & Earn is a web application that allows users to refer friends to educational programs and earn rewards. This project consists of a React frontend and an Express.js backend, using MySQL as the database.

Features

  • User-friendly landing page with program information
  • Referral form for users to refer friends
  • Email notifications for successful referrals
  • Reward tracking for referrers
  • Responsive design for mobile and desktop
  • Admin dashboard for managing referrals and rewards (future feature)

Tech Stack

Frontend

  • React.js
  • TypeScript
  • Tailwind CSS
  • Axios for API calls
  • React Hook Form for form handling
  • Zod for form validation

Backend

  • Node.js
  • Express.js
  • TypeScript
  • Prisma ORM
  • MySQL database
  • Nodemailer for email notifications
  • Zod for input validation

Development Tools

  • Vite for frontend development
  • ESLint and Prettier for code linting and formatting
  • Jest for testing (future implementation)

Getting Started

Prerequisites

  • Node.js (v14 or later)
  • npm or yarn
  • MySQL database

Backend Setup

  1. Clone the repository:
     git clone https://github.com/shubhsardana29/Accredian.git
     cd Accredian-backend-task
  2. Install dependencies:
     npm install
  3. Set up environment variables:
  • Copy the .env.sample file to .env
  • Update the variables in .env with your configuration
  1. Set up the database:
     npx prisma migrate dev
  2. Start the development server:
     npm run dev

The backend server will start on http://localhost:3000.

Frontend Setup

  1. Navigate to the frontend directory:
     cd ../Accredian-frontend-task
  2. Install dependencies:
     npm install
  3. Start the development server:
     npm run dev

The frontend development server will start on http://localhost:5173.

Database Setup

  1. Create a MySQL database for the project
  2. Update the DATABASE_URL in the backend .env file with your database credentials
  3. Run Prisma migrations:
    cd Accredian-backend-task
    npx prisma migrate dev

API Documentation

Referral Submission

  • Endpoint: POST /api/referrals/submit
  • Description: Submit a new referral
  • Request Body:
    {
      "referrerName": "string",
      "referrerEmail": "string",
      "refereeName": "string",
      "refereeEmail": "string"
    }
    • response:
      • Success (201 Created):
        {
          "id": "number",
          "referrerName": "string",
          "referrerEmail": "string",
          "refereeName": "string",
          "refereeEmail": "string",
          "createdAt": "string (ISO date)"
        }
    • Error (400 Bad Request):
           {
           "errors": [
             {
               "field": "string",
               "message": "string"
             }
           ]
         }

Environment Variables

Backend (.env.sample)

DATABASE_URL="mysql://user:password@localhost:3306/referral_db"
PORT=3000
[email protected]
EMAIL_PASS=your-email-password
CLIENT_ID=your-google-oauth-client-id
CLIENT_SECRET=your-google-oauth-client-secret
REFRESH_TOKEN=your-google-oauth-refresh-token

Deployed URLs

accredian's People

Contributors

shubhsardana29 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.