SkillTrade is a comprehensive microservices-based platform that enables users to exchange skills and knowledge through structured learning sessions. The platform facilitates peer-to-peer learning where users can both teach their expertise and learn new skills from others in the community.
- Project Architecture
- Core Features
- Technology Stack
- Service Communication
- Data Models
- Getting Started
- Testing
- Security Features
- Scalability Considerations
SkillTrade follows a microservices architecture with 5 core services communicating through event-driven patterns:
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β skilltrade- β β skilltrade- β β skilltrade- β
β client β β auth β β community β
β (Next.js) β β (Node.js/TS) β β (Node.js/TS) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
β
βββββββββββββββββββ
β NATS Event β
β Streaming β
βββββββββββββββββββ
β
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
β β β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β skilltrade- β β skilltrade- β β shared β
β connection β β payments β β library β
β (Node.js/TS) β β (Node.js/TS) β β (TypeScript) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Container Orchestration: Kubernetes with Skaffold for local development
- Ingress Controller: NGINX for routing requests to appropriate services
- Message Streaming: NATS Streaming Server for event-driven communication
- Database: MongoDB (individual instances per service)
- Development Workflow: Skaffold with hot-reload capabilities
- User Registration/Login: Secure authentication with JWT tokens
- Profile Management: Comprehensive user profiles with:
- Personal information (name, email, profile picture)
- Professional details (occupation: professional/student/freelancer/entrepreneur)
- Availability schedule (days of the week)
- Skills to teach and learn
- Session statistics and premium status
- Skill Exchange Posts: Users create posts advertising:
- Skills they want to teach
- Skills they want to learn
- Availability windows
- Personal introduction and background
- Social Interactions:
- Like posts from other users
- Send connection requests
- Browse and search community posts
- Filter by skills, availability, and premium status
- Connection Workflow:
- Send connection requests through posts
- Accept/reject incoming requests
- Automatic session creation upon acceptance
- Session Features:
- Bidirectional teaching (both users teach and learn)
- Session scheduling and management
- Session completion tracking
- Mutual review system
- Video Conferencing: Real-time video calls using Agora SDK
- Interactive Whiteboard: Collaborative whiteboard for visual learning
- Real-time Chat: HTTP-based chat system during sessions
- Stripe Integration: Secure payment processing for premium features
- Premium Subscriptions: Enhanced features for paying users
- Payment Event Handling: Automatic premium status updates
- Mutual Reviews: Both participants can review each other
- Rating Analytics: Visual charts showing user performance
- Teaching Statistics: Track sessions taught and overall ratings
- Framework: Next.js 15.3.3 with React 19
- Styling: Tailwind CSS with custom animations
- UI Components:
- Radix UI primitives for accessibility
- Custom component library with shadcn/ui
- Lucide React icons
- Forms: React Hook Form with Zod validation
- Charts: Recharts for analytics visualization
- Video/Audio: Agora RTC SDK for real-time communication
- Whiteboard: @netless/fastboard for collaborative drawing
- Payments: Stripe SDK for payment processing
- Runtime: Node.js with TypeScript
- Framework: Express.js for REST APIs
- Database: MongoDB with Mongoose ODM
- Authentication: JWT tokens with cookie sessions
- Validation: Express-validator for request validation
- Testing: Jest with MongoDB Memory Server
- Development: ts-node-dev for hot reloading
- Common Types: TypeScript interfaces and types
- Event Definitions: NATS event schemas and handlers
- Middleware: Authentication, validation, and error handling
- Error Classes: Standardized error responses
- Containerization: Docker for all services
- Orchestration: Kubernetes with custom manifests
- Development: Skaffold for local development workflow
- Message Broker: NATS Streaming Server
- Ingress: NGINX Ingress Controller
- Domain: skilltrade.dev (local development)
Services communicate asynchronously through NATS Streaming with these key events:
-
Payment Events:
PaymentCreated β Updates user premium status across services
-
Connection Events:
ConnectionRequested β Notifies connection service ConnectionAccepted β Creates session and updates user stats ConnectionRejected β Cleans up connection requests ConnectionCancelled β Handles cancellation logic
-
Review Events:
ReviewCreated β Updates user ratings and session completion
-
Post Events:
PostDeleted β Cleanup across dependent services
NGINX Ingress routes requests based on path patterns:
/api/users/*β Authentication Service (Port 3000)/api/community/*β Community Service (Port 3000)/api/payment/*β Payments Service (Port 3000)/api/connections/*β Connection Service (Port 3000)/*β Client Application (Port 3000)
interface User {
email: string
password: string (hashed)
profilePicture: string
fullName: string
description: string
occupation: "professional" | "student" | "freelancer" | "entrepreneur" | "other"
availability: Array<DayOfWeek>
gender: "male" | "female" | "other"
sessionsTaught: number
isPremium: boolean
}interface Post {
authorId: string
authorName: string
authorProfilePicture: string
isPremium: boolean
title: string
content: string
availability: Array<DayOfWeek>
likes: string[]
connections: string[]
connectionAccepted: string[]
toTeach: string[]
toLearn: string[]
}interface Session {
sessionTakerOneId: string
sessionTakerTwoId: string
sessionTakerOneName: string
sessionTakerTwoName: string
sessionTakerOneProfilePicture: string
sessionTakerTwoProfilePicture: string
isEnded: boolean
isReviewedByTakerOne: boolean
isReviewedByTakerTwo: boolean
toTeach: string[]
toLearn: string[]
sessionTakerOneTeaching: number
sessionTakerTwoTeaching: number
nextSessionBeginsAt: Date
}interface Payment {
userId: string
stripeId: string
// Additional payment-related fields
}Before running SkillTrade locally, ensure you have the following installed:
-
Docker Desktop:Windows & MacOS (with Kubernetes enabled) OR
-
Docker:Linux (with minikube installed).
-
kubectl - Kubernetes command-line tool
-
Skaffold - For development workflow automation
-
Node.js (v16 or higher)
-
npm or yarn
git clone https://github.com/Rezaul-2020331029/SkillTrade.git
cd SkillTrade- Open Docker Desktop
- Go to Settings β Kubernetes
- Check "Enable Kubernetes"
- Click "Apply & Restart"
# For macOS
brew install skaffold
# For Linux
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
sudo install skaffold /usr/local/bin/
# For Windows
choco install skaffold# For Minikube users
minikube addons enable ingress
# For other users
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/cloud/deploy.yamlAdd the following to your /etc/hosts file (or C:\Windows\System32\drivers\etc\hosts on Windows):
#For Docker Dekstop
127.0.0.1 skilltrade.devFor minikube we first need to find the minikube IP and add it to the config file by:
minikube ipCreate the required Kubernetes secrets:
- Get a test Stripe Key
- If expired contact : ridowan.cse@gmail.com
# JWT Secret
kubectl create secret generic jwt-secret --from-literal=JWT_KEY=your_jwt_secret_key
# Stripe Secret (for payments)
kubectl create secret generic stripe-secret --from-literal=STRIPE_KEY=your_stripe_secret_key# Run all microservices with hot reload
skaffold devThis will:
- Build all Docker images
- Deploy all microservices to Kubernetes
- Set up port forwarding
- Enable hot reload for development
Once everything is running:
- Frontend: https://skilltrade.dev
- API Services: Available through the ingress controller at https://skilltrade.dev/api/*
# Run specific service locally (outside Kubernetes)
cd skilltrade-auth
npm install
npm run dev
# Run tests
npm test
# Build shared library
cd shared
npm run build
npm publish # If you have publish permissions# View all pods
kubectl get pods
# View services
kubectl get services
# View logs for a specific service
kubectl logs -f deployment/skilltrade-auth-depl
# Delete all resources
kubectl delete -f infra/k8s/Each microservice has its own MongoDB instance:
# Port forward to access databases
kubectl port-forward service/skilltrade-auth-mongodb-srv 27017:27017
kubectl port-forward service/skilltrade-community-mongodb-srv 27018:27017
kubectl port-forward service/skilltrade-connection-mongodb-srv 27019:27017
kubectl port-forward service/skilltrade-payments-mongodb-srv 27020:27017- Ingress not working: Ensure NGINX ingress controller is installed and running. Sometimes the NGNIX deployment can take upto 5mins to be ready
- Services not starting: Check if all secrets are created properly
- Database connection issues: Verify MongoDB services are running
- Hot reload not working: Restart skaffold with
skaffold dev --no-prune=false --cache-artifacts=false - Unable to access the site in the browser :The browser may prevent accessing the site as the SSL certificate is a mock. To bypass this click on the browser window and type
thisisunsafe - Unable to deploy the application with skaffold: Make sure minikube is running by
minikube start --driver=dockerif you're using minikube instaed of docker dekstop
# Check ingress
kubectl get ingress
# Describe problematic pods
kubectl describe pod <pod-name>
# Check events
kubectl get events --sort-by=.metadata.creationTimestampEach service includes comprehensive test suites:
# Run all tests across services
npm run test:all
# Run tests for specific service
cd skilltrade-auth
npm test
# Run tests in watch mode
npm test -- --watchTests include:
- Unit tests for business logic
- Integration tests for API endpoints
- MongoDB Memory Server for database testing
- Supertest for HTTP testing
- Authentication: JWT-based stateless authentication
- Authorization: Route-level protection with middleware
- Password Security: bcrypt hashing with salt rounds
- Input Validation: Express-validator for request sanitization
- CORS: Configured for secure cross-origin requests
- Environment Isolation: Containerized services with network policies
- Horizontal Scaling: Each service can be scaled independently
- Database Separation: Each service has its own MongoDB instance
- Event-driven Design: Loose coupling enables independent deployments
- Caching Strategy: Ready for Redis integration for session management
- Load Balancing: NGINX ingress provides load balancing capabilities
If you need help or have questions, please open an issue or contact us at ridowan.cse@gmail.com.