How jdeep1234/shikshak_saathi works
Main Components
• Frontend Client: Represented by the Next.js “app” directory with pages for different features (ai-feedback, insights, leaderboard, profile, training-hub, and start-training). Also include the “components” folder which houses reusable UI elements (header, footer, quiz-component, and many modular UI components).
• API / Backend Layer: Shown by the “pages/api” directory that includes endpoints (e.g., feedback and transcribe). This layer is responsible for handling REST API requests, integrating with AI services, and supporting real-time processes.
• Database Layer: Include PostgreSQL as the relational database, managed via Prisma (as seen in the “prisma” folder with migrations and schema definitions). Also highlight the “lib/prisma.ts” file that centralizes database interactions.
• AI & Machine Learning Modules: Separate components for the AI-powered multilingual feedback assistant, using libraries like Hugging Face transformers, Whisper, FlashlightASR, and OCR tools (OpenCV, Tesseract, etc.), as detailed in the README. These may be deployed as services or microservices.
• Auxiliary & Utility Services: Such as hooks (use-mobile, use-toast), and utilities found under “lib/utils.ts”, which support client-side interactions and business logic.
• Configuration & Build: Highlight configuration files (next.config.mjs, tailwind.config.ts, tsconfig.json, .env) that determine deployment parameters and toolchain settings.
• Optional Backend Variants: Note that the README mentions both Node.js (Express, possibly within the Next.js API routes) and Python (Flask) for specific components (like the insights dashboard). Represent this dual language support where applicable.
Relationships and Data Flow
• User Interaction: Start with teachers or school leaders interacting with the frontend (React/Next.js) where pages are routed (using dynamic routing as seen in app/start-training/[moduleId]).
• UI Components: The frontend utilizes shared components (in “components” and “components/ui”) to render user-friendly views, and these may communicate with backend API endpoints.
• Backend Requests: The API layer (pages/api) receives client requests (from pages for feedback and transcription) and interacts with the database via Prisma, then communicates with AI services.
• AI Processing: Show how data is passed into AI modules (speech-to-text, NLP, OCR) and then their results flow back through the API endpoints to be rendered in real time.
Architectural Patterns & Design Principles
• Component-Based Frontend: Next.js organizes the UI in modular pages and components, with dedicated directories for public assets, styles, and hooks.
• REST API & Microservices: The design decouples user-facing pages from backend API endpoints—making it easier to scale, maintain, and update individual modules.
• Separation of Concerns: Differentiate the responsibilities of the AI feedback assistant, gamified training hub, and insights dashboard; each module has its own dedicated frontend pages and supportive backend endpoints.
• Scalability & Offline Support: Highlight the serverless/cloud-based and offline-ready functionalities that ensure usability in low-bandwidth rural areas.
• Clear component labels: Every component (like “Teacher Feedback Service”, “Training Module”, “Insights Dashboard”, “AI Processing Service”, “Database (PostgreSQL)” etc.) should be clearly labeled.
• Frontend → API (HTTP/REST calls)
• API → AI Services (data processing pipelines)
• API → Database (data operations)
• UI components (perhaps rounded rectangles) from backend services (standard rectangles or servers).
• Explicit annotations for dynamic routing segments (e.g., pages with [id] or [moduleId]) to indicate that user paths are dynamic.
• Representation of configuration files and build/environment settings may be added in an “infrastructure” block to indicate deployment rationale.
Final Assembly
• A side panel or callouts for cross-cutting concerns like real-time communication (WebSocket), offline functionality (Electron.js usage for offline apps), and the usage of AI libraries.