A production-grade, community-driven Q&A and FAQ platform engineered for institutional portals, university hubs, and knowledge-sharing communities. Featuring a moderated answer pipeline, reputation & badge gamification, AI-powered summaries, multi-language translation, voice-enabled search, text-to-speech accessibility, real-time leaderboards, and a cinematic dark/light developer aesthetic.
๐ Getting Started ยท โจ Features ยท ๐ Gamification ยท ๐๏ธ Architecture ยท ๐ License
|
Fine-grained RBAC with three permission tiers:
|
Enterprise-grade content quality assurance:
|
|
Full gamification engine to drive engagement:
|
Hands-free voice input powered by the Web Speech API:
|
|
Built-in accessibility for content consumption:
|
Break language barriers with real-time translation:
|
|
Instant search suggestions as you type:
|
Community-driven content moderation:
|
|
AI-powered question deduplication:
|
Automatic content quality filtering:
|
|
100% free, privacy-first NLP summaries:
|
Never lose sight of your submissions:
|
|
Flexible, secure authentication:
|
Cinematic dual-theme experience:
|
| Action | Points |
|---|---|
| Ask a Question | +5 |
| Post an Answer | +10 |
| Answer Gets Upvoted | +10 |
| Question Gets Upvoted | +5 |
| Accepted Answer | +30 |
| Daily Login | +2 |
| Downvote Received | -2 |
|
Beginner Contributor โ 10 pts |
Knowledge Sharer โ 100 pts |
Expert Contributor โ 500 pts |
| Badge | Criteria |
|---|---|
| ๐ Community Leader | Top reputation holder in the community |
| ๐ฅ Top Contributor of the Month | Most active contributor in the current month |
| ๐ Fast Responder | Consistently answers within minutes |
| ๐ก Innovation Guru | Answers with highest quality ratings |
Visual progress bars show users how close they are to their next badge:
Knowledge Sharer Badge
โโโโโโโโโโ 80/100 Points
Expert Contributor Badge
โโโโโโโโโโ 120/500 Points
Live rankings of top contributors displayed platform-wide:
๐
1. Vishal Soni 1,250 pts ๐๐ฅ๐ฅ
๐
2. Arnav 980 pts ๐ฅ๐ฅ
๐
3. Aryan 870 pts ๐ฅ๐ฅ
๐
4. Priya 650 pts ๐ฅ
๐
5. Rahul 420 pts ๐ฅ
- Question owners can mark one answer as the accepted answer
- โ Green checkmark appears on the accepted answer
- Accepted answer is pinned to the top of the answer list
- The answerer receives +30 reputation points
- Improves content discoverability for future visitors
Every registered user gets a comprehensive profile showcasing:
| Metric | Description |
|---|---|
| ๐ Total Reputation | Cumulative reputation points earned |
| ๐๏ธ Badges Earned | All bronze, silver, gold, and special badges |
| โ Questions Asked | Total questions submitted |
| ๐ฌ Answers Posted | Total answers contributed |
| โ Accepted Answers | Number of answers marked as accepted |
| ๐ Ranking Position | Current leaderboard position |
| ๐ฏ Progress to Next Badge | Visual progress bar |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLIENT (SPA) โ
โ React 19 ยท Vite 8 ยท Tailwind CSS v4 ยท Framer Motion 12 โ
โโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโโโโโค
โ Auth โQuestionโ Answer โ Search โ Voice โTranslationโ
โContext โ Hook โ Hook โ Hook โSTT/TTS โ Engine โ
โโโโโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโโโโโโโค
โ Reputation Engine ยท Badge System ยท Leaderboard โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Supabase JS Client (v2.106+) โ
โ โโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโ โ
โ โ Auth โ Database โ Storage โ โ
โ โ (JWT) โ (REST) โ (S3-API) โ โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SUPABASE BACKEND โ
โ PostgreSQL ยท Row-Level Security ยท Edge Functions ยท Realtime โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 8+ Tables ยท 5+ RPC Functions ยท 16+ RLS Policies ยท 9+ Indexes โ
โ Cascade Deletes ยท Composite Constraints ยท Auto Triggers โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Answerhub/
โโโ public/ # Static assets
โโโ supabase/
โ โโโ schema.sql # Full database schema, triggers, RLS policies
โโโ src/
โ โโโ components/
โ โ โโโ admin/ # Moderation dashboard, flagging review
โ โ โโโ answers/ # Answer cards, forms, accepted answer UI
โ โ โโโ auth/ # ProtectedRoute, GuestRoute guards
โ โ โโโ layout/ # Navbar, Sidebar, Footer, Layout shell
โ โ โโโ notifications/ # Real-time notification bell & dropdown
โ โ โโโ questions/ # QuestionCard, QuestionForm, QuestionFeed
โ โ โโโ search/ # SearchBar with voice input & type-ahead
โ โ โโโ ui/ # Design system: Button, Modal, Toast,
โ โ # Card, Input, Avatar, Badge, Skeleton,
โ โ # Tooltip, ThemeToggle, BackToTop
โ โโโ config/
โ โ โโโ supabase.js # Supabase client initialization
โ โโโ contexts/
โ โ โโโ AuthContext.jsx # Global auth state with session persistence
โ โโโ hooks/
โ โ โโโ useAdmin.js # Admin moderation & flagging operations
โ โ โโโ useAnswers.js # Answer CRUD + verification + accepted answers
โ โ โโโ useAuth.js # Auth context consumer
โ โ โโโ useCategories.js # Category fetching
โ โ โโโ useFileUpload.js # Supabase Storage file uploads
โ โ โโโ useNotifications.js # Notification state management
โ โ โโโ useQuestions.js # Question CRUD + upvoting + deletion
โ โ โโโ useSearch.js # Fuzzy search + type-ahead + analytics
โ โ โโโ useSpeechToText.js # ๐๏ธ Web Speech API (STT) hook
โ โ โโโ useTextToSpeech.js # ๐ SpeechSynthesis (TTS) hook
โ โ โโโ useUpvote.js # Optimistic upvote toggling
โ โโโ lib/ # Utility functions
โ โโโ pages/
โ โ โโโ AdminDashboard.jsx # Metrics, bulk moderation, flag queue
โ โ โโโ AskQuestionPage.jsx # Question form with voice dictation
โ โ โโโ FaqPage.jsx # FAQ browser with STT & TTS
โ โ โโโ ForgotPasswordPage.jsx # Email-based password reset
โ โ โโโ HomePage.jsx # Main feed with category filtering
โ โ โโโ LoginPage.jsx # Email/password login
โ โ โโโ NotFoundPage.jsx # Animated 404 page
โ โ โโโ ProfilePage.jsx # Stats, reputation, badges
โ โ โโโ QuestionDetailPage.jsx # Full question + answers + accepted
โ โ โโโ SearchPage.jsx # Global search results
โ โ โโโ SignupPage.jsx # User registration
โ โโโ App.jsx # Route definitions with AnimatePresence
โ โโโ main.jsx # App entry point
โ โโโ index.css # Global styles & design tokens
โโโ index.html
โโโ vite.config.js
โโโ vercel.json # Vercel SPA routing config
โโโ package.json
| Layer | Technology | Version | Purpose |
|---|---|---|---|
| Frontend Framework | React | 19 | Component architecture with hooks |
| Build Tool | Vite | 8 | Lightning-fast HMR and optimized production builds |
| Styling | Tailwind CSS | v4 | CSS-first utility engine with design tokens |
| Animations | Framer Motion | 12 | Spring-physics transitions & micro-interactions |
| Icons | Lucide React | 1.17 | Consistent, tree-shakeable icon library |
| Forms | React Hook Form | 7 | Performant form state management |
| Routing | React Router | 7 | Client-side navigation with route guards |
| Backend & DB | Supabase | PostgreSQL | Auth, Database, Storage, Realtime |
| Search Engine | Fuse.js | 7 | Client-side fuzzy matching & similarity scoring |
| Voice Input | Web Speech API | Native | Browser speech-to-text recognition |
| Audio Output | SpeechSynthesis API | Native | Browser text-to-speech playback |
| Deployment | Vercel | โ | Edge-optimized SPA hosting |
The PostgreSQL database is organized into 8+ core tables with strict relational constraints, Row-Level Security (RLS) policies, and cascade delete rules:
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ auth.users โโโโโโถโ users โ โ categories โ
โ (Supabase Auth) โ โ id, name, email โ โ id, name, icon โ
โโโโโโโโโโโโโโโโโโโโ โ role, avatar โ โโโโโโโโโโฌโโโโโโโโโโ
โ reputation, rank โ โ
โโโโโโโโโฌโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โโโโโโโผโโโโโโโโโโโโโโผโโโโโโโ
โ questions โ
โ id, title, description โ
โ category, tags, views โ
โ upvotes, attachment_url โ
โ flags โ
โโโโโโโโฌโโโโโโโโโโโโฌโโโโโโโโ
โ โ
โโโโโโโโโโโโโโผโโโ โโโโโโผโโโโโโโโโโโโโโโโ
โ answers โ โ question_upvotes โ
โ id, content โ โ question_id, โ
โ verification โ โ user_id (PK) โ
โ is_accepted โ โโโโโโโโโโโโโโโโโโโโโโ
โ admin_note โ
โโโโโโโโฌโโโโโโโโโโ
โ
โโโโโโโโผโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ answer_upvotes โ โ notifications โ
โ answer_id, โ โ id, user_id, โ
โ user_id (PK) โ โ message, is_read โ
โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ search_analytics โ
โ id, search_term, โ
โ user_id, created_at โ
โโโโโโโโโโโโโโโโโโโโโโโโ
| Feature | Implementation |
|---|---|
| Auto User Profiles | Database trigger on auth.users INSERT automatically creates a public.users row |
| Cascade Deletes | Deleting a question removes all associated answers, upvotes, and notifications |
| Duplicate Vote Prevention | Composite primary keys on upvote tables enforce one-vote-per-user |
| Trending Analytics | RPC function get_trending_searches() returns top 10 search terms from the past 7 days |
| Toggle Upvotes | RPC functions atomically insert/delete upvote records and update counters |
| 16+ RLS Policies | Fine-grained row-level security ensuring users only access authorized data |
| Reputation Tracking | Points calculated from user actions and stored for leaderboard rankings |
The useSpeechToText hook wraps the native Web Speech Recognition API to provide hands-free voice input across the platform:
| Feature | Details |
|---|---|
| Continuous Recognition | Keeps listening until manually stopped |
| Interim Results | Shows real-time transcription as you speak |
| Multi-Language | Defaults to en-US, configurable via lang parameter |
| Error Recovery | Graceful handling of microphone permission errors |
| Used In | Search bar, Ask Question (title + description), FAQ search |
The useTextToSpeech hook uses the native SpeechSynthesis API for audio content playback:
| Feature | Details |
|---|---|
| One-Tap Playback | Single button to play/stop on any content |
| Unique Tracking | Each content item has a unique speech ID to track active playback |
| Auto Cleanup | Speech synthesis is cancelled on component unmount |
| Used In | Question cards, FAQ answer panels |
| Requirement | Minimum Version |
|---|---|
| Node.js | v18+ |
| npm | v9+ |
| Supabase Account | Free Tier |
1. Clone & Install
git clone https://github.com/sonivishal66666/Answerhub.git
cd Answerhub
npm install2. Database Setup
- Create a new project on the Supabase Dashboard
- Navigate to SQL Editor โ New Query โ Blank Query
- Copy the entire contents of
supabase/schema.sqland paste into the editor - Click Run โ this creates all tables, triggers, RLS policies, indexes, and seed data
3. Storage Configuration
- In the Supabase Dashboard, go to Storage
- Click New Bucket โ name it
attachments - Toggle Public Bucket to ON โ Click Create
4. Environment Configuration
cp .env.example .envUpdate .env with your Supabase project credentials:
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key-here5. Launch Development Server
npm run devOpen http://localhost:5173 in your browser.
6. Production Build
npm run build
npm run preview # Preview the production build locallyTo activate the admin moderation dashboard:
- Create an account on the running application via Sign Up
- Open the Supabase Dashboard โ Table Editor โ
userstable - Locate your user row and change the
rolecolumn fromusertoadmin - Refresh your browser โ the Admin link will appear in the navigation bar
| Capability | Description |
|---|---|
| ๐ Platform Metrics | Total questions, answers, pending reviews, user counts, and reputation stats |
| โ Bulk Moderation | Approve, reject, or flag multiple answers at once |
| ๐๏ธ Question Deletion | Delete any question with premium animated confirmation dialogs |
| ๐ฉ Flag Review Queue | Review and resolve community-flagged content |
| ๐ Admin Notes | Attach feedback notes to reviewed answers |
| ๐ Auto-Notifications | Authors are notified of verification decisions in real-time |
| ๐ Reputation Management | View and manage user reputation and badge assignments |
- Push your repository to GitHub
- Import the project on Vercel
- Add environment variables:
VITE_SUPABASE_URLVITE_SUPABASE_ANON_KEY
- Deploy โ the included
vercel.jsonhandles SPA routing automatically
npm run build # Outputs to ./dist
npx serve dist # Serve locally for testing| # | Feature | Description |
|---|---|---|
| 1 | ๐ Role-Based Access Control | Guest, User, and Admin permission tiers |
| 2 | ๐ก๏ธ Moderated Answer Pipeline | Admin-verified answers with 4-state workflow |
| 3 | ๐ Reputation System | Points for actions (ask, answer, upvote, accepted) |
| 4 | ๐๏ธ Badge System | Bronze, Silver, Gold, and Special achievement badges |
| 5 | ๐ฅ Leaderboard | Live rankings of top contributors |
| 6 | โ Accepted Answers | Question owners mark the best answer (+30 pts) |
| 7 | ๐ Progress Tracker | Visual progress bars toward next badge |
| 8 | ๐๏ธ Voice Search (Voice Chat) | Hands-free voice input across the platform |
| 9 | ๐ Text-to-Speech | Listen to questions and FAQ answers |
| 10 | ๐ Translation | Multi-language translation for questions & answers |
| 11 | ๐ Type-Ahead | Autocomplete search suggestions as you type |
| 12 | ๐ฉ Content Flagging | Flag inappropriate questions or answers |
| 13 | ๐ Track Your Questions | Real-time status tracking for submissions |
| 14 | ๐ Forgot Password | Email-based password reset flow |
| 15 | ๐ง Duplicate Detection | Fuse.js fuzzy matching with similarity scores |
| 16 | ๐ซ Spam Detector | Heuristic auto-flagging of spam content |
| 17 | ๐ฎ AI Summarizer | Client-side NLP extractive summaries |
| 18 | ๐ File Attachments | Upload images and documents to questions/answers |
| 19 | ๐ Real-Time Notifications | In-app notification bell with live updates |
| 20 | ๐จ Obsidian & Paper Themes | Cinematic dark/light theme system |
| 21 | โจ Spring-Physics Animations | Framer Motion transitions & micro-interactions |
| 22 | ๐ Cosmic Particle Backdrops | Floating particle emitter with ambient nebulas |
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m "feat: add amazing feature" - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License โ see the LICENSE file for details.