Skip to content

armaansharma-dev/Coursis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ Coursis - Course Selling Platform

License: MIT Node.js React MongoDB Express TypeScript Vite Tailwind CSS

A modern, full-stack course selling platform enabling educators to create and sell courses while students discover, purchase, and learn from expert-led content. Built with professional architecture, responsive UI, and multi-role authentication.


🎯 What is Coursis?

Coursis is a complete learning platform where:

  • Teachers create courses, set prices, and manage enrollments
  • Students browse, enroll, and track their learning
  • Admins oversee platform operations and users

Course data includes title, description, pricing, instructor info, and timestampsβ€”everything needed to run a professional course marketplace.


πŸš€ Tech Stack

Layer Technology Version
Frontend React, TypeScript, Tailwind CSS, Vite 19.2, 5.9, 4.2, 8.0
Backend Node.js, Express.js 18+, 5.2
Database MongoDB, Mongoose 9.1
Auth JWT (jsonwebtoken) 9.0
Security bcrypt 6.0
Validation Zod 4.3
UI Library React Router, React Icons 7.13, 5.6

πŸ— Project Structure

Coursis/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app.js                 # Express app configuration
β”‚   β”‚   β”œβ”€β”€ server.js              # Server entry point
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”‚   └── db.js              # MongoDB connection
β”‚   β”‚   β”œβ”€β”€ controllers/           # Business logic
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.controller.js
β”‚   β”‚   β”‚   β”œβ”€β”€ user.controller.js
β”‚   β”‚   β”‚   β”œβ”€β”€ course.controller.js
β”‚   β”‚   β”‚   β”œβ”€β”€ enrollment.controller.js
β”‚   β”‚   β”‚   β”œβ”€β”€ teacher.controller.js
β”‚   β”‚   β”‚   └── admin.controller.js
β”‚   β”‚   β”œβ”€β”€ models/                # MongoDB schemas
β”‚   β”‚   β”‚   β”œβ”€β”€ User.js
β”‚   β”‚   β”‚   β”œβ”€β”€ Course.js
β”‚   β”‚   β”‚   └── Enrollment.js
β”‚   β”‚   β”œβ”€β”€ routes/                # API endpoints
β”‚   β”‚   β”œβ”€β”€ middlewares/           # Custom middlewares
β”‚   β”‚   β”œβ”€β”€ validators/            # Zod schemas
β”‚   β”‚   └── utils/                 # Helpers & utilities
β”‚   β”œβ”€β”€ package.json
β”‚   └── tsconfig.json
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main.tsx               # React entry point
β”‚   β”‚   β”œβ”€β”€ App.tsx                # Main component
β”‚   β”‚   β”œβ”€β”€ pages/                 # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ HomePage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ExplorePage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ CourseDetails.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MyCourses.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ TeacherDashboard.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminDashboard.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Signup.tsx
β”‚   β”‚   β”‚   └── EditProfile.tsx
β”‚   β”‚   β”œβ”€β”€ components/            # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ Header.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Footer.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ CourseCard.tsx
β”‚   β”‚   β”‚   └── layout/
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”‚   └── api.ts             # API client
β”‚   β”‚   β”œβ”€β”€ index.css              # Global styles
β”‚   β”‚   └── App.css
β”‚   β”œβ”€β”€ vite.config.ts             # Vite config
β”‚   β”œβ”€β”€ tsconfig.json
β”‚   └── package.json
β”‚
└── README.md

✨ Core Features

πŸŽ“ For Students

  • Browse & discover courses by category
  • Enroll and access course materials
  • Track enrolled courses
  • View instructor profiles

πŸ‘¨β€πŸ« For Teachers

  • Create and publish courses
  • Set course price and details
  • View student enrollments
  • Manage course lifecycle

πŸ›‘οΈ For Admins

  • Monitor all users and courses
  • System-wide statistics
  • User and course management

