A robust backend system for managing online courses, built with NestJS and Prisma ORM. This project provides secure user authentication, course progress tracking, payment processing, and file uploads, ensuring a seamless learning experience.
- User Authentication: Secure JWT-based authentication with support for Facebook and Google OAuth.
- OTP Verification: Email-based OTP handling for account verification.
- Payment Integration: Seamless payment processing with Paymob API.
- Course Management: Track user progress, completed tasks, and levels.
- File Uploads: Secure file uploads to AWS S3 with pre-signed URLs.
- Admin Controls: Role-based access for managing users and content.
- Scalable Architecture: Modular design for easy scalability and maintainability.
- Framework: NestJS
- Database: PostgreSQL with Prisma ORM
- Authentication: Passport.js with JWT, Facebook, and Google strategies
- File Storage: AWS S3
- Payment Gateway: Paymob
- Testing: Jest
- Deployment: Vercel
- Node.js >= 20.0.0
- npm >= 10.0.0
- PostgreSQL instance
- AWS S3 bucket
- Paymob account
Create a .env file in the root directory with the following variables:
PORT=5000
JWT_SECRET=your_jwt_secret
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_REGION=your_aws_region
AWS_S3_BUCKET=your_s3_bucket_name
PAYMOB_SECRET_KEY=your_paymob_secret_key
PAYMOB_PUBLIC_KEY=your_paymob_public_key
PAYMOB_INTEGRATION_ID=your_paymob_integration_id- Clone the repository:
git clone https://github.com/itzSerag/Online_Courses_Backend.git
cd Online_Courses_Backend- Install dependencies:
npm install- Run database migrations:
npx prisma migrate dev- Start the development server:
npm run start:devThe server will start on http://localhost:5000/api.
POST /api/auth/signup: Register a new userPOST /api/auth/login: Login userPOST /api/auth/reset-password: Reset user passwordPOST /api/auth/verify-otp: Verify OTP for account activationPOST /api/auth/logout: Logout user
GET /api/users/me: Get current user detailsGET /api/users/all: Get all users (Admin only)POST /api/users/complete-day: Mark a day as completedPOST /api/users/complete-task: Mark a task as completed
POST /api/payment/process-payment: Process a paymentPOST /api/payment/refund: Refund a paymentPOST /api/payment/callback: Handle payment callback
POST /api/files: Upload course contentGET /api/files: Retrieve course contentDELETE /api/files: Delete course content
connection: Client connects to WebSocket serverdisconnect: Client disconnects from WebSocket server
- Frontend Repository: Online Courses Frontend
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
- Fork the repository
- Create your 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