A comprehensive mentorship platform connecting mentors and mentees through scheduled meetings, integrated payments, and real-time communication. Built as a full-stack monorepo application with modern technologies.
- ๐ Authentication & Authorization - JWT-based auth with Google OAuth integration
- ๐ฅ User Roles - Distinct interfaces for mentees, mentors, and administrators
- ๐ Meeting Scheduling - Calendar-based booking system with timezone support
- ๐ณ Payment Integration - Stripe checkout and subscription management
- ๐ฌ Real-time Communication - Socket.io for live notifications and updates
- ๐ผ๏ธ Media Management - Cloudinary integration for profile images and assets
- ๐ง Email Notifications - Automated email system with Mailtrap
- ๐ Advanced Search - Filter mentors by language, expertise, and availability
- ๐ Admin Dashboard - Comprehensive management tools for platform oversight
- ๐ณ Docker Support - Containerized deployment with Docker Compose
- ๐ API Documentation - OpenAPI/Swagger specification
- Framework: React 19 + TypeScript
- Build Tool: Vite
- Routing: React Router v7
- State Management: Zustand
- Styling: Tailwind CSS 4
- HTTP Client: Axios
- UI Components: Lucide Icons, Framer Motion
- Form Validation: Zod
- Runtime: Node.js 24.11.1
- Framework: Express.js + TypeScript
- Database: Microsoft SQL Server 2022
- ORM: Native MSSQL driver
- Authentication: JWT + Passport.js
- Payment: Stripe
- Email: Nodemailer + Mailtrap
- File Storage: Cloudinary
- Real-time: Socket.io
- API Docs: Swagger/OpenAPI
- Package Manager: pnpm 10.26.2
- Monorepo: Turbo
- Containerization: Docker + Docker Compose
- Database UI: Adminer
- Linting: ESLint 9
- Formatting: Prettier
- Git Hooks: Husky + lint-staged
- Commit Convention: Commitlint
- Mentoria
- โจ Features
- ๐ Tech Stack
- ๐ Table of Contents
- ๐ System Requirements
- ๐ Project Installation
- โ๏ธ Environment Variables
- ๐ฆ Managing Packages
- ๐โโ๏ธ Running the Project
- ๐ Docker Deployment
- ๐ Database Management with Adminer
- ๐ API Documentation
- ๐ฎ Testing with Postman
- ๐ง Testing Stripe Webhooks on Localhost
- ๐ Git Workflow
- ๐ Available Scripts
- Node.js >= 24.11.1
- pnpm >= 10.26.2
- Git
If you don't have pnpm installed, you can install it using one of the following methods:
Using npm:
npm install -g pnpmFor more installation options, visit pnpm installation guide.
git clone <repository-url>
cd mentoriaThe project uses pnpm workspaces. Simply run from the root directory:
pnpm installThis will install all dependencies for root, client, and server automatically.
The project requires environment configuration for both client and server. Copy the example files and configure them:
cd server
cp .env.example .envConfiguration:
# Environment
NODE_ENV=development
PORT=3000
# Database
DB_USER=sa
DB_PASS=YourStrong@Password
DB_SERVER=localhost
DB_NAME=mentoria
DB_INIT=true # Set to true on first run to initialize database
# JWT
JWT_SECRET=your_super_secret_jwt_key_here_min_32_chars
# Email
MAIL_USER=your_email@gmail.com
MAIL_PASS=your_app_password
MAIL_SEND=true # Set false to disable email verification during development
# URLs
CLIENT_URL=http://localhost:5173
# Google OAuth (Get from Google Cloud Console)
GOOGLE_CLIENT_ID=your_google_client_id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your_google_client_secret
# Cloudinary (Get from Cloudinary Dashboard)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Stripe (Get from Stripe Dashboard)
STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLIC_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_... # Get from Stripe CLI or Dashboardcd client
cp .env.example .envConfiguration:
VITE_API_ENDPOINT=http://localhost:3000Create a .env file in the root directory for Docker Compose:
# Docker Hub (optional - for pushing images)
DOCKERHUB_USERNAME=your_dockerhub_username
# Database credentials (must match server .env)
DB_USER=sa
DB_PASS=YourStrong@Password
DB_NAME=mentoriaGoogle OAuth Setup
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google+ API
- Go to Credentials โ Create Credentials โ OAuth 2.0 Client ID
- Set authorized redirect URIs:
http://localhost:3000/api/auth/google/callback(development)https://your-domain.com/api/auth/google/callback(production)
- Copy Client ID and Client Secret to your
.env
Cloudinary Setup
- Sign up at Cloudinary
- Go to Dashboard
- Copy Cloud Name, API Key, and API Secret to your
.env
Stripe Setup
- Sign up at Stripe
- Go to Developers โ API Keys
- Copy Publishable Key (starts with
pk_) and Secret Key (starts withsk_) - For webhooks, see Testing Stripe Webhooks
Email Setup (Gmail)
- Enable 2-Factor Authentication on your Gmail account
- Go to Google Account โ Security โ App Passwords
- Generate a new app password for "Mail"
- Use your Gmail address and the generated password in
.env
Install package for all workspaces (root):
pnpm add <package-name> -wInstall package for specific workspace:
# For client
pnpm add <package-name> --filter client
# For server
pnpm add <package-name> --filter serverInstall dev dependencies:
# For client
pnpm add -D <package-name> --filter client
# For server
pnpm add -D <package-name> --filter server
# For root
pnpm add -D <package-name> -wExamples:
# Install axios for client
pnpm add axios --filter client
# Install express types for server
pnpm add -D @types/express --filter server
# Install husky for root workspace
pnpm add -D husky -w# Remove from client
pnpm remove <package-name> --filter client
# Remove from server
pnpm remove <package-name> --filter server
# Remove from root
pnpm remove <package-name> -w# Update specific package
pnpm update <package-name>
# Update all packages
pnpm update
# Update packages for specific workspace
pnpm update --filter clientThe project uses Turbo for monorepo management. Run both client and server simultaneously:
# From root directory - runs both client and server in parallel
pnpm devOr run them separately:
# Terminal 1 - Run server only
cd server
pnpm dev
# Terminal 2 - Run client only
cd client
pnpm devServer will run on http://localhost:3000
Client will run on http://localhost:5173
On your first run, the database will be automatically initialized if DB_INIT=true is set in your server .env file. This will:
- Create all necessary tables
- Set up relationships and constraints
- Seed initial data (optional)
# Build all packages from root
pnpm build
# Or build individually
cd client
pnpm build
pnpm start # Preview production build
cd server
pnpm build
pnpm start # Start production serverThe project includes full Docker support with Docker Compose for easy deployment.
The docker-compose.yml defines the following services:
- db - Microsoft SQL Server 2022
- server - Node.js Express API (port 4002)
- client - React frontend with Nginx (port 4003)
- adminer - Database management UI (port 8083)
- nginx-exporter - Prometheus metrics for monitoring (port 9114)
-
Set up environment variables
Create a
.envfile in the root directory:DOCKERHUB_USERNAME=your_username DB_USER=sa DB_PASS=YourStrong@Password123 DB_NAME=mentoria
Also ensure
server/.envandclient/.envare configured. -
Build and start all services
docker-compose up --build
Or run in detached mode:
docker-compose up -d --build
-
Access the application
- Frontend:
http://localhost:4003 - API:
http://localhost:4002 - Adminer:
http://localhost:8083 - Nginx Metrics:
http://localhost:9114
- Frontend:
# Start services
docker-compose up -d
# Stop services
docker-compose down
# Stop and remove volumes (โ ๏ธ deletes database data)
docker-compose down -v
# View logs
docker-compose logs -f
# View logs for specific service
docker-compose logs -f server
# Rebuild specific service
docker-compose up -d --build server
# Check service health
docker-compose psBuild and push images to Docker Hub:
# Build images
docker-compose build
# Tag images
docker tag your_username/mentoria-server:latest your_username/mentoria-server:1.0.0
docker tag your_username/mentoria-client:latest your_username/mentoria-client:1.0.0
# Push to Docker Hub
docker push your_username/mentoria-server:latest
docker push your_username/mentoria-client:latestAll services include health checks:
- Database: Queries for
userstable - Server: HTTP check on port 4002
- Client: HTTP check on Nginx
Services will wait for dependencies to be healthy before starting.
The project includes Adminer for easy database management through a web interface.
Access Adminer:
- URL:
http://localhost:8083(local) orhttp://your-vps-ip:8083(production)
Login Credentials:
- System:
MS SQL - Server:
db - Username:
sa(or value ofDB_USER) - Password:
123456(or value ofDB_PASS) - Database:
mentoria(or value ofDB_NAME)
Features:
- Lightweight and fast UI
- Run SQL queries directly
- Browse tables and view data
- Export/import database (SQL, CSV)
- Edit records inline
- View database schema and relationships
You can seed the database with test data using:
cd server
pnpm seed:slot # Seed mentor availability slotsThe server includes comprehensive API documentation using OpenAPI/Swagger.
- Start the server (development or production)
- Open your browser to:
http://localhost:3000/api-docs
The interactive Swagger UI allows you to:
- Browse all available endpoints
- View request/response schemas
- Test API calls directly in the browser
- Download the OpenAPI specification
If you modify API endpoints, update the OpenAPI specification:
cd server
pnpm bundle:swaggerThis bundles all YAML files in src/openapi/ into a single specification.
The project includes a Postman collection with pre-configured requests.
-
Import Collection
- Open Postman
- Click Import
- Select
postman/collections/Mentoria.postman_collection.json
-
Import Environment
- Click Import
- Select
postman/environments/Mentoria.postman_environment.json
-
Configure Environment
- Select "Mentoria" environment in Postman
- Update variables if needed:
host:http://localhost:3000
The collection includes:
- All API endpoints organized by category
- Pre-configured authentication headers
- Example request bodies
- Environment variables for tokens
- Test scripts for automated assertions
To test Stripe webhooks in your local development environment, you need to install the Stripe CLI and forward incoming webhook events to your local API endpoint.
Download and install Stripe CLI from: https://stripe.com/docs/stripe-cli
Run the following command to forward all Stripe webhook events to your local server:
stripe listen --forward-to localhost:3000/api/pay/webhookAfter running this command, Stripe CLI will generate a Webhook Signing Secret, which you must set in your environment variables:
STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxUse the following Stripe test card to simulate a successful payment inside Stripe Checkout:
| Card Number | Expiry | CVC | ZIP |
|---|---|---|---|
| 4242 4242 4242 4242 | Any future date | Any 3 digits | Any |
Example:
Card number: 4242 4242 4242 4242
Expiry: 12/34
CVC: 123
ZIP: 10000The project uses Conventional Commits:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]Types:
feat: New featurefix: Bug fixdocs: Documentation updatestyle: Formatting changes that don't affect code logicrefactor: Code refactoringperf: Performance improvementtest: Adding or fixing testschore: Build tasks, package manager configs, etc.
Examples:
git commit -m "feat(auth): add user login functionality"
git commit -m "fix(api): resolve user data fetching issue"
git commit -m "docs: update installation guide"
git commit -m "style(client): format code with prettier"The project has built-in git hooks to ensure code quality:
- pre-commit: Run lint and format code
- commit-msg: Check commit message format
main: Production branchfeature/feature-name: For new featuresbugfix/bug-description: For bug fixeshotfix/issue-description: For urgent production issues
-
Create a new branch Always branch off from the latest version of
main.git checkout main git pull origin main git checkout -b feature/your-feature-name
-
Work on your feature Make your code changes and commit them using the Conventional Commits format:
git add . git commit -m "feat(auth): add login functionality"
-
Rebase with the latest main branch Before pushing, make sure your branch is up to date with
main:git fetch origin git rebase origin/main
-
Push your branch to remote
git push origin feature/your-feature-name
-
Create a Pull Request (PR) Open a PR to merge your branch into
mainusing the projectโs PR template. Wait for review and approval before merging. -
After Merge โ Sync and Clean Up Once your PR is merged:
git checkout main git pull origin main git branch -d feature/your-feature-name # delete local branch git push origin --delete feature/your-feature-name # delete remote branch
pnpm prepare # Setup husky hooks
pnpm dev # Run both client and server in development mode (parallel)
pnpm build # Build both client and server
pnpm start # Start both client and server (parallel)
pnpm lint # Run linting for all packages
pnpm lint:fix # Fix linting errors for all packages
pnpm format # Check code formatting for all packages
pnpm format:fix # Auto-format code for all packages
pnpm clean # Clean build artifacts for all packagespnpm dev # Start development server
pnpm build # Build for production
pnpm start # Preview production build
pnpm lint # Check for linting errors
pnpm lint:fix # Fix auto-fixable linting errors
pnpm format # Check code formatting
pnpm format:fix # Auto-format code
pnpm clean # Clean build artifactspnpm dev # Start development server with nodemon
pnpm build # Build TypeScript to JavaScript
pnpm start # Start production server
pnpm debug # Start server in debug mode
pnpm seed # Seed database with mock data
pnpm lint # Check for linting errors
pnpm lint:fix # Fix auto-fixable linting errors
pnpm format # Check code formatting
pnpm format:fix # Auto-format code
pnpm bundle:swagger # Bundle swagger yaml file
pnpm clean # Clean build artifacts