Skip to content

Latest commit

Β 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ EduShare - Referral-Based Learning Platform

A modern full-stack learning platform where users earn credits by sharing knowledge. Built with passion for the FileSure Internship Project.

Transform learning into a rewarding experience - Purchase courses, share with friends, and earn credits together. EduShare combines education with a smart referral system that benefits everyone.

This project is developed as part of the FileSure Full Stack Developer Internship Assessment 2025.

πŸ”— Live Links


πŸ“‹ What's Inside

✨ Features

🎯 Core Features

For Learners:

  • πŸ“š Browse 12+ expert-led courses across 6 categories
  • πŸŽ“ Enroll in courses with one click
  • πŸ“Š Track your learning journey on a beautiful dashboard
  • πŸ’° Earn credits on your first purchase
  • πŸ”— Get your unique referral link instantly

For Referrers:

  • 🎁 Earn 2 credits when friends make their first purchase
  • πŸ“ˆ Track referral performance with visual analytics
  • πŸ”„ Unlimited referrals - share as much as you want
  • πŸ’― 100% transparent credit system

User Experience:

  • πŸ” Secure authentication with Clerk
  • πŸ“± Fully responsive - works on all devices
  • ⚑ Lightning-fast performance
  • 🎨 Beautiful circular progress charts
  • πŸŒ™ Clean, modern interface
  • πŸ“ Mobile bottom navigation for easy access

πŸ› οΈ Technical Highlights

  • ⚑ Server-side rendering with Next.js 14
  • 🎨 Smooth animations with Framer Motion
  • πŸ›‘οΈ Type-safe with TypeScript throughout
  • πŸ”’ JWT authentication on all protected routes
  • πŸ’Ύ MongoDB with atomic transactions
  • πŸ“ˆ Optimized database queries with indexes
  • πŸš€ CI/CD pipeline with GitHub Actions
  • ☁️ Production-ready deployment

πŸ› οΈ Tech Stack

Frontend

Next.js 14  β€’  React 19  β€’  TypeScript  β€’  Tailwind CSS
Framer Motion  β€’  Clerk Auth  β€’  Axios  β€’  Zustand

Backend

Node.js  β€’  Express.js  β€’  TypeScript  β€’  MongoDB
Mongoose  β€’  Clerk SDK  β€’  JWT

DevOps & Tools

Vercel  β€’  Railway  β€’  MongoDB Atlas  β€’  GitHub Actions
Git  β€’  npm  β€’  ESLint

🎯 How It Works

The Referral Journey

1️⃣ Sign Up β†’ Get your unique referral code
2️⃣ Share Link β†’ Send to friends via social media, email, etc.
3️⃣ Friend Signs Up β†’ Using your referral link
4️⃣ Friend Purchases β†’ Makes their first course purchase
5️⃣ Both Earn Credits β†’ You get 2, they get 4 credits!

Credit System

Action User Credits Referrer Credits
Direct signup + first purchase +2 -
Referred signup + first purchase +4 +2
Subsequent purchases 0 0

Simple Rule: Credits are awarded only on the first purchase to keep things fair and transparent.

πŸ—οΈ System Architecture

Data Flow

User Signs Up β†’ Clerk Auth β†’ Create Profile β†’ Generate Referral Code
                                                      ↓
User A Shares Link β†’ User B Signs Up (with ?r=CODE) β†’ Store referredBy
                                                      ↓
User B Makes Purchase β†’ Award 2 Credits to User B
                     β†’ Award 2 Credits to User A
                     β†’ Update Dashboard Stats

Database

The application uses MongoDB with optimized schemas and indexes for efficient querying. Database models include user profiles, purchases, and referral tracking.

API Endpoints

Method Endpoint Auth Required Purpose
POST /api/profile No User management
POST /api/purchase Yes Purchase processing
GET /api/dashboard Yes Analytics data
GET /api/purchases Yes Purchase history

πŸ“Έ Screenshots

🏠 Landing Page

Beautiful hero section with clear value proposition and call-to-action buttons.

πŸ“Š Dashboard

Stunning circular progress charts showing referral performance, credits earned, and conversion rates.

πŸ“š Courses Page

Browse 12 courses with visual enrollment badges showing which courses you've already purchased.

