A learner-first marketplace where learners post learning requests and mentors send proposals, matched using a RAG (Retrieval-Augmented Generation) pipeline built on local embeddings + Postgres/pgvector similarity search. Built with React, Express.js, Node.js and PostgreSQL.
- Marketplace core: learners post requests, mentors submit proposals, learners accept/reject.
- RAG-based mentor matching:
- Retrieval — request & mentor-profile text is embedded locally (
@xenova/transformers,all-MiniLM-L6-v2, 384-dim) and stored in Postgres via thepgvectorextension. Top-K mentors are retrieved with a cosine-similarity nearest-neighbour query (embedding <=> query_vector). - Augmentation + Generation — each retrieved mentor is paired with the request and passed
through a pluggable
generateFnto produce a natural-language "why this mentor fits" explanation (grounded in the retrieved profile data). Works with zero external API keys out of the box (falls back to a deterministic template) — plug in an LLM call for richer output. - See
backend/src/services/embeddingService.jsandmatchingService.js.
- Retrieval — request & mentor-profile text is embedded locally (
- Auth & RBAC: JWT auth (
middleware/auth.js), role-based access control forlearner/mentor/admin(middleware/rbac.js). - Razorpay escrow booking flow: order creation → signature-verified payment confirmation →
funds held in escrow (
bookings.escrow_status) → released only after the session is marked complete (controllers/bookingController.js). - Event-driven backend (RabbitMQ): a single topic exchange (
skillflow.events) fans out to independent queues/workers for notifications, matching precomputation, and review-rating aggregation — decoupling those concerns from the request/response cycle. Seeconfig/rabbitmq.jsandsrc/workers/*.
skillflow/
├── backend/ Express API + workers
│ └── src/
│ ├── config/ db, rabbitmq, razorpay clients
│ ├── models/ raw-SQL data access (pg)
│ ├── controllers/ route handlers
│ ├── middleware/ auth (JWT), rbac, error handler
│ ├── routes/ Express routers
│ ├── services/ embeddingService (RAG retrieval), matchingService
│ ├── workers/ notification / matching / review consumers
│ └── db/schema.sql Postgres schema (incl. pgvector tables/index)
├── frontend/ React + Vite SPA
│ └── src/
│ ├── pages/ Login, Register, Dashboard, PostRequest, RequestDetail, Bookings, ...
│ ├── context/ AuthContext (JWT session)
│ └── api/ axios client
└── docker-compose.yml Postgres(pgvector) + RabbitMQ for local dev
-
Start infra (Postgres with pgvector + RabbitMQ):
docker compose up -d
-
Backend:
cd backend cp .env.example .env # fill in RAZORPAY_KEY_ID/SECRET, JWT_SECRET npm install npm run migrate # creates tables + pgvector extension/index npm run dev # API on http://localhost:5000
In separate terminals, start the event consumers:
npm run worker:notifications npm run worker:matching npm run worker:reviews
-
Frontend:
cd frontend npm install npm run dev # http://localhost:5173, proxies /api -> :5000
-
Register a mentor account first (their profile gets embedded on registration), then a learner account, post a request, and click "Find matching mentors" on the request page to see the RAG retrieval + explanation in action.
- Embeddings run locally via
@xenova/transformers— no OpenAI/Anthropic key required for retrieval to work. The first call downloads the small MiniLM model (~90MB) and caches it. - Retrieval quality depends on
pgvector'sivfflatindex; for small datasets exact search (no index) is fine — the index matters once you have thousands of mentors. - The "generation" step (
explainMatches) is intentionally pluggable: pass anyasync (prompt) => string(wrapping an Anthropic/OpenAI call) intomatchMentorsForRequest(request, generateFn)for LLM-authored fit explanations instead of the built-in template.
Razorpay itself doesn't hold funds "in escrow" natively — this app models escrow as an
application-level state machine (pending → held → released/refunded) on top of a standard
Razorpay order/payment, with the mentor payout step left as an integration point for
Razorpay Route/RazorpayX in a production deployment.
This is a complete, runnable reference implementation, not a hardened production deploy. Before
shipping: add input validation (e.g. express-validator on all routes — wired in but not yet
applied everywhere), rate limiting, a dead-letter queue for the RabbitMQ workers, refresh tokens,
and real Razorpay payout automation.