Welcome to Yaksha FAQ & Support Portal (also referred to as yaksha-faq), a production-ready, feature-rich web application built from scratch to streamline onboarding, support, and query resolution for candidates of the Vicharanashala Internship (VINS) at IIT Ropar.
The platform is designed to provide interns with self-service support via advanced interactive FAQ searches, an AI-inspired smart chatbot with instant replies, and structured support query workflows, all supported by a comprehensive, fully animated administrative control center.
Below is the conceptual architecture showing how client applications, API controllers, secure route guards, and database schemas integrate to provide a robust user experience:
graph TD
classDef client fill:#2563EB,stroke:#1D4ED8,stroke-width:2px,color:#FFF;
classDef server fill:#7C3AED,stroke:#6D28D9,stroke-width:2px,color:#FFF;
classDef db fill:#10B981,stroke:#047857,stroke-width:2px,color:#FFF;
classDef guard fill:#EF4444,stroke:#B91C1C,stroke-width:2px,color:#FFF;
subgraph Client ["Client Side (React 19 & Framer Motion)"]
Landing["π Home / Portal Entry"]
FaqView["π FAQ Search & Category Filter"]
UserDash["π User Dashboard (Protected)"]
ChatBot["π¬ Yaksha Mini Floating Chatbot"]
AdminDash["π οΈ Admin Dashboard & Recharts Analytics"]
Submitter["π Support Query / FAQ Suggestion Forms"]
end
subgraph Server ["Server Side (Next.js 15 App Router)"]
Middleware["π‘οΈ NextAuth v5 Middleware (RBAC Guard)"]
API_Auth["π /api/auth/* (Credentials Provider)"]
API_Chat["π€ /api/chat (MongoDB $text Match & History)"]
API_FAQs["π /api/faqs/* (CRUD & Search Endpoint)"]
API_Queries["βοΈ /api/queries/* (Create & Reply Handler)"]
API_Suggest["π‘ /api/faq-suggestions/* (Moderate Suggestion)"]
API_Stats["π /api/admin/stats (Aggregate Analytics)"]
end
subgraph DB ["Database Tier (MongoDB & Mongoose Schema)"]
Coll_Users[("π€ Users Collection")]
Coll_FAQs[("π FAQs Collection ($text Index)")]
Coll_Queries[("βοΈ Queries Collection")]
Coll_Suggestions[("π‘ FAQ Suggestions Collection")]
Coll_Chat[("π¬ Chat History Collection")]
end
Landing --> FaqView
Landing --> ChatBot
UserDash --> Submitter
UserDash --> ChatBot
%% Middleware flow
UserDash -.-> Middleware
AdminDash -.-> Middleware
Middleware --> API_FAQs
Middleware --> API_Queries
Middleware --> API_Suggest
Middleware --> API_Stats
%% Direct endpoints
Submitter --> API_Queries
Submitter --> API_Suggest
ChatBot --> API_Chat
Landing --> API_Auth
%% API to DB
API_Auth --> Coll_Users
API_Chat --> Coll_FAQs
API_Chat --> Coll_Chat
API_FAQs --> Coll_FAQs
API_Queries --> Coll_Queries
API_Suggest --> Coll_Suggestions
API_Stats --> Coll_Users
API_Stats --> Coll_FAQs
API_Stats --> Coll_Queries
API_Stats --> Coll_Suggestions
class Landing,FaqView,UserDash,ChatBot,AdminDash,Submitter client;
class Middleware guard;
class API_Auth,API_Chat,API_FAQs,API_Queries,API_Suggest,API_Stats server;
class Coll_Users,Coll_FAQs,Coll_Queries,Coll_Suggestions,Coll_Chat db;
- Role-Based Access Control (RBAC): Separates platform functionality into
userandadminportals. - Secure Credentials Auth: Passwords are securely hashed using
bcryptjsupon user registration. - Session Protection: Protects specific directories (e.g.,
/dashboard,/admin/*) using Next.js Middleware. - Dual Login Views: Seamlessly handles standard candidate login alongside dedicated administrator portals.
- Dynamic Search: Instant responsive filtering with MongoDB fuzzy text matching.
- Category Filter Pills: High-fidelity clickable category pills corresponding to primary cohort topics (NOC, Certificates, Selection, Work & Mentorship, Rosetta Journal, etc.).
- Smooth Animations: Animated collapsible accordions built with
framer-motionto offer a premium UI.
- Interactive Popup: An animated floating chatbot located at the bottom-right corner.
- Instant Search API: Matches questions in real time using a MongoDB
$textsearch on the FAQ database, returning the best response and linking relevant items. - Action Fallbacks: Guides users when no matches are found by offering shortcut buttons to suggest a new FAQ or submit a direct query.
- Chat Histories: Stores dialogues directly in
chatHistoryfor session persistent retention.
- Raise Queries: Dedicated portal to submit formal query cases complete with categorization and priority levels (
Low,Medium,High). - Query Tracking: Instantly monitor status, timestamps, and administrator replies in real-time.
- FAQ Suggestions: Empower cohort members to suggest fresh FAQs, automatically routing submissions to the moderation panel.
- Recharts Analytics: Interactive and responsive visual charts (Pie, Bar) outlining FAQ categories, query frequencies, and status distributions.
- CRUD Operations: Edit, add, or delete live FAQs dynamically.
- Moderation Panel: Accept or reject community FAQ suggestions with notes, updating the FAQ collection automatically upon approval.
- User and Support Management: Complete users view with access revocation and intuitive reply modals to address pending support tickets.
| Layer | Technology | Purpose |
|---|---|---|
| Core Framework | Next.js 15.1.0 (App Router) | High-performance React framework for server components and APIs. |
| Database | MongoDB & Mongoose 8.8.2 | Document database for storage with singleton connection patterns. |
| Authentication | NextAuth.js v5 (Beta 25) | Unified role-based JWT authentication and middleware guards. |
| Styling | Tailwind CSS v4.0.0 | Rapid utility-first styling for elegant, premium interfaces. |
| Animations | Framer Motion 11.11.17 | Fluid micro-interactions, page reveals, and chatbot popups. |
| Visual Reports | Recharts 2.13.3 | Multi-colored SVG charts for admin statistics. |
| Icons | Lucide React 0.460.0 | Clean, lightweight modern SVG icons. |
f:\FAQ\
βββ app/ # Next.js App Router root
β βββ (auth)/ # Auth routes (Login & Registration)
β βββ admin/ # Admin views (Login & Dashboards)
β βββ api/ # Backend REST API Routes
β β βββ admin/stats/ # Aggregated metrics for Recharts
β β βββ auth/ # Custom signup API endpoints
β β βββ chat/ # Chatbot search and history logging
β β βββ faq-suggestions/ # User FAQ suggestions CRUD
β β βββ faqs/ # Main FAQ CRUD and Search API
β β βββ queries/ # User Support query submissions
β β βββ users/ # Administrator user administration
β βββ dashboard/ # Candidate home space (protected)
β βββ faqs/ # Interactive user FAQ directory
β βββ query-status/ # Direct query lookup portal
β βββ raise-query/ # Submit support queries form
β βββ suggest-faq/ # Suggestion form interface
β βββ globals.css # Global CSS variables & Tailwind v4
β βββ layout.tsx # Main HTML structure & Root layout
β βββ page.tsx # Beautiful Landing Page with CTA sections
βββ components/ # Shareable UI elements (e.g. Chatbot, Navbar)
βββ lib/ # Core helpers
β βββ db.ts # MongoDB connection manager (Singleton Pattern)
βββ models/ # Mongoose Database Schemas
β βββ ChatHistory.ts # Conversational bot log schema
β βββ Faq.ts # Base FAQ Schema (question, answer, category)
β βββ FaqSuggestion.ts # FAQ recommendation schema
β βββ Query.ts # Ticket system database schema
β βββ User.ts # Authenticated candidate credentials schema
βββ public/ # Static icons, vector graphics, and images
βββ scripts/ # Project seeding scripts
β βββ seedFaqs.ts # Clears collections & imports seed FAQ payload
βββ types/ # Common Typescript interfaces
βββ package.json # App dependencies & script records
βββ tsconfig.json # Typescript configurations
βββ next.config.ts # Next.js app configurationsEnsure the following tools are installed on your environment:
- Node.js:
v18.xor higher (compatible with React 19) - MongoDB: A running local MongoDB instance or a remote MongoDB Atlas database URI.
Navigate to your repository and download node packages:
npm installCreate a .env.local file at the project root using the following template:
# MongoDB Connection String (Replace with your database configuration)
MONGODB_URI=mongodb://localhost:27017/yaksha-faq
# NextAuth Configuration
NEXTAUTH_SECRET=your_super_secret_jwt_signature_key
NEXTAUTH_URL=http://localhost:3000Note
Make sure NEXTAUTH_SECRET is a long, randomly generated string in production environments. You can generate one via: openssl rand -base64 32.
Seed Vicharanashala's official internship FAQ entries (12 categories, 40+ structured items) and configure MongoDB text indices by running the seeding script:
# Using tsx to execute the typescript seed script
npm run seedThis script will:
- Connect securely to your MongoDB database using the singleton connection.
- Flush any old FAQ documents to prevent double seeds.
- Import the rich FAQ data package.
- Establish a
$textsearch index on both thequestionandanswerproperties, enabling fast fuzzy search for the Yaksha Chatbot.
Launch the compiler and Next.js development server locally:
npm run devOpen http://localhost:3000 in your favorite browser to test the platform.
To compile optimizations for live deployment, run the production build:
# Build the optimized production output
npm run build
# Start the built production server
npm run start{
name: string;
email: string;
password (hashed): string;
role: 'user' | 'admin';
createdAt: Date;
}{
question: string;
answer: string;
category: string; // "NOC", "Timing and Dates", "Work & Mentorship", etc.
createdAt: Date;
}
// Requires MongoDB $text index on question + answer{
userId?: ObjectId;
name: string;
email: string;
category: string;
subject: string;
message: string;
priority: 'Low' | 'Medium' | 'High';
status: 'Pending' | 'In Progress' | 'Solved';
adminReply?: string;
createdAt: Date;
updatedAt: Date;
}{
userId?: string; // Session ID or anonymous token
messages: [
{
sender: 'user' | 'bot';
text: string;
timestamp: Date;
}
]
}{
userId?: ObjectId;
question: string;
suggestedAnswer: string;
category: string;
description?: string;
status: 'Pending' | 'Approved' | 'Rejected';
adminReview?: string;
createdAt: Date;
}The UI has been tailored to reflect Vicharanashala's professional standards:
- Clean Theme: Pristine modern backdrop styling (
#FFFFFF/#F8FAFC). - Harmonious Accents: Professional Ocean Blue (
#2563EB) as primary tone, beautifully accented with deep amethyst violet (#7C3AED). - Glassmorphism Panels: Interactive containers utilize soft backdrop blur filters (
backdrop-blur-md), semi-transparent borders (border-white/20), and subtle shadows (shadow-lg). - Premium Animations: Integrated subtle slide-ins, spring-based hovers, and clean responsive micro-interactions using Framer Motion.
- Inter Font: Streamlined global typography using Google's Inter sans-serif typeface.
- Created for Vicharanashala Research Lab (IIT Ropar).
- Intern FAQ guidelines and data compiled from the official Vicharanashala Portal.