🎯 Purchase Flow

Smooth purchase experience with clear credit information and confirmation modals.

πŸ“± Mobile Experience

Fully responsive design with fixed bottom navigation for easy access on mobile devices.

🧩 UML Diagram

UML Diagram

The UML diagram illustrates the complete system architecture, showing the relationships between users, courses, purchases, and the referral system flow.

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ and npm
  • MongoDB Atlas account
  • Clerk account

Installation

  1. Clone the repository
git clone <repository-url>
cd referral-credit-system
  1. Install dependencies
# Install server dependencies
cd server
npm install

# Install client dependencies
cd ../client
npm install
  1. Set up environment variables

Configure environment files in both server and client directories with your own credentials

  1. Start MongoDB

Ensure your MongoDB Atlas cluster is running and accessible.

  1. Run the development servers
# Terminal 1 - Start backend server
cd server
npm run dev

# Terminal 2 - Start frontend
cd client
npm run dev
  1. Access the application

πŸ” Environment Variables

Both server and client directories require environment configuration files.

Required Services

  • MongoDB Atlas account (Database)
  • Clerk account (Authentication)

Configuration Files

  • Server: Create .env file in /server directory
  • Client: Create .env.local file in /client directory

Note: Example configuration files (.env.example) are provided in respective directories. Configure them according to your service credentials.

πŸ“š API Documentation

The platform includes a RESTful API with the following endpoints:

  • POST /api/profile - User profile management
  • POST /api/purchase - Course purchase processing
  • GET /api/dashboard - User statistics and analytics
  • GET /api/purchases - Purchase history

For detailed API documentation, see /docs/API.md

πŸ’Ό Business Logic

Referral Flow

  1. User A signs up and receives referral code RABC123
  2. User A shares link: https://app.com/?r=RABC123
  3. User B clicks link and signs up (referredBy = RABC123)
  4. User B makes first purchase:
    • User B earns +2 credits
    • User A earns +2 credits
  5. Future purchases by User B do not generate additional credits

Credit Rules

  • βœ… First purchase only earns credits
  • βœ… Both referrer and referred user earn 2 credits each
  • βœ… Invalid referral codes are ignored (no error)
  • βœ… Self-referrals are prevented (different clerkUserId)
  • βœ… Atomic transactions prevent double-crediting
  • βœ… Concurrent purchases are handled safely

Dashboard Metrics

Metric Description
Total Credits Sum of all credits earned
Referred Users Count of users who signed up with your code
Converted Users Count of referred users who made a purchase
Conversion Rate (Converted / Referred) Γ— 100%

🎨 UI/UX Features

  • Modern Design: Gradient backgrounds, rounded corners, smooth shadows
  • Animations: Framer Motion for smooth transitions and hover effects
  • Responsive: Mobile-first design, works on all screen sizes
  • Accessibility: Semantic HTML, proper ARIA labels
  • Loading States: Skeleton screens and spinners
  • Error Handling: User-friendly error messages
  • Copy to Clipboard: One-click referral link copying
  • Share API: Native sharing on mobile devices

πŸš€ Deployment

Frontend (Vercel)

  1. Push code to GitHub
  2. Import project in Vercel
  3. Add environment variables
  4. Deploy

Backend (Render/Railway)

  1. Create new Web Service
  2. Connect GitHub repository
  3. Set build command: npm run build
  4. Set start command: npm start
  5. Add environment variables
  6. Deploy

Database (MongoDB Atlas)

  1. Create cluster
  2. Add database user
  3. Whitelist IP addresses (0.0.0.0/0 for development)
  4. Get connection string
  5. Add to environment variables

πŸ“Š Project Structure

edushare/
β”œβ”€β”€ client/                 # Next.js frontend application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/           # Next.js app router pages
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable React components
β”‚   β”‚   └── store/         # State management
β”‚   └── package.json
β”‚
β”œβ”€β”€ server/                # Express backend API
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ models/       # Database models
β”‚   β”‚   β”œβ”€β”€ controllers/  # Business logic
β”‚   β”‚   β”œβ”€β”€ routes/       # API routes
β”‚   β”‚   └── middlewares/  # Custom middlewares
β”‚   └── package.json
β”‚
β”œβ”€β”€ docs/                 # Project documentation
β”‚
└── README.md

