You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A full-stack FAQ and community Q&A platform with AI-powered duplicate detection, role-based access, and gamification.
Built with React 18, Node.js, Express, MongoDB (Mongoose 9.x), and Groq AI (LLaMA). Features fuzzy search, voice search, JWT auth (httpOnly cookies), dark/light themes, and an admin moderation panel.
Debounced /api/search/suggest with keyboard navigation (Arrow keys, Enter, Escape).
Voice search
Web Speech API (SpeechRecognition) β microphone button shown when supported.
Full-text search
MongoDB $text indexes on FAQ (questions.q, questions.a) and OAQ (question) with regex fallback.
Unified search
/api/search/all β combines FAQ + OAQ results in a single response.
π FAQ Management
Category cards β Grouped by category (About, Selection, NOC, Timing, ...) sorted by priority.
Accordion expand β Single open per category; smooth CSS transition animation.
View tracking β POST /api/faqs/:catId/questions/:qId/view β per-user dedup (viewedBy array, capped at 100). Falls back to anonymous increment for guests. Server response used to update displayed count.
Question sorting β Within each category, sorted by views descending.
π¬ Community Q&A (OAQ)
Submit questions β With AI duplicate detection: up to 120 existing questions checked via Groq LLaMA. If duplicate found, returns 409 with link to existing question.
Voting β Upvote/downvote on both questions and answers. Net β₯10 upvotes triggers auto-promote.
Status workflow β Open β Approved / Rejected (by admin) β Promoted to FAQ.
View tracking β Same pattern as FAQ: POST /api/oaq/:id/view, deduplicated per user.
Answers β Users cannot answer their own question. Accepted answers earn +25 points.
π€ AI Features
Feature
Endpoint / Trigger
Description
Duplicate detection
On OAQ submit
Checks 120 relevant existing questions via Groq. Returns 409 + link if match found.
Importance scoring
On OAQ submit + batch startup
Scores 0β100 based on specificity, effort, usefulness, clarity.
Auto-promote (similar)
On OAQ submit
Finds answered open questions with similar wording; promotes matching Q&A to FAQ.
Auto-promote (vote)
At net β₯10 upvotes
Automatically promotes to FAQ, awards submitter 50 points.
Summarization
POST /api/ai/summarize/:oaqId (admin)
Summarises all answers, picks best fit.
Relevance check
POST /api/ai/check-question/:oaqId (admin)
Checks if question is on-topic. Auto-creates report if flagged.
Related questions
GET /api/ai/related?q=
Real-time keyword-matched FAQ/OAQ as user types.
π Gamification
Action
Points
Ask a question
+5
Answer a question
+10
Receive an upvote
+3
Receive a downvote
β2
Answer accepted
+25
Q&A promoted to FAQ
+50
Leaderboard sorted by total points with pagination (10 per page).
MONGO_URI=mongodb+srv://<user>:<pass>@cluster.mongodb.net/faqJWT_SECRET=your-secret-key-change-in-productionGROQ_API_KEY=gsk_...# Required for AI featuresPORT=5000# Optional, default 5000
Variable
Required
Default
Purpose
MONGO_URI
Yes
β
MongoDB connection string. App exits if missing.
JWT_SECRET
Yes
faq-app-secret-change-in-production
Secret for signing JWT tokens.
GROQ_API_KEY
No*
β
Groq AI API key (duplicate detection, scoring, summarization, relevance checks).
PORT
No
5000
Express server port.
*AI features (duplicate detection, importance scoring, summarization, relevance checking) are disabled when GROQ_API_KEY is not set.
Scripts
Script
Location
Description
npm start
backend/
Start Express server.
npm start
frontend/
Start React dev server (proxied to port 5000).
node scripts/seed.js
backend/
Seed initial FAQ data.
node scripts/finalSeed.js
backend/
Extended FAQ seed with more categories.
node scripts/create-admin.js
backend/
CLI tool to create an admin user.
node scripts/migrate-to-atlas.js
backend/
Migrate local data to MongoDB Atlas.
Deployment Notes
Frontend: Build with npm run build (produces frontend/build/). Serve the static files from the backend or deploy to Vercel/Netlify.
Backend: Deploy to Railway, Render, or any Node.js host. Set all environment variables in the hosting dashboard.
MongoDB: Use MongoDB Atlas (shared cluster is sufficient). Whitelist deployment IP.
CORS: Configured with { origin: true, credentials: true } β update for production domain.
JWT: Change JWT_SECRET to a strong random value in production.
AI: A valid GROQ_API_KEY is needed for all AI features. Without it, duplicate detection, scoring, summarization, and relevance checks are skipped.