A highly scalable, collaborative FAQ and Q&A platform built for Samagama students at the Vicharanashala Lab for Education Design, IIT Ropar.
AskSam is a next-generation knowledge management portal engineered to prevent information loss in student communities. By leveraging automated moderation queues, verified answer tracking, and real-time community engagement, AskSam transforms chaotic forum discussions into a clean, canonical FAQ database.
The architecture is built for high availability, utilizing modern server-state management on the client and a robust, event-driven micro-service architecture on the backend.
flowchart LR
Client["React SPA (Frontend)"] -- "HTTP / WebSockets" --> API["NestJS Gateway (Backend)"]
API -- "Read / Write" --> DB[("MongoDB Atlas")]
API -. "Offline Fallback" .-> JSON["faqData.json"]
style Client fill:#61DAFB,stroke:#333,stroke-width:2px,color:#000
style API fill:#E0234E,stroke:#333,stroke-width:2px,color:#FFF
style DB fill:#47A248,stroke:#333,stroke-width:2px,color:#FFF
style JSON fill:#F7DF1E,stroke:#333,stroke-width:2px,color:#000
To maintain separation of concerns and scale efficiently, the monorepo is divided into specialized modules. Specific proprietary algorithms regarding FAQ promotion and AI moderation have been abstracted into black-box core modules.
π Frontend Architecture (React / Vite)
frontend/
βββ src/
β βββ assets/ # Static media, icons, and SVGs
β βββ components/ # Reusable UI components
β β βββ common/ # Buttons, Modals, Inputs
β β βββ layout/ # Navbars, Sidebars, Footers
β βββ hooks/ # Custom React hooks (TanStack Query wrappers)
β βββ pages/ # View-level route components
β βββ router/ # React Router v7 configuration & lazy loading
β βββ services/ # API client & Socket.IO event listeners
β βββ store/ # Client-side state management context
β βββ styles/ # Tailwind CSS theme configuration (v4)
β βββ types/ # TypeScript interfaces and shared DTOs
β βββ utils/ # Helper functions and formatters
βββ public/ # Raw static assets
βββ index.html # Application entry point
βββ package.json # Dependency definitions
βββ vite.config.ts # Vite build and proxy configurations
π οΈ Backend Architecture (NestJS)
backend/
βββ src/
β βββ common/ # Shared guards, interceptors, and decorators
β βββ config/ # Environment variable validation schemas
β βββ core/ # π Proprietary Business Logic & Algorithms
β βββ modules/ # Feature-based domain modules
β β βββ auth/ # JWT generation and validation
β β βββ users/ # User profile and role management
β β βββ questions/ # Moderation queue and answer lifecycle
β β βββ faqs/ # Canonical FAQ generation handlers
β β βββ search/ # Full-text indexing and query analytics
β βββ database/ # Mongoose schemas and connection factories
β βββ events/ # Socket.IO Gateway definitions
β βββ app.module.ts # Root dependency injection container
β βββ main.ts # Server bootstrap and middleware setup
βββ scripts/ # Database seeding and migration utilities
βββ package.json # Dependency definitions
βββ tsconfig.json # Strict TypeScript compiler options
- Knowledge Discovery: Lightning-fast full-text search indexing across verified FAQs and active open questions.
- Intelligent Routing: A dynamic moderation queue that routes questions using an oldest-first algorithm.
- Answer Verification Engine: Proprietary logic that allows authorized users to verify answers, seamlessly converting them into canonical database entries.
- Reopen & Flagging Flow: A self-correcting community mechanism where verified answers can be challenged and sent back to the queue.
- Real-Time WebSockets: Live data pushing via Socket.IO ensures clients are updated instantly without manual polling.
- Role-Based Access Control (RBAC): Granular permissions ensuring only authorized admins can finalize canonical data.
- Fault Tolerance: Built-in offline resilience that falls back to a localized JSON structure if the primary document store is temporarily unavailable.
- Node.js (v18 or higher)
- MongoDB Server
- npm (v9 or higher)
For security, create .env files in both directories based on these templates:
Backend Environment (backend/.env)
PORT=3000
MONGODB_URI=mongodb://localhost:27017/samagama
JWT_SECRET=your_secure_jwt_secret_key
# Core algorithmic services
GROQ_API_KEY=optional_key_for_advanced_moderationFrontend Environment (frontend/.env)
VITE_API_URL=http://localhost:3000/api-
Clone the repository:
git clone https://github.com/vicharanashala/cs35.git cd cs35 -
Boot the API Server:
cd backend npm install npm run start:dev -
Boot the Client Application:
cd ../frontend npm install npm run dev
The application is now actively running at http://localhost:5173.
The API is fully guarded. Protected routes demand a valid Bearer token within the Authorization header.
| Domain | Endpoint | Method | Action |
|---|---|---|---|
| Auth | /api/auth/login |
POST |
Authenticate and issue JWT payload |
| FAQs | /api/faqs |
GET |
Fetch canonical knowledge base |
| Queue | /api/questions |
GET |
Query the active moderation queue |
| Ask | /api/questions |
POST |
Dispatch a new question to the queue |
| Answer | /api/questions/:id/answer |
PATCH |
Submit a community answer |
| Verify | /api/questions/:id/convert-to-faq |
POST |
(Admin) Finalize and promote answer |
| Search | /api/search/full |
GET |
Execute full-text index query |
Developed and maintained by the 2026 cohort at the Vicharanashala internship program, IIT Ropar.
- Mano Shruthi S
- Pavan Kumar M
- Dusi Keerthi Prasanna
- Rashmi Risha J
- Thivesha M. S
- Dishi Gupta
- Ambati Vedanandana
- Divyadharshini S
- Putta Sri Tejaswi
- Akshaya Boggarapu
This project is licensed under the MIT License.
Built for scalability. Designed for students.