πŸ§ͺ Testing

Manual Testing Checklist

  • User can sign up with Clerk
  • User receives unique referral code
  • Referral link can be copied
  • New user can sign up with referral link
  • First purchase awards 2 credits to buyer
  • First purchase awards 2 credits to referrer
  • Second purchase does not award credits
  • Dashboard shows correct statistics
  • All pages are responsive
  • Error handling works correctly

πŸ”’ Security Features

  • JWT token verification on protected routes
  • Environment variables for sensitive data
  • Input validation on all endpoints
  • MongoDB injection prevention with Mongoose
  • CORS configuration
  • Atomic transactions for data integrity
  • Password hashing (handled by Clerk)

πŸ› Troubleshooting

Common Issues

Issue: MongoDB connection fails

  • Solution: Check MONGODB_URI, whitelist IP, verify credentials

Issue: Clerk authentication not working

  • Solution: Verify API keys, check Clerk dashboard settings

Issue: Credits not awarded

  • Solution: Check server logs, verify transaction completion

Issue: Frontend can't connect to backend

  • Solution: Verify NEXT_PUBLIC_API_URL, check CORS settings

🎯 Project Highlights

Key Achievements

  • βœ… Complete Referral System - Fully functional referral tracking with credit rewards
  • βœ… Beautiful UI - Modern design with circular progress charts and smooth animations
  • βœ… Multiple Purchases - Users can purchase multiple courses with proper tracking
  • βœ… Real-time Analytics - Dashboard with visual performance metrics
  • βœ… Secure & Scalable - JWT authentication, atomic transactions, database indexes
  • βœ… Well Documented - Comprehensive documentation and system design

Technical Highlights

  • Atomic MongoDB transactions for data integrity
  • Circular progress charts with SVG and Framer Motion
  • Responsive design (mobile, tablet, desktop)
  • Type-safe with TypeScript throughout
  • RESTful API with proper error handling
  • Efficient database queries with compound indexes

πŸ“Έ Screenshots

Dashboard with Circular Charts

Beautiful circular progress indicators showing referral performance metrics.

Courses Page with Enrollment Status

Visual badges showing which courses are already enrolled.

Purchase Flow

Smooth purchase experience with clear credit information.

πŸŽ“ Learning Outcomes

This project demonstrates proficiency in:

  • Full-stack web development
  • Modern React patterns (hooks, context, state management)
  • RESTful API design
  • Database design and optimization
  • Authentication and authorization
  • UI/UX design principles
  • Animation and micro-interactions
  • Documentation and system design

πŸ“š Documentation

Comprehensive documentation available in the /docs folder:

  • system-design.md - Complete system architecture
  • API.md - API endpoint documentation
  • REFERRAL_SYSTEM_FLOWCHART.md - Visual flow diagrams
  • CIRCULAR_CHART_DESIGN.md - UI design specifications

🀝 Contributing

This is an internship project, but suggestions and feedback are welcome!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright (c) 2024 Mayur Dongare

πŸ‘¨β€πŸ’» Developed By

Mayur Dongare
B.Tech CSE, KIT's College of Engineering
πŸ“§ Email: mayurdongare269@gmail.com
πŸ”— GitHub: @mayurdongare269
πŸ’Ό LinkedIn: Mayur Dongare

Developed as part of the FileSure Full Stack Developer Internship Assessment - 2025


πŸ™ Acknowledgments

Special thanks to:

  • FileSure for the internship assessment opportunity
  • Clerk for seamless authentication
  • MongoDB Atlas for reliable database hosting
  • Vercel & Railway for smooth deployment
  • The open-source community for amazing tools

πŸ“ž Get in Touch

Have questions or feedback? I'd love to hear from you!


⭐ Show Your Support

If you found this project interesting or helpful, please consider:

  • ⭐ Starring this repository
  • πŸ”„ Sharing it with others
  • πŸ’¬ Providing feedback

Thank you for checking out EduShare! Happy Learning! πŸš€

About

Full-stack referral-based learning platform with credit rewards, analytics dashboard, and scalable architecture (Next.js + Node.js + MongoDB)

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages