Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
Dev-sr06Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skillflow — Learning & Mentoring Marketplace

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.

Features implemented

  • 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 the pgvector extension. 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 generateFn to 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.js and matchingService.js.
  • Auth & RBAC: JWT auth (middleware/auth.js), role-based access control for learner / 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. See config/rabbitmq.js and src/workers/*.

Project layout

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

Running locally

  1. Start infra (Postgres with pgvector + RabbitMQ):

    docker compose up -d
  2. 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
  3. Frontend:

    cd frontend
    npm install
    npm run dev                 # http://localhost:5173, proxies /api -> :5000
  4. 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.

Notes on the RAG implementation

  • 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's ivfflat index; 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 any async (prompt) => string (wrapping an Anthropic/OpenAI call) into matchMentorsForRequest(request, generateFn) for LLM-authored fit explanations instead of the built-in template.

Notes on Razorpay escrow

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.

What's stubbed vs. production-ready

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages