How prathi912/rdc-imr works
Project type and purpose
• This is a full-stack, role-based web portal (“Research & Development Portal”) built with Next.js (App Router) on the front- and back-end, coupled with Firebase services (Auth, Firestore, Storage, Hosting, Cloud Functions) and Google Genkit for AI. It’s used by faculty, evaluators, CROs, admins, and super-admins to manage Intramural Research (IMR) lifecycle: proposal submission, review (AI-assisted), scheduling, grant management, analytics, and user/module administration.
File structure
• Top-level directories and files:
• src/app/… : Next.js App Router pages, layouts, and API routes (serverless functions)
• src/components/… : React UI components organized by feature and generic UI primitives
• src/lib/… : Firebase configuration & admin SDK, security modules, utilities
• src/ai/… : Google Genkit flows for AI-powered features
• dataconnect/… : A GraphQL connector layer (YAML + .gql files) for external data sources
• firebase.json, firestore.rules/indexes: Firebase config for Hosting, Firestore rules
• apphosting.yaml: deployment config for Firebase App Hosting
• package.json, tsconfig.json, tailwind.config.ts, postcss.config.mjs: build & styling
• Architectural patterns:
• Client-server separation within a single Next.js monorepo
• API routes = serverless functions
• RBAC implemented via Firebase Auth + custom security modules
• AI services abstracted behind a “Genkit flows” layer
• Data-connector layer for external GraphQL sources
• Cron triggers as serverless functions for scheduled tasks
• Bulk data import via Excel templates and an upload API
Extract insights from the README
• Roles & their permissions (faculty, evaluators, CRO, admin, super-admin) → RBAC is central
• Workflows: multi-step submission, review with AI prompts, scheduling with email notifications, grant disbursement
• AI integrations: summarization, domain suggestion, journal website finder
• Tech stack: Next.js, TypeScript, Tailwind, ShadCN UI, Firebase suite, Genkit, Nodemailer, optional external APIs
• Deployment: Firebase Hosting (apphosting.yaml controls build), CI/CD via GitHub → Firebase
a. Main components
• Client Browser / SPA (React + ShadCN UI in Next.js)
• Next.js App (Hosted on Firebase Hosting / Cloud Functions)
• API Layer (Next.js serverless functions under src/app/api)
• Authentication Service (Firebase Auth)
• Database (Cloud Firestore)
• Storage (Firebase Cloud Storage)
• Cloud Functions
• Cron jobs (send-meeting-reminders)
• Bulk upload processing
• Email notifications (Nodemailer + Gmail)
• AI Engine (Google Genkit flows invoked by serverless functions)
• Data Connector (GraphQL connector for external academic data)
• External APIs
• Optional: Scopus, WOS, Springer
• CI/CD Pipeline (GitHub → Firebase Hosting)
b. Relationships and interactions
• Browser ↔ Next.js Frontend (SSR/CSR)
• Frontend ↔ Serverless API Endpoints (auth, get-departments, research-papers, staff-data, cron triggers)
• API Endpoints ↔ Firebase Auth (validate tokens, enforce RBAC)
• API ↔ Firestore (read/write research projects, user profiles, logs)
• API ↔ Cloud Storage (upload/download proposal PDFs, CVs)
• Cron Functions ↔ Firestore + Nodemailer → email reminders
• AI Functions ↔ Genkit SDK → AI flows → Firestore updates
• Data Connector ↔ External GraphQL endpoints → enrich AI and UI workflows
• CI/CD ↔ Firebase Hosting (push new build)
c. Architectural patterns/design principles
• Monorepo with co-located frontend/back-end reduces context switching
• Serverless functions for horizontal scaling and granular security
• RBAC centralized in Firebase + custom “modules.ts” guards
• Flows layer for AI isolates complexity and eases extension
• GraphQL-based connector for decoupling external data sources
• Cron scheduling via HTTP-triggered serverless functions (Firestore triggers optional)
d. Key technologies/frameworks
• Next.js (App Router, serverless API routes)
• React, TypeScript, Tailwind CSS, ShadCN UI
• Firebase (Auth, Firestore, Storage, Hosting, Cloud Functions)
• Google Genkit (AI Toolkit)
• GraphQL connector (dataconnect folder)
• Nodemailer + Gmail for transactional email
Final advice
• Break the system into logical tiers: Presentation, API, Business Logic (AI/Connector), Persistence, External Integrations.
• Essential elements: RBAC, AI layer, dataconnect, cron jobs, external APIs.
• Don’t overcomplicate—detail comes from decomposing each service and showing its dependencies.