Skip to content

Add FAQ for IIT-ROPAR#89

Open
varun2spark wants to merge 1 commit into
vicharanashala:mainfrom
varun2spark:add-faq-iit-ropar
Open

Add FAQ for IIT-ROPAR#89
varun2spark wants to merge 1 commit into
vicharanashala:mainfrom
varun2spark:add-faq-iit-ropar

Conversation

@varun2spark

@varun2spark varun2spark commented Jun 24, 2026

Copy link
Copy Markdown

This Pull Request adds the FAQ integration for IIT-ROPAR.
https://github.com/varun2spark/Samagama_FAQ

Team Lead : Varun

Members :
Tarun Kumar
Tanisha Jain
Girik Shukla
Uday Bhardwaj
Antra Mishra
Dwig Yadav
Yazhini P.L
Ashika Agrawal
Sanskar Agrawal

@varun2spark

Copy link
Copy Markdown
Author

📌 Overview

The Vicharanashala Support Portal is a production-grade, full-stack web platform built exclusively for interns at IIT Ropar's Vicharanashala Internship Program — a single intelligent hub where every question gets answered, every issue gets resolved, and every intern stays informed throughout their program cycle.

At its core lives Yaksha — a 3D AI copilot powered by Google Gemini that understands Vicharanashala-specific context end-to-end: NOC validation, certificate workflows, Rosetta Journal requirements, and team formation. Around Yaksha is a complete ecosystem of 18 purpose-built features — a multi-language FAQ engine, a dedicated voice assistant, a threaded community forum, a smart bookmark system, a priority-based ticket system, coordinator-verified answers, and a full admin control center.

Built with strict TypeScript, role-based JWT authentication, rate limiting, CSP headers, and a type-safe ORM — this is a production system designed to serve real students across real internship cycles, not a demo.



✦ Features

  • Yaksha AI Assistant – Get instant, personalized answers for internship-related queries.
  • Voice Support – Interact with Yaksha using voice commands for hands-free assistance.
  • Multi-Language Translation – Translate FAQs into English, Hindi, Punjabi, and Spanish.
  • Smart FAQ System – Explore categorized FAQs with search, sorting, and popularity filters.
  • Bookmarks & Quick Revisit – Save important FAQs and continue from where you left off.
  • Category-Based Navigation – Browse topics like Internship, NOC, Certificates, Rosetta Journal, and Projects.
  • FAQ Insights – View category-wise FAQ counts and discover trending topics easily.
  • Community Discussion Forum – Ask questions, join discussions, and learn from peers.
  • Community Contributions – Submit answers and help build a collaborative knowledge base.
  • Coordinator-Verified Answers – Promote trusted community responses into official FAQs.
  • Support Ticket System – Raise, track, and manage issues with priorities and unique ticket IDs.
  • Real-Time Notifications – Stay updated on ticket status, replies, and important announcements.
  • Admin Control Center – Manage FAQs, users, tickets, analytics, and moderation from one dashboard.


Yaksha AI Copilot Hub

%%{init: {'theme':'base'}}%%

flowchart LR

    subgraph HUB["AI Copilot Hub"]
        A["How can Yaksha assist you?"]

        subgraph CONTEXT["Supported Topics"]
            B["NOC"]
            C["Certificates"]
            D["Rosetta Journal"]
            E["Projects"]
        end

        Y["Yaksha AI<br/>Status: Active"]
    end

    A --> B
    A --> C
    A --> D
    A --> E

    B --> Y
    C --> Y
    D --> Y
    E --> Y

    classDef default fill:#1f1f1f,color:#ffffff,stroke:#666666,stroke-width:1px;
    linkStyle default stroke:#999999,stroke-width:1.5px;
Loading

Yaksha is the intelligence layer of the entire portal. A conversational AI assistant embedded into the dashboard with a live 3D avatar, active status indicator, and deep FAQ integration. It understands Vicharanashala-specific context end-to-end.

Capability Detail
🧠 AI Engine Google Gemini API — runs entirely server-side, key never reaches the browser
🎙️ Input Modes Text and voice — built-in microphone integration
🔗 FAQ Integration Every FAQ card has an "Ask AI About This" button for in-context follow-ups
Rate Limiting 15 messages / minute — fair, reliable access across the full cohort
🎭 UI Presence Animated 3D robot in the AI Copilot Hub with live 3D YAKSHA ACTIVE tag


🎙️ Voice Assistant

A dedicated voice interface — its own section in the navbar, separate from the chat.

  • Speak queries directly; Yaksha processes and responds with spoken answers
  • Designed for speed: no typing, no friction, instant information access
  • Built on the browser's microphone API with explicit permission handling


Intelligent FAQ System

Not a static page. A fully intelligent, multi-layered knowledge base purpose-built for internship workflows.


📂 Browse & Discover
Feature Description
Category Navigation FAQs split into: About Internship · NOC · Certificates · Rosetta Journal · Projects
FAQ Count Indicators Every category shows the exact number of available FAQs at a glance
Smart Sorting Toggle between Index (by category) and Popular (by trending usage)
Trending FAQ Counter Live navbar badge tracking the number of currently trending queries
📖 Read & Save
Feature Description
Multi-language Translation Translate any answer into English · Hindi · Punjabi · Spanish — inline, within the card
Bookmark FAQs One-click save from any FAQ card to a personal bookmark list
My Saved FAQs Dedicated section surfacing all bookmarked entries for fast future access
Quick Revisit Portal auto-tracks viewed FAQs — students continue exactly where they left off
💡 Ask & Clarify
Feature Description
Ask Yaksha AI (per FAQ) Direct AI button on every card — scoped to that topic, no context switching


Community Discussion Workflow

%%{init: {'theme':'base'}}%%

flowchart TD

    A["Student posts question"]
    B["Discussion Thread"]
    C["Peers and Coordinators respond"]
    D["Coordinator reviews answers"]
    E["Verified Answer"]
    F["Promoted to Official FAQ"]
    G["Knowledge loop closes"]

    A --> B
    C --> B
    B --> D
    D --> E
    E --> F
    F --> G

    classDef default fill:#1f1f1f,color:#ffffff,stroke:#666666,stroke-width:1px;
    linkStyle default stroke:#999999,stroke-width:1.5px;
Loading
Feature Description
Post Questions Post directly from the FAQ portal when information can't be found
Thread-based Queries Each question spawns a structured discussion thread
Community Contributions Students submit answers to existing FAQs for admin review
Verified Answers Coordinators promote accurate discussions to official FAQ status


Support Ticket Workflow

%%{
  init: {
    "theme": "base",
    "flowchart": {
      "curve": "linear"
    }
  }
}%%

flowchart TD

    A["Student raises ticket"]

    B["Selects category"]
    C["Sets priority"]
    D["Describes issue"]

    P["LOW"]
    Q["MEDIUM"]
    R["HIGH"]

    E["Unique Ticket ID<br/>Assigned automatically"]

    F["OPEN"]
    G["IN PROGRESS"]
    H["RESOLVED"]

    I["Admin manages via Control Center"]

    A --- B
    A --- C
    A --- D

    C --- P
    C --- Q
    C --- R

    B --- E
    C --- E
    D --- E

    E --- F
    F --- G
    G --- H

    H --- I

    classDef default fill:#1f1f1f,color:#ffffff,stroke:#666666,stroke-width:1px;

    linkStyle default stroke:#808080,stroke-width:2px;
Loading


🔔 Notification Center

Students are never out of the loop.

  • In-app notifications scoped per user — only what's relevant to you
  • Triggers on: ticket status changes · coordinator replies · verified answer promotions


🛡️ Admin Control Center

Complete operational visibility for program coordinators — all from one protected tab.

Capability Detail
📊 Live Stats Total users · open tickets · FAQ count · community answers
👥 Intern Roster Name · email · student ID · college · role · verification · contribution score
✔️ Moderation Review community submissions · promote verified answers to official FAQs
🔐 Access Control JWT + requireAdmin guard — zero unauthorized access


🗺️ Architecture & Data Flow

flowchart TB

    subgraph CLIENT["🖥️ Client Layer — React 19 + Vite 6"]
        OVERVIEW["📊 Overview Dashboard"]
        FAQ["❓ Intelligent FAQ"]
        VOICE["🎙️ Voice Assistant"]
        YAKSHA["🤖 Yaksha AI"]
        COMMUNITY["💬 Community Forum"]
        TICKETS["🎫 Support Tickets"]
        NOTIFICATIONS["🔔 Notifications"]
        ADMIN["🛡️ Admin Control Center"]

        UI["Tailwind CSS v4<br/>Framer Motion<br/>React Router<br/>Axios"]
    end

    subgraph SERVER["⚙️ API Layer — Express.js + TypeScript"]
        AUTH["/api/auth"]
        FAQAPI["/api/faqs"]
        CHAT["/api/chat"]
        TICKETAPI["/api/tickets"]
        COMMUNITYAPI["/api/community-answers"]
        NOTIFYAPI["/api/notifications"]
        ADMINAPI["/api/admin/logs"]
        HEALTH["/api/health"]

        SECURITY["🔐 JWT Auth<br/>Helmet<br/>CORS<br/>Rate Limiting<br/>Role Guards"]
    end

    subgraph AI["🧠 AI Layer"]
        GEMINI["Google Gemini API"]
    end

    subgraph DATABASE["🗄️ Database Layer — Prisma ORM"]
        USER["User"]
        FAQDB["FAQ"]
        TICKETDB["Ticket"]
        ANSWER["CommunityAnswer"]
        NOTIFICATION["Notification"]

        STORAGE["SQLite (Dev)<br/>PostgreSQL Compatible (Prod)"]
    end

    OVERVIEW --> FAQAPI
    FAQ --> FAQAPI
    VOICE --> CHAT
    YAKSHA --> CHAT
    COMMUNITY --> COMMUNITYAPI
    TICKETS --> TICKETAPI
    NOTIFICATIONS --> NOTIFYAPI
    ADMIN --> ADMINAPI

    AUTH --> SECURITY
    FAQAPI --> SECURITY
    CHAT --> SECURITY
    TICKETAPI --> SECURITY
    COMMUNITYAPI --> SECURITY
    NOTIFYAPI --> SECURITY
    ADMINAPI --> SECURITY

    CHAT --> GEMINI

    SECURITY --> USER
    SECURITY --> FAQDB
    SECURITY --> TICKETDB
    SECURITY --> ANSWER
    SECURITY --> NOTIFICATION

    USER --> STORAGE
    FAQDB --> STORAGE
    TICKETDB --> STORAGE
    ANSWER --> STORAGE
    NOTIFICATION --> STORAGE
Loading


🛠️ Tech Stack

Layer Technology Purpose
UI Framework React 19 Concurrent rendering, modern hooks architecture
Build Tool Vite 6 Sub-second HMR in dev · optimized prod bundles
Styling Tailwind CSS v4 Utility-first dark theme applied system-wide
Animation Framer Motion Page transitions · 3D Yaksha avatar · micro-interactions
Backend Express.js 4 + TypeScript Typed REST API with full middleware control
AI Engine Google Gemini (@google/genai ^2.4.0) Yaksha — server-side only, key never exposed
ORM Prisma Type-safe queries · schema-as-code · migration support
Auth JSON Web Tokens + bcrypt Stateless auth · zero plaintext password storage
Security Helmet + CORS + express-rate-limit HTTP hardening · CSP · abuse prevention
Backend Build esbuild Single-file backend bundle for production
Dev Runtime tsx Run TypeScript directly in Node — zero compile step


📁 Project Structure

IIT-ROPAR/
│
├── 📂 prisma/
│   ├── schema.prisma            ← User · Ticket · FAQ · CommunityAnswer models
│   └── seed.ts                  ← Initial database seed data
│
├── 📂 src/
│   │
│   ├── 📂 backend/
│   │   ├── 📂 routes/
│   │   │   ├── authRoutes.ts             ← /api/auth
│   │   │   ├── ticketRoutes.ts           ← /api/tickets
│   │   │   ├── faqRoutes.ts              ← /api/faqs
│   │   │   ├── chatRoutes.ts             ← /api/chat  [ Yaksha lives here ]
│   │   │   ├── communityAnswerRoutes.ts  ← /api/community-answers
│   │   │   └── notificationRoutes.ts    ← /api/notifications
│   │   │
│   │   ├── 📂 middleware/
│   │   │   └── authMiddleware.ts         ← authenticateToken · requireAdmin
│   │   │
│   │   └── 📂 services/
│   │       └── db.ts                     ← Prisma client singleton
│   │
│   └── 📂 frontend/
│       ├── pages/                        ← Overview · FAQ · Chat · Dashboard · Admin
│       ├── components/                   ← FAQ cards · Ticket forms · Yaksha widget
│       └── hooks/                        ← Auth · Notifications · Bookmarks
│
├── server.ts                    ← Express app entry point
├── vite.config.ts               ← Vite + Express dev middleware config
├── tsconfig.json
├── .env.example
└── package.json


🚀 Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

Requirement Version Source
Node.js v18 or later nodejs.org
npm v9 or later Bundled with Node.js
Gemini API Key Free tier available Google AI Studio

Note: npm is automatically installed with Node.js.


Step 1  ·  Clone

git clone https://github.com/tarun-1607/IIT-ROPAR.git
cd IIT-ROPAR

Step 2  ·  Install

npm install

Step 3  ·  Configure environment

cp .env.example .env.local
# ─────────────────────────────────────────────────────────────────
#  Required
# ─────────────────────────────────────────────────────────────────

# Powers Yaksha AI — server-side only, NEVER sent to the browser
GEMINI_API_KEY="your_gemini_api_key_here"

# Base URL for the application
APP_URL="http://localhost:3000"

# ─────────────────────────────────────────────────────────────────
#  Optional
# ─────────────────────────────────────────────────────────────────
NODE_ENV="development"   # Set to "production" for prod builds
PORT=3000

Step 4  ·  Initialize database

npm run setup

Runs prisma db push (creates schema) then prisma/seed.ts (populates initial data).
Run once on first setup only.

Step 5  ·  Launch

npm run dev

Open http://localhost:3000 and the full portal is live. ✦



📜 Scripts

Script Description
npm run dev Dev server with Vite hot module reload
npm run build Build frontend (Vite) + backend (esbuild) → dist/
npm start Run the production build from dist/server.cjs
npm run setup First-time only. Push schema + seed the database
npm run db:push Apply Prisma schema changes to the database
npm run db:seed Re-run the database seed script
npm run lint TypeScript type-check across the full codebase (no emit)
npm run clean Remove dist/ and all build artifacts


🔌 API Reference

All routes are prefixed /api. Protected routes require:

Authorization: Bearer <your_jwt_token>

🔑 Authentication  ·  /api/auth  ·  Rate limited: 100 req / 15 min
Method Endpoint Description
POST /api/auth/register Register a new student account
POST /api/auth/login Authenticate and receive a signed JWT

🎫 Tickets  ·  /api/tickets  ·  🔐 JWT required
Method Endpoint Access Description
GET /api/tickets Student / Admin Own tickets (student) · Full queue (admin)
POST /api/tickets Student Raise ticket with category + priority
GET /api/tickets/:id Student / Admin Fetch by unique ticket ID
PATCH /api/tickets/:id Admin Update ticket status

❓ FAQs  ·  /api/faqs
Method Endpoint Access Description
GET /api/faqs Public All FAQs with categories and metadata
POST /api/faqs 🔐 Admin Create a new FAQ entry
PATCH /api/faqs/:id 🔐 Admin Update an existing entry

🤖 Yaksha AI  ·  /api/chat  ·  🔐 Rate limited: 15 req / min
Method Endpoint Description
POST /api/chat Send a message → receive a Gemini-powered response

💬 Community  ·  /api/community-answers  ·  🔐 JWT required
Method Endpoint Description
GET /api/community-answers List all discussion threads
POST /api/community-answers Submit an answer (increments contributor score)

🔔 Notifications  ·  /api/notifications  ·  🔐 JWT required
Method Endpoint Description
GET /api/notifications Fetch current user's notifications

🛡️ Admin  ·  /api/admin/logs  ·  🔐 Admin role only
Method Endpoint Description
GET /api/admin/logs Full system stats + complete user roster
{
  "success": true,
  "userCounts": 42,
  "ticketCounts": 17,
  "faqCounts": 8,
  "answerCounts": 93,
  "usersList": [
    {
      "name": "Ananya Sharma",
      "email": "ananya@iitropar.ac.in",
      "studentId": "2022CSB1234",
      "college": "IIT Ropar",
      "role": "student",
      "isVerified": true,
      "contributionScore": 12
    }
  ]
}

💚 Health  ·  /api/health  ·  Public
{ "status": "healthy", "timestamp": "2026-06-19T14:32:00.000Z" }


🗄️ Data Models

model User {
  id                String            @id @default(cuid())
  name              String
  email             String            @unique
  password          String            // bcrypt hashed; never stored in plaintext

  studentId         String?
  college           String?

  role              Role              @default(student)
  isVerified        Boolean           @default(false)
  contributionScore Int               @default(0)

  tickets           Ticket[]
  answers           CommunityAnswer[]
  notifications     Notification[]
}

model Ticket {
  id          String         @id @default(cuid())
  title       String
  description String
  category    String

  priority    Priority
  status      TicketStatus   @default(open)

  ticketCode  String         @unique

  userId      String
  user        User           @relation(fields: [userId], references: [id])

  createdAt   DateTime       @default(now())
  updatedAt   DateTime       @updatedAt
}

model FAQ {
  id         String    @id @default(cuid())
  question   String
  answer     String

  category   String
  views      Int       @default(0)

  isOfficial Boolean   @default(true)
}

model CommunityAnswer {
  id           String    @id @default(cuid())
  question     String
  answer       String

  isVerified   Boolean   @default(false)

  authorId     String
  author       User      @relation(fields: [authorId], references: [id])

  createdAt    DateTime  @default(now())
}


🔒 Security

Security is not bolted on — it is layered at every level of the stack.

Incoming Request
      │
      ├─── Helmet ──────────────  Strict HTTP headers · Content Security Policy
      ├─── CORS ────────────────  Controlled cross-origin access
      ├─── Rate Limiter ────────  100 req/15min (auth) · 15 req/min (Yaksha)
      ├─── authenticateToken ───  JWT validation on all protected routes
      └─── requireAdmin ────────  Role guard on all admin endpoints

Content Security Policy — Production

Directive Allowed Origins
default-src 'self'
script-src 'self' 'unsafe-inline'
style-src 'self' 'unsafe-inline' fonts.googleapis.com
font-src 'self' fonts.gstatic.com
img-src 'self' data: https://*
connect-src 'self' https://*

Yaksha API Key Isolation

  Browser
     │
     │  POST /api/chat  (only the user's message travels here)
     ▼
  Express Server  ────────────────────────────────►  Gemini API
       ↑
  GEMINI_API_KEY lives here only.
  Never bundled into client code.
  Never visible in DevTools · Network tab · Browser memory.

Passwords are bcrypt-hashed before storage. No plaintext credentials exist anywhere in the system.



🌐 Deployment

Build for production

npm run build

Produces:

  • dist/ — compiled, tree-shaken React SPA (statically served)
  • dist/server.cjs — fully bundled backend (Node.js CommonJS, zero install at runtime)

Run in production

NODE_ENV=production node dist/server.cjs

Binds to 0.0.0.0:PORT. All unmatched routes fall back to index.html for client-side routing.


Platform recommendations

Platform Notes
Railway Auto-detects Node.js. Set env vars in dashboard. Zero config needed.
Render Free tier available. Set NODE_ENV=production + GEMINI_API_KEY in env.
Fly.io Global edge deployment. Run fly launch — auto-detects project.
VPS / Ubuntu nginx for SSL termination · pm2 for process management


📄 License

This project is open-source. See LICENSE for details.



Footer

Built for the interns. By the interns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant