https://github.com/puskar-roy/e-learning-platform----backend
E-learning Platform with Typescript, Node Js, Express Js, Prisma, Postgre SQL For Serverless Postgre SQL - Neon DB, For Email Send - Resend, For File Upload - Cloudinary
https://github.com/puskar-roy/e-learning-platform----backend
expressjs nodejs postgresql prisma-orm typescript
Last synced: 5 months ago
JSON representation
E-learning Platform with Typescript, Node Js, Express Js, Prisma, Postgre SQL For Serverless Postgre SQL - Neon DB, For Email Send - Resend, For File Upload - Cloudinary
- Host: GitHub
- URL: https://github.com/puskar-roy/e-learning-platform----backend
- Owner: Puskar-Roy
- Created: 2024-04-02T07:10:14.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-03-05T18:03:42.000Z (over 1 year ago)
- Last Synced: 2025-04-09T04:11:19.123Z (about 1 year ago)
- Topics: expressjs, nodejs, postgresql, prisma-orm, typescript
- Language: TypeScript
- Homepage: https://elearningplatformm.vercel.app
- Size: 320 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
##### Note: *For production, include your frontend URL in the `whitelist` array within `src/index.ts`. Update the `.env` file by setting `DEV_MODE=PROD` to ensure that CORS is restricted. In `DEV_MODE=DEV`, any URL can send requests to the backend. Set `EMAIL_SERVICE=RESEND` to use the default email service as Resend. Note that in the free tier of Resend, you can only send emails to your own email account. The current setup utilizes the NodeMailer SMTP service. For testing the API, use the admin credentials: email: `admin@admin.com`, password: `admin`*
## API End Points
### 1. Authentication Routes
```bash
/api/v0.1/auth/login POST //for login
/api/v0.1/auth/register POST //for register
/api/v0.1/auth/forgot-password GET //for forgot password
/api/v0.1/auth/reset-password POST //for reset password
```
### 2. Users Routes
```bash
/api/v0.1/users GET //for all users
/api/v0.1/users/:id GET //for a single user
/api/v0.1/users/:id DELETE //for delete a user
/api/v0.1/users/:id PUT //for update a user
/api/v0.1/users/:userId/enrollments GET //for get all enrolled courses of a user
```
### 3. Course Routes
```bash
/api/v0.1/course POST //for create a course admin only
/api/v0.1/course?category=Python&level=Advance GET //for get all courses and you can add queries but its optional
/api/v0.1/course?category=JS&level=Beginner&page=1&pageLimit=3 //pagination with all the queries but its all optional
/api/v0.1/course/:id PUT //for update a course admin only
/api/v0.1/course/:id DELETE //for delete a course admin only
/api/v0.1/course/:id GET //for get a single course
/api/v0.1//course/trending GET //for popular courses based on user enrollment
/api/v0.1/course/:courseId/enroll POST //for enroll in a course
/api/v0.1/course/:courseId/leave DELETE //for leave from a course
/api/v0.1/course/:courseId/reviews GET //for getting all reviews of a course
```
### 4. Review Routes
```bash
/api/v0.1/review POST //for create a review
/api/v0.1/review/:id DELETE //for delete a review
/api/v0.1/review/:id PUT //for update a review
```
### 5. Profile Routes
```bash
/api/v0.1/users/:userId/profile POST //for set profile and profile pic of a user
/api/v0.1/users/:userId/profile PUT //for update profile and profile pic of a user
```
## Getting Started ๐
### Prerequisites
Before you begin contributing to this project, make sure you have the following set up:
- [Node.js](https://nodejs.org/): A JavaScript runtime.
- [npm](https://www.npmjs.com/): The Node.js package manager.
### Run This โจ๏ธ
1. **Clone the Repository:**
```bash
git clone https://github.com/Puskar-Roy/E-learning-Platform----Backend
```
2. **Install Dependencies:**
```bash
npm install
```
3. **Add Environment Variables:**
```bash
touch .env
```
4. **Add the necessary configuration:**
```bash
PORT = 8000
JWT_SECRET="erknevlkenrlkijerjoikmlefnlfrnjfrklsdk;" //jwt secret
JWT_COOKIE_EXPIRES_IN="3d" //in days
RESEND_API=
DATABASE_URL=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
DEV_MODE=DEV // node env = DEV or PROD
BACKENDURL=http://localhost:8000 // your backend URL
EMAIL_SERVICE=RESEND // RESEND or NODEMAILER
EMAIL= // Need If you use Email service as Node Mailer
PASSWORD=xbwcpouxmlzcauxm //This password is not your Gmail password. To obtain it, enable two-step verification for your Gmail account. Then, create an app password in your Gmail settings then you get the password.
```
5. **Run This Project:**
```bash
npm run dev
```
## About The Project
- **Linting & Formatting:**
- โ๏ธ ESLint for code linting
- ๐จ Prettier for code formatting
- **Deployment:**
- ๐ Ready for deployment on Vercel
- ๐ One-click deployment
- **Development Workflow:**
- ๐ง Configured for TypeScript
- ๐ Live reload for efficient development
- ๐ Optimized code for production
- **Security Measures Added:**
- ๐ Helmet for setting up security headers
- ๐ XSS protection with xss-clean middleware
- ๐ง HTTP Parameter Pollution (HPP) protection
- ๐งผ MongoDB data sanitization with express-mongo-sanitize
- ๐ฆ Rate limiting with express-rate-limit for protection against brute-force attacks
- ๐ CORS (Cross-Origin Resource Sharing) configured to allow requests only from a specific origin
### Built With
- **[](https://nodejs.org/):** A JavaScript runtime built on Chrome's V8 JavaScript engine.
- **[](https://expressjs.com/):** Fast, unopinionated, minimalist web framework for Node.js.
- **[](https://www.typescriptlang.org/):** A superset of JavaScript that adds static types.
- **[](https://developer.mozilla.org/en-US/docs/Web/JavaScript):** The programming language of
- **[](https://www.mongodb.com/):** The database for modern applications.
- **[](https://vercel.com/):** Cloud platform for serverless deployment and hosting.
- **[](https://eslint.org/):** Pluggable linting utility for identifying and fixing code issues.
- **[](https://prettier.io/):** Opinionated code formatter to ensure consistent code styling the web.
## Contributing ๐
### Making Contributions
We welcome and appreciate contributions from the community โค๏ธ! Here's how you can contribute:
- **Open Issues:** Check for open issues or create a new one to start discussions.
- **Fork the Repository:** Fork the project to your own GitHub account.
- **Create Pull Request:** Make changes in your fork and submit a pull request.
### Welcome Contributors!
๐ Thank you for considering contributing to this project! Your involvement makes this template even better. Feel free to explore the code, share your ideas, and make improvements โ๏ธ.
๐ Don't hesitate to reach out if you have any questions or need assistance. Together, let's make this project amazing!๐ฉ
### Puskar Roy ๐๏ธ