- Introduction
- Features
- Tech Stack
- Getting Started
- API Documentation
- Environment Variables
- Deployed URLs
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.
- 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)
- React.js
- TypeScript
- Tailwind CSS
- Axios for API calls
- React Hook Form for form handling
- Zod for form validation
- Node.js
- Express.js
- TypeScript
- Prisma ORM
- MySQL database
- Nodemailer for email notifications
- Zod for input validation
- Vite for frontend development
- ESLint and Prettier for code linting and formatting
- Jest for testing (future implementation)
- Node.js (v14 or later)
- npm or yarn
- MySQL database
- Clone the repository:
git clone https://github.com/shubhsardana29/Accredian.git cd Accredian-backend-task
- Install dependencies:
npm install
- Set up environment variables:
- Copy the
.env.sample
file to.env
- Update the variables in
.env
with your configuration
- Set up the database:
npx prisma migrate dev
- Start the development server:
npm run dev
The backend server will start on http://localhost:3000
.
- Navigate to the frontend directory:
cd ../Accredian-frontend-task
- Install dependencies:
npm install
- Start the development server:
npm run dev
The frontend development server will start on http://localhost:5173
.
- Create a MySQL database for the project
- Update the
DATABASE_URL
in the backend.env
file with your database credentials - Run Prisma migrations:
cd Accredian-backend-task npx prisma migrate dev
- 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)" }
- Success (201 Created):
- Error (400 Bad Request):
{ "errors": [ { "field": "string", "message": "string" } ] }
- response:
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
- Backend: https://accredian-nphg.onrender.com
- Frontend: https://accredian.vercel.app