ExamGuard is a secure online examination system built with Next.js, Firebase, and Genkit AI. It aims to ensure academic integrity through real-time monitoring and AI-based proctoring. The system allows administrators to create and schedule exams, whitelist users, and monitor test-takers for suspicious activities.
MAX_VIOLATIONS = 3
).git clone <repository-url>
cd examguard-portal
npm install
# or
yarn install
us-central
).</>
). Register your app.firebaseConfig
object..env
file in the root of the project..env
file:
NEXT_PUBLIC_FIREBASE_API_KEY="YOUR_API_KEY"
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN="YOUR_AUTH_DOMAIN"
NEXT_PUBLIC_FIREBASE_PROJECT_ID="YOUR_PROJECT_ID"
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET="YOUR_STORAGE_BUCKET"
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID="YOUR_MESSAGING_SENDER_ID"
NEXT_PUBLIC_FIREBASE_APP_ID="YOUR_APP_ID"
# For Genkit AI (Google AI Studio / Vertex AI)
# Create an API key in Google AI Studio: https://aistudio.google.com/app/apikey
GOOGLE_API_KEY="YOUR_GOOGLE_AI_API_KEY"
"YOUR_..."
with your actual Firebase and Google AI credentials.activityLogs
collection:
adminId (asc), timestamp (desc)
adminId (asc), examId (asc), activityType (asc)
(for exam history participants)disqualifiedUsers
collection:
adminId (asc)
uid (asc), examId (asc), adminId (asc)
(for checking if a user is already disqualified for an exam by an admin)liveSnapshots
collection:
adminId (asc), updatedAt (desc)
scheduledExams
collection:
adminId (asc), scheduledTime (desc)
whitelistedUsers
collection:
adminId (asc)
email (asc), adminId (asc)
(used in admin portal for checking if a user is already whitelisted by a specific admin)email (asc)
(used in user portal to find which admins have whitelisted the user)The application will show console warnings with direct links to create missing indexes if they are encountered during runtime. Follow these links or manually create them in the Firebase console under Firestore Database -> Indexes.
npm run genkit:dev
# or
# yarn genkit:dev
This will typically start the Genkit server on http://localhost:3400
.
npm run dev
# or
# yarn dev
This will start the Next.js application, usually on http://localhost:9002
.
http://localhost:9002
.npm run dev
: Starts the Next.js development server (usually on port 9002).npm run genkit:dev
: Starts the Genkit development server.npm run genkit:watch
: Starts the Genkit development server with hot-reloading for AI flow changes.npm run build
: Builds the application for production.npm run start
: Starts the production server.npm run lint
: Lints the codebase using Next.js’s built-in ESLint configuration.npm run typecheck
: Runs TypeScript type checking.A brief overview of the important directories:
examguard-portal/
├── src/
│ ├── ai/ # Genkit AI flows and configuration
│ │ ├── flows/ # Specific AI flows (e.g., behavior analysis)
│ │ ├── dev.ts # Genkit development server entry point
│ │ └── genkit.ts # Genkit AI instance initialization
│ ├── app/ # Next.js App Router: pages, layouts, etc.
│ │ ├── admin/ # Admin specific pages (login, register, dashboard)
│ │ ├── (user)/ # User specific pages (exam page, login, register) - using route groups
│ │ ├── globals.css # Global styles and ShadCN theme variables
│ │ ├── layout.tsx # Root layout
│ │ ├── page.tsx # Main exam page for users
│ │ ├── questions-data.ts # Sample exam questions
│ │ └── types.ts # TypeScript type definitions
│ ├── components/ # Reusable UI components
│ │ ├── ui/ # ShadCN UI components
│ │ ├── auth-guard.tsx # Component for protecting routes based on auth state and role
│ │ └── logo.tsx # Logo component
│ ├── contexts/ # React Context API providers
│ │ └── AuthContext.tsx # Authentication context
│ ├── hooks/ # Custom React hooks
│ │ ├── useAuth.ts # Hook to access AuthContext
│ │ ├── use-mobile.tsx # Hook to detect mobile viewports
│ │ └── use-toast.ts # Hook for displaying toasts
│ ├── lib/ # Utility functions and libraries
│ │ ├── firebase.ts # Firebase SDK initialization
│ │ └── utils.ts # General utility functions (e.g., `cn` for classnames)
├── public/ # Static assets
├── .env # Environment variables (gitignored)
├── components.json # ShadCN UI configuration
├── next.config.ts # Next.js configuration
├── package.json
├── README.md # This file
└── tsconfig.json # TypeScript configuration
Contributions are welcome! Please follow these steps:
git checkout -b feature/your-feature-name
).git commit -m 'Add some feature'
).git push origin feature/your-feature-name
).Please ensure your code adheres to the project’s coding style and guidelines.
This project is licensed under the MIT License. See the LICENSE
file for details (if applicable, create one if needed).
(Currently, no LICENSE file exists, consider adding one like MIT or Apache 2.0 if making public)