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.
- Frontend (Vercel): https://mayurdongare-referral-credit.vercel.app
- Backend (Railway): https://mayurdongare-referral-credit-production.up.railway.app
- Database: MongoDB Atlas
- β¨ Features
- π οΈ Tech Stack
- π― How It Works
- π Getting Started
- πΈ Screenshots
- ποΈ Architecture
- π Security
- π Documentation
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
- β‘ 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
Next.js 14 β’ React 19 β’ TypeScript β’ Tailwind CSS
Framer Motion β’ Clerk Auth β’ Axios β’ Zustand
Node.js β’ Express.js β’ TypeScript β’ MongoDB
Mongoose β’ Clerk SDK β’ JWT
Vercel β’ Railway β’ MongoDB Atlas β’ GitHub Actions
Git β’ npm β’ ESLint
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!
| 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.
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
The application uses MongoDB with optimized schemas and indexes for efficient querying. Database models include user profiles, purchases, and referral tracking.
| 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 |
Beautiful hero section with clear value proposition and call-to-action buttons.
Stunning circular progress charts showing referral performance, credits earned, and conversion rates.
Browse 12 courses with visual enrollment badges showing which courses you've already purchased.
Smooth purchase experience with clear credit information and confirmation modals.
Fully responsive design with fixed bottom navigation for easy access on mobile devices.
The UML diagram illustrates the complete system architecture, showing the relationships between users, courses, purchases, and the referral system flow.
- Node.js 18+ and npm
- MongoDB Atlas account
- Clerk account
- Clone the repository
git clone <repository-url>
cd referral-credit-system- Install dependencies
# Install server dependencies
cd server
npm install
# Install client dependencies
cd ../client
npm install- Set up environment variables
Configure environment files in both server and client directories with your own credentials
- Start MongoDB
Ensure your MongoDB Atlas cluster is running and accessible.
- Run the development servers
# Terminal 1 - Start backend server
cd server
npm run dev
# Terminal 2 - Start frontend
cd client
npm run dev- Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:4000
Both server and client directories require environment configuration files.
- MongoDB Atlas account (Database)
- Clerk account (Authentication)
- Server: Create
.envfile in/serverdirectory - Client: Create
.env.localfile in/clientdirectory
Note: Example configuration files (.env.example) are provided in respective directories. Configure them according to your service credentials.
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
- User A signs up and receives referral code
RABC123 - User A shares link:
https://app.com/?r=RABC123 - User B clicks link and signs up (referredBy =
RABC123) - User B makes first purchase:
- User B earns +2 credits
- User A earns +2 credits
- Future purchases by User B do not generate additional credits
- β 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
| 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% |
- 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
- Push code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy
- Create new Web Service
- Connect GitHub repository
- Set build command:
npm run build - Set start command:
npm start - Add environment variables
- Deploy
- Create cluster
- Add database user
- Whitelist IP addresses (0.0.0.0/0 for development)
- Get connection string
- Add to environment variables
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
- 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
- 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)
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
- β 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
- 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
Beautiful circular progress indicators showing referral performance metrics.
Visual badges showing which courses are already enrolled.
Smooth purchase experience with clear credit information.
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
Comprehensive documentation available in the /docs folder:
system-design.md- Complete system architectureAPI.md- API endpoint documentationREFERRAL_SYSTEM_FLOWCHART.md- Visual flow diagramsCIRCULAR_CHART_DESIGN.md- UI design specifications
This is an internship project, but suggestions and feedback are welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2024 Mayur Dongare
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
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
Have questions or feedback? I'd love to hear from you!
- π§ Email: mayurdongare269@gmail.com
- πΌ LinkedIn: Connect with me
- π GitHub: Follow me
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! π
