Skip to content

SkillXchange is a full-stack, real-time skill-exchange platform built with the MERN (MongoDB, Express.js, React.js, Node.js) stack. It provides a dynamic and interactive environment for users to connect, chat, learn new skills, and collaborate with others in a seamless manner.

Notifications You must be signed in to change notification settings

Jainam2204/SkillXChange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SkillXChange Platform

A modern skill exchange platform that connects users based on complementary skills. Users can list skills they have and skills they want to learn, find matching connections, engage in real-time chat, schedule video meetings, and manage subscriptions.

SkillXChange Node.js React MongoDB

πŸš€ Features

Core Functionality

  • Skill Matching: Intelligent algorithm to match users based on complementary skills
  • Real-time Chat: Instant messaging with Socket.IO for seamless communication
  • Video Meetings: Integrated WebRTC-based video conferencing for skill exchange sessions
  • User Authentication: Secure JWT-based authentication with email verification
  • Connection Management: Send, accept, and manage connection requests
  • Subscription Plans: Multiple subscription tiers with payment integration
  • User Reporting: Reporting system for moderation and safety

Technical Features

  • Real-time Updates: WebSocket-based real-time notifications and messaging
  • File Uploads: Cloudinary integration for media storage and CDN delivery
  • Rate Limiting: Multi-tier rate limiting for API protection
  • Security: Helmet security headers, CORS protection, input validation
  • Logging: Structured logging with Winston
  • Error Handling: Comprehensive error handling and validation

πŸ› οΈ Tech Stack

Frontend

  • React 19 - UI framework
  • Material-UI (MUI) - Component library
  • Axios - HTTP client
  • Socket.IO Client - Real-time communication
  • React Router - Client-side routing
  • Vite - Build tool

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • MongoDB Atlas - Cloud database
  • Mongoose - ODM for MongoDB
  • Socket.IO - Real-time WebSocket server
  • JWT - Authentication
  • Winston - Logging
  • Express-validator - Input validation
  • Helmet - Security headers
  • Express-rate-limit - Rate limiting

External Services

  • Cloudinary - Media storage and CDN
  • Brevo (Sendinblue) - Email service
  • MongoDB Atlas - Database hosting

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v18 or higher)
  • npm (v9 or higher) or yarn
  • MongoDB Atlas account (or local MongoDB instance)
  • Cloudinary account
  • Brevo account (for email service)

πŸ”§ Installation

1. Clone the Repository

git clone <repository-url>
cd IT-643

2. Install Backend Dependencies

cd backend
npm install

3. Install Frontend Dependencies

cd ../frontend
npm install

βš™οΈ Environment Variables

Backend Environment Variables

Create a .env file in the backend directory:

# Server Configuration
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:5173

# Database
MONGODB_URI=your_mongodb_atlas_connection_string

# JWT Authentication
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRES_IN=7d

# Email Service (Brevo)
BREVO_API_KEY=your_brevo_api_key
EMAIL_FROM=[email protected]

# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret

# Razorpay (for payments)
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret

# Logging
LOG_LEVEL=debug

Frontend Environment Variables

Create a .env file in the frontend directory:

VITE_API_URL=http://localhost:5000

πŸš€ Running the Application

Development Mode

Start Backend Server

cd backend
npm run dev

The backend server will start on http://localhost:5000

Start Frontend Development Server

cd frontend
npm run dev

The frontend will start on http://localhost:5173

Production Mode

Build Frontend

cd frontend
npm run build

Start Backend

cd backend
npm start

πŸ“ Project Structure

IT-643/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ config/           # Configuration files
β”‚   β”‚   β”œβ”€β”€ cloudinary.js
β”‚   β”‚   β”œβ”€β”€ cors.js
β”‚   β”‚   β”œβ”€β”€ db.js
β”‚   β”‚   β”œβ”€β”€ emailConfig.js
β”‚   β”‚   β”œβ”€β”€ helmet.js
β”‚   β”‚   └── razorpay.js
β”‚   β”œβ”€β”€ controllers/      # Route controllers
β”‚   β”‚   β”œβ”€β”€ authController.js
β”‚   β”‚   β”œβ”€β”€ chatController.js
β”‚   β”‚   β”œβ”€β”€ connectioncontroller.js
β”‚   β”‚   β”œβ”€β”€ meetingController.js
β”‚   β”‚   β”œβ”€β”€ messageController.js
β”‚   β”‚   β”œβ”€β”€ reportController.js
β”‚   β”‚   β”œβ”€β”€ subscriptioncontroller.js
β”‚   β”‚   └── userController.js
β”‚   β”œβ”€β”€ middleware/       # Custom middleware
β”‚   β”‚   β”œβ”€β”€ authMiddleware.js
β”‚   β”‚   β”œβ”€β”€ checkBanned.js
β”‚   β”‚   β”œβ”€β”€ errorhandler.js
β”‚   β”‚   β”œβ”€β”€ rateLimiter.js
β”‚   β”‚   └── upload.js
β”‚   β”œβ”€β”€ models/           # Mongoose models
β”‚   β”‚   β”œβ”€β”€ ConnectionRequest.js
β”‚   β”‚   β”œβ”€β”€ Meeting.js
β”‚   β”‚   β”œβ”€β”€ Message.js
β”‚   β”‚   β”œβ”€β”€ Report.js
β”‚   β”‚   β”œβ”€β”€ Subscription.js
β”‚   β”‚   └── User.js
β”‚   β”œβ”€β”€ routes/           # API routes
β”‚   β”‚   β”œβ”€β”€ auth.js
β”‚   β”‚   β”œβ”€β”€ chat.js
β”‚   β”‚   β”œβ”€β”€ connect.js
β”‚   β”‚   β”œβ”€β”€ meeting.js
β”‚   β”‚   β”œβ”€β”€ messages.js
β”‚   β”‚   β”œβ”€β”€ report.js
β”‚   β”‚   β”œβ”€β”€ subscription.js
β”‚   β”‚   └── user.js
β”‚   β”œβ”€β”€ services/         # Business logic
β”‚   β”‚   β”œβ”€β”€ authService.js
β”‚   β”‚   β”œβ”€β”€ connection.js
β”‚   β”‚   β”œβ”€β”€ messageService.js
β”‚   β”‚   β”œβ”€β”€ realtime.js
β”‚   β”‚   β”œβ”€β”€ reportService.js
β”‚   β”‚   β”œβ”€β”€ Subscription.js
β”‚   β”‚   └── userService.js
β”‚   β”œβ”€β”€ templates/        # Email templates
β”‚   β”‚   └── emailStrategies.js
β”‚   β”œβ”€β”€ test/             # Test files
β”‚   β”œβ”€β”€ utils/            # Utility functions
β”‚   β”‚   β”œβ”€β”€ logger.js
β”‚   β”‚   β”œβ”€β”€ sendEmail.js
β”‚   β”‚   β”œβ”€β”€ Subscriptioncron.js
β”‚   β”‚   β”œβ”€β”€ validateEnv.js
β”‚   β”‚   └── validators.js
β”‚   β”œβ”€β”€ app.js            # Express app configuration
β”‚   β”œβ”€β”€ server.js         # Server entry point
β”‚   └── socket.js         # Socket.IO configuration
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ public/           # Static assets
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/   # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatArea.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MessageBubble.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ UserList.jsx
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ context/      # React contexts
β”‚   β”‚   β”‚   └── NotificationContext.jsx
β”‚   β”‚   β”œβ”€β”€ hooks/        # Custom hooks
β”‚   β”‚   β”‚   └── useAuth.js
β”‚   β”‚   β”œβ”€β”€ pages/        # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ Chat/
β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard/
β”‚   β”‚   β”‚   β”œβ”€β”€ login/
β”‚   β”‚   β”‚   β”œβ”€β”€ Meet/
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ services/     # API services
β”‚   β”‚   β”‚   └── socket.js
β”‚   β”‚   β”œβ”€β”€ theme/        # MUI theme
β”‚   β”‚   β”‚   └── theme.js
β”‚   β”‚   β”œβ”€β”€ utils/        # Utility functions
β”‚   β”‚   β”‚   └── api.js
β”‚   β”‚   β”œβ”€β”€ App.jsx       # Main app component
β”‚   β”‚   └── main.jsx      # Entry point
β”‚   β”œβ”€β”€ index.html
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ docs/                 # Documentation
β”‚   β”œβ”€β”€ skillxchange_class_diagram.pdf
β”‚   └── Updated_design_document.pdf
β”‚
β”œβ”€β”€ design.md             # Design documentation
└── README.md             # This file

πŸ”Œ API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - User login
  • POST /api/auth/verify - Verify email

User

  • GET /api/user/profile - Get user profile
  • PUT /api/user/profile - Update user profile
  • GET /api/user/:id - Get user by ID

Connections

  • GET /api/connect/suggestions - Get connection suggestions
  • POST /api/connect/request - Send connection request
  • PUT /api/connect/accept/:id - Accept connection request
  • DELETE /api/connect/reject/:id - Reject connection request

Messages

  • GET /api/messages/:conversationId - Get messages for conversation
  • POST /api/messages - Send message
  • DELETE /api/messages/:id - Delete message

Chat

  • GET /api/chat/connections - Get chat connections
  • GET /api/chat/conversations - Get user conversations

Meetings

  • POST /api/meetings - Create meeting
  • GET /api/meetings/:id - Get meeting details
  • DELETE /api/meetings/:id - Delete meeting

Subscriptions

  • GET /api/subscription/plans - Get subscription plans
  • POST /api/subscription/subscribe - Subscribe to plan
  • GET /api/subscription/status - Get subscription status

Reports

  • POST /api/report - Report user

Health Check

  • GET /api/health - Health check endpoint

πŸ§ͺ Testing

Backend Tests

cd backend
npm test

Running Specific Tests

npm test -- auth.integration.test.js

πŸ”’ Security Features

  • Rate Limiting: Multi-tier rate limiting (API, Auth, Upload)
  • Security Headers: Helmet middleware for security headers
  • CORS Protection: Environment-specific CORS configuration
  • Input Validation: Express-validator with custom strategies
  • JWT Authentication: Secure token-based authentication
  • Password Hashing: bcrypt for password hashing
  • HTTP-only Cookies: Secure cookie storage for tokens

πŸ“ Logging

The application uses Winston for structured logging:

  • Development: Console logging with colors
  • Production: JSON format for log aggregation
  • Log Files: Stored in backend/logs/
    • combined.log - All logs
    • error.log - Error logs only

πŸ› Troubleshooting

Common Issues

Backend won't start

  • Check if MongoDB connection string is correct
  • Verify all environment variables are set
  • Check if port 5000 is available

Frontend can't connect to backend

  • Verify VITE_API_URL in frontend .env matches backend URL
  • Check CORS configuration in backend
  • Ensure backend server is running

Socket.IO connection fails

  • Check if Socket.IO server is initialized
  • Verify JWT token is valid
  • Check browser console for connection errors

Email not sending

  • Verify Brevo API key is correct
  • Check if sender email is verified in Brevo
  • Review email service logs

πŸ“š Documentation

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the ISC License.

πŸ‘₯ Authors

  • SkillXChange Development Team

πŸ™ Acknowledgments

  • Material-UI for the component library
  • Socket.IO for real-time communication
  • MongoDB Atlas for database hosting
  • Cloudinary for media storage
  • Brevo for email services

πŸ“ž Support

For support, email [email protected] or open an issue in the repository.


Made with ❀️ by the SkillXChange Team

About

SkillXchange is a full-stack, real-time skill-exchange platform built with the MERN (MongoDB, Express.js, React.js, Node.js) stack. It provides a dynamic and interactive environment for users to connect, chat, learn new skills, and collaborate with others in a seamless manner.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages