How harrypeter07/aievaluator works
Project type and purpose
• This is a full-stack web application built with Next.js (React) on the frontend and Next.js API routes (Node.js) on the backend, using MongoDB for data persistence.
• Its purpose is to automate assignment evaluation and grading via Google Gemini AI, integrate with Google Classroom, and provide an intuitive dashboard and analytics.
File structure
• Frontend (app & components)
• app/layout.tsx, app/page.tsx, app/login, app/signup, app/dashboard, app/classroom, etc.
• app/api – Next.js route handlers under app/api/assignments/* and app/api/auth/*
• components and components/ui – reusable presentational components (Navbar, FileHandler, typewriter effect)
• styles: globals.css, tailwind.config.js, postcss.config.mjs
• Backend & Services (lib & models)
• lib/authOptions.js, lib/cache.js, lib/classroomGemini.js, lib/gemini.js, lib/db.js, lib/logger.js, lib/rateLimit.js, lib/utils.js
• lib/models/Evaluation.js (Mongoose schema)
• models/Assignment.js, models/User.js (data definitions)
• Configuration & Deployment
• next.config.js/.ts, tsconfig.json, folder-alias.json, eslint.config.mjs, package.json, .gitignore
• Public & Static assets
• public/manifest.json, public/folder-alias.json
README for additional insights
• Tech stack: Next.js 14, TypeScript, TailwindCSS, Shadcn UI on front; Node.js/Express.js (via Next API), MongoDB, WebSocket on back.
• Integrations: Google OAuth2, Google Classroom API, Google Drive API, Gemini AI API.
• System Architecture summary:
Client Layer → API Layer (REST + WebSocket) → Authentication (OAuth) → Service Layer → Database Layer
Main components and interactions
a. Client (User’s Browser / Mobile)
• Next.js pages (SSR/CSR), React components, WebSocket connections (real-time updates)
b. API Layer (Next.js API Routes)
• /api/auth (signup, NextAuth)
• /api/assignments/* (analyze, compare, fetch, count, evaluateClassroomSubmissions, getEvaluations, saveEvaluation, updateCount)
• Real-time events via WebSocket (if implemented)
c. Service Layer / Business Logic (lib/)**
• Authentication (NextAuth + Google OAuth)
• Classroom & Gemini integration (lib/classroomGemini.js, lib/gemini.js)
• Assignment processing pipelines (analyze, compare, score)
• Caching, rate limiting, logging utilities
d. Data Layer (MongoDB)
• Collections: users, assignments, evaluations
• Access via Mongoose models in lib/models and models/
e. External Services
• Google OAuth2 (authentication)
• Google Classroom API (fetch course work, sync grades)
• Google Drive API (if attachments stored)
• Gemini AI API (content analysis & feedback generation)
Architectural patterns & design principles
• Separation of concerns: clear divide between presentation (Next.js pages/components), API routing, business logic (lib/), and data models.
• Modular service functions: each assignment operation is its own route + service method.
• Third-party integration layer: encapsulated in lib/classroomGemini.js and lib/gemini.js.
• Scalability considerations: stateless API routes, MongoDB Atlas for persistence, caching & rate-limiting middleware.
Essential elements
• Component names (e.g., “/api/assignments/analyze Route Handler”)
• Data flow directions (e.g., “POST /api/assignments/analyze → lib/gemini.analyze()”)
• Tech labels (Next.js 14, TailwindCSS, Mongoose, Google APIs)
• Authentication flow (User → Google OAuth → NextAuth)
• Error handling / logging (lib/logger.js) and rate-limit (lib/rateLimit.js) middleware if desired