- Overview
- Features
- Tech Stack
- Installation
- Usage
- Routes
- Middleware
- Database
- Future Enhancements
- Contributing
- License
This project is a Course Selling Application built using the MERN stack (MongoDB, Express, React, Node.js). It provides functionalities for users to sign up, log in, purchase courses, and view their purchased courses. Admins can manage courses, including creating, deleting, and adding content.
- User authentication (login, signup)
- Admin authentication (login, signup)
- Course management (create, delete, view)
- Purchase courses
- View all courses
- View purchased courses
- Middleware for user and admin authentication
- Basic structure for the frontend
- Backend: Node.js, Express
- Database: MongoDB
- ORM: Mongoose
- Authentication: JSON Web Tokens (JWT)
- Environment Variables: dotenv
- Clone the repository:
git clone https://github.com/yourusername/course-selling-app.git
- Navigate to the project directory:
cd course-selling-app
- Install dependencies:
npm install
- Create a
.env
file in the root directory and add your MongoDB connection string:MONGO_URL=your_mongodb_connection_string PORT=your_port_number JWT_SECRET=your_jwt_secret
- Start the server:
node index.js
- The server will run on the specified port (default:
3000
).
- POST
/user/signup
: User registration - POST
/user/login
: User login - POST
/user/purchase
: Purchase a course - GET
/user/courses
: Get all available courses - GET
/user/purchased-courses
: View purchased courses
- POST
/admin/signup
: Admin registration - POST
/admin/login
: Admin login - POST
/admin/create-course
: Create a new course - DELETE
/admin/delete-course/:courseId
: Delete a course - PUT
/admin/add-course-content/:courseId
: Add content to an existing course
- User Auth Middleware: Verifies user tokens for protected routes.
- Admin Auth Middleware: Verifies admin tokens for protected routes.
The application uses MongoDB as the database, and Mongoose for object data modeling (ODM). The database connection is established using the connection string stored in the .env
file.
- Implement cookies for authentication instead of JWT.
- Add rate-limiting middleware to protect against brute force attacks.
- Develop a frontend using EJS (low priority).
- Develop a full-fledged frontend using React.
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or features.
This project is licensed under the MIT License. See the LICENSE file for details.