πŸ” Authentication

  • JWT-based secure login
  • Role-based access (Student, Teacher, Admin)
  • Password hashing with bcrypt

πŸ” Authentication & Authorization

Uses JWT tokens for secure authentication. Different roles have different access:

  • Student: Browse courses, enroll, view profile
  • Teacher: Create/edit own courses, view enrollments
  • Admin: Full platform access

All sensitive endpoints require a valid JWT token in the request header.


βš™οΈ Backend Architecture

Each request goes through:

  1. Logger - Track request info
  2. Validator - Check input data (Zod)
  3. Auth Middleware - Verify JWT token
  4. Role Check - Ensure user has permission
  5. Controller - Handle business logic
  6. Error Handler - Catch & format errors

This keeps code clean and secure.


🎯 Main API Endpoints

POST   /auth/register           - Sign up
POST   /auth/login              - Log in (returns JWT)

GET    /courses                 - Browse all courses
GET    /courses/:id             - Get course details

GET    /users/me                - Get your profile
PATCH  /users/me                - Update profile

POST   /teacher/courses         - Create a course
PATCH  /teacher/courses/:id     - Edit your course

POST   /enrollments             - Enroll in a course
GET    /enrollments             - View your enrollments

GET    /admin/dashboard         - Admin overview

❌ Error Handling & πŸ”’ Security

Consistent Error Responses:

  • 400 Bad Request - Invalid input
  • 401 Unauthorized - Missing/invalid token
  • 403 Forbidden - No permission
  • 404 Not Found - Resource doesn't exist
  • 500 Server Error - Something went wrong

Security Features:

  • βœ… Passwords hashed with bcrypt
  • βœ… JWT tokens for authentication
  • βœ… Role-based access control
  • βœ… Input validation (Zod)
  • βœ… Ownership verification

βœ… Project Status

Complete & Production Ready:

  • βœ… Full-stack course marketplace
  • βœ… User authentication (JWT)
  • βœ… Role-based system (Student, Teacher, Admin)
  • βœ… Course CRUD operations
  • βœ… Enrollment system
  • βœ… Professional UI (React + Tailwind)
  • βœ… Error handling & validation

πŸš€ Future Improvements

  • Payment gateway (Stripe/PayPal)
  • Video streaming for courses
  • Course ratings & reviews
  • Email notifications
  • Search & filtering
  • Student certificates
  • Live sessions

⚑ Quick Start

Prerequisites

  • Node.js v18+
  • MongoDB (local or cloud)
  • npm or yarn

Installation

1. Clone the repository

git clone https://github.com/armaansharma-dev/Coursis.git
cd Coursis

2. Setup Backend

cd backend
npm install
cp .env.example .env
# Edit .env with your MongoDB URI and JWT secret
npm run dev

3. Setup Frontend (new terminal)

cd frontend
npm install
npm run dev

The app will be available at:

  • Frontend: http://localhost:5173
  • Backend: http://localhost:5400

πŸ”§ Environment Variables

Backend (.env)

PORT=5400
MONGO_URL=mongodb+srv://user:password@cluster.mongodb.net/coursis
JWT_SECRET=your_super_secret_jwt_key_here
NODE_ENV=development
CORS_ORIGIN=http://localhost:5173

Frontend (.env.local)

VITE_API_URL=http://localhost:5400/api/v1
VITE_ENV=development

See .env.example files in backend/ and frontend/ for complete templates.


πŸ‘¨β€πŸ’» What I Learned

  • Full-stack development (React + Node.js)
  • JWT authentication & role-based access
  • Express.js middleware patterns
  • MongoDB schema design
  • RESTful API design
  • Error handling & validation
  • TypeScript for type safety

πŸ“„ License

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


Built with ❀️ by Armaan Sharma

About

πŸ“š Coursis is a full-stack course marketplace with authentication, course management, teacher/admin dashboards, and an enrollment system, built using React, Express, MongoDB, and TypeScript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors