An enterprise-grade, full-stack College Programming Laboratory Management & Code Execution Platform designed specifically for Chaitanya Bharathi Institute of Technology (CBIT).
Built with Next.js (App Router, TypeScript), Tailwind CSS, Prisma ORM, Monaco Editor, and a Native Multi-Language Compiler Engine (C, C++, Java, JavaScript).
- Project Overview
- Folder Structure
- Software Prerequisites
- Installation Guide
- Environment Variables
- Database Setup & Seeding
- Running the Application
- Online Compiler Engine Setup
- Troubleshooting & Common Fixes
- Production Deployment Guide
The CBIT Laboratory Management Platform provides a role-based environment for managing computer science laboratory courses, student roll number allocations, assessment submissions, and automated code execution.
- Faculty Management: Create lecturer accounts (
username@cbit.in), edit details, set student capacity limits, delete faculty, and reset passwords. - Roll Number Allocation: Define authorized student Roll Number ranges (e.g.,
160125000001to160125000120) and assign them to specific lecturers. - Registered Students Inspection: View all registered students across departments, automatically sorted by Roll Number in ascending order.
- System Metrics & Evaluation Reports: View total submissions, grading completion rates, and performance statistics across faculty members.
- Year & Section Management: Create, rename, edit, and delete sections for 1st, 2nd, 3rd, and 4th-year students (e.g.,
CSE-1,CSE-2,CIC-1). - Student View: View enrolled section students, always sorted by Roll Number ascending.
- Lab Assessment Authoring: Create lab tasks, write problem statements, set due dates, and specify input/output constraints.
- Submission Viewer & Code Runner: Inspect multi-file student code submissions, execute student code live, and download source files.
- Evaluation & Grading: Award marks (0β100), write feedback remarks, set evaluation status (
APPROVED,REJECTED,NEEDS_CORRECTION), reopen workspaces for student corrections, and toggle instant grade publishing.
- Controlled Self-Registration: Registration requires a valid 12-digit
1601XXXXXXXXRoll Number within an Admin-authorized range. Prevents duplicate registrations and filters out full faculty members. - Monaco Online IDE: Tabbed multi-file editor with syntax highlighting for C (
.c), C++ (.cpp), Java (.java), and JavaScript (.js). - Anti-Cheat Protection: Suppresses copy, paste, cut, context menu (right click), keyboard shortcuts (
Ctrl+C,Ctrl+V,Ctrl+X,Shift+Insert), and drag-and-drop text transfers. - Single Submission Locking: Workspaces lock read-only upon submission unless reopened by the lecturer.
- Real-Time Grade View: Access published marks, evaluation status, and faculty remarks immediately.
LabSubmit/
βββ Dockerfile # Production Docker container definition
βββ docker-compose.yml # Production Docker Compose stack
βββ package.json # Project dependencies & scripts
βββ tsconfig.json # TypeScript compiler configuration
βββ tailwind.config.js # Custom theme tokens (Olive Green & Blue)
βββ postcss.config.js # PostCSS configuration
βββ next.config.mjs # Next.js build setup
βββ .env # Environment variables (Database & JWT)
βββ README.md # Complete production documentation
βββ prisma/
β βββ schema.prisma # Relational database schema
β βββ seed.ts # Database initialization script
βββ public/
β βββ cbit-logo.png # Official CBIT logo asset
βββ src/
βββ app/
β βββ layout.tsx # Root HTML layout & AppProvider wrapper
β βββ page.tsx # Institutional landing page
β βββ globals.css # Global styles & theme CSS variables
β βββ login/
β β βββ page.tsx # Unified login portal (Student/Lecturer/Admin)
β βββ register/
β β βββ page.tsx # Student self-registration page
β βββ admin/
β β βββ page.tsx # Administrator control panel
β βββ lecturer/
β β βββ page.tsx # Faculty lecturer workspace & grading drawer
β βββ student/
β β βββ page.tsx # Student dashboard & lab status
β β βββ lab/[id]/
β β βββ page.tsx # Online IDE lab assessment page
β βββ api/
β βββ admin/ # Admin APIs (lecturers, ranges, stats, students)
β βββ auth/ # Auth APIs (login, register, me, available lecturers)
β βββ compile/run/ # Real multi-language execution API
β βββ lecturer/ # Lecturer APIs (sections, labs, submissions, evaluate)
β βββ profile/ # Profile & theme persistence APIs
β βββ student/ # Student APIs (labs, workspace, grades)
βββ components/
β βββ Navbar.tsx # CBIT Header with theme toggle & user badge
β βββ OnlineIDE.tsx # Monaco Code Editor & Terminal output panel
β βββ AntiCheatWrapper.tsx # Anti-cheat event interceptor
β βββ ProfileModal.tsx # Account settings & password change modal
βββ context/
β βββ AppContext.tsx # Global authentication & theme state manager
βββ lib/
βββ db.ts # Prisma Client singleton
βββ jwt.ts # JWT token signing & verification
βββ auth.ts # Role-based API route guard middleware
βββ compiler.ts # Native C/C++/Java/JS code execution engine
Before installing and running the application, ensure the following software tools are installed on your machine:
| Software | Required Version | Purpose | Command to Check |
|---|---|---|---|
| Node.js | v18.0.0+ or v20.0.0+ | JavaScript runtime environment | node -v |
| npm | v9.0.0+ or v10.0.0+ | Node package manager | npm -v |
| GCC | Any recent version | C compiler (gcc) |
gcc --version |
| G++ | Any recent version | C++ compiler (g++) |
g++ --version |
| Java JDK | OpenJDK 11+ or 17+ | Java compiler (javac) & runtime (java) |
javac -version |
| PostgreSQL (Optional) | v14+ or v15+ | Relational database (SQLite used by default for zero setup) | psql --version |
| Docker (Optional) | v20+ | Containerized production deployment | docker --version |
Follow these commands step-by-step to set up the codebase on your machine.
cd /path/to/LabSubmit
Run the package installation command:
npm install
Create a file named .env in the root directory of the project (same directory as package.json).
DATABASE_URL="postgresql://username:password@localhost:5432/labsubmit_dev?schema=public"
JWT_SECRET="<paste the output of: openssl rand -base64 48>"
NODE_ENV="development"
PORT=3000
DATABASE_URL: PostgreSQL connection string for Prisma. Required β the project is PostgreSQL-only (SQLite is not supported).JWT_SECRET: Secret used to sign and verify login tokens. Required. Generate a random value (openssl rand -base64 48); never reuse an example value. The server refuses to start if it is missing or set to the old published default, and warns if it is shorter than 32 characters. Must be identical on the Vercel and Railway hosts.NODE_ENV: Application environment state (developmentorproduction).PORT: Network port on which the Next.js server listens (default:3000).
The platform uses Prisma ORM. Follow these steps to synchronize the database schema and initialize the System Administrator account.
Synchronize the Prisma DSL schema with the database file:
npx prisma db push
Build the type-safe Prisma client:
npx prisma generate
Initialize the system with the single System Administrator account:
npm run db:seed
Important
Initial System Administrator Credentials:
- Email:
admin@cbit.in - Password:
admin@123
The database is initialized cleanly without dummy lecturers or students. Log in as Admin to create lecturers, roll number ranges, and sections.
To start the local development server with hot-reloading:
npm run dev
- Open your browser and navigate to:
http://localhost:3000 - Terminal output will confirm:
β² Next.js 14.2.10 - Local: http://localhost:3000
To test the optimized production build locally:
# Build the production bundle
npm run build
# Start the production server
npm start
The platform features a native multi-language code execution engine. It compiles and runs student code directly using compilers installed on your operating system.
-
.cextension$\rightarrow$ gcc -O2 source.c -o a.out -lm -
.cpp/.ccextension$\rightarrow$ g++ -O2 source.cpp -o a.out -std=c++17 -
.javaextension$\rightarrow$ javac Main.javafollowed byjava -cp . Main -
.jsextension$\rightarrow$ node main.js
sudo apt update
sudo apt install -y build-essential openjdk-17-jdk nodejs
# Install Xcode Command Line Tools for gcc and g++
xcode-select --install
# Install Java JDK via Homebrew if needed
brew install openjdk
- Install MinGW-w64 (or GCC via MSYS2) and add its
bindirectory to your System PATH environment variable. - Install OpenJDK (version 17+) and add
javac/javato System PATH. - Install Node.js (v20+).
- Executed programs run in isolated temporary workspace directories (
/tmp/labsubmit_exec_...). - Processes are capped at a 5-second execution timeout (
SIGKILL) to kill infinite loops. - Temporary files are automatically purged after execution.
Cause: Another process or previous dev server is using port 3000.
Solution:
- On Linux/macOS: Run
lsof -i :3000and kill the PID withkill -9 <PID>. - Or specify a different port in
.env:PORT=3001or runPORT=3001 npm run dev.
Cause: Database file is corrupted or opened by another process.
Solution: Reset and re-seed the database:
npx prisma db push --force-reset
npm run db:seed
Cause: C, C++, or Java compilers are not installed or not in your system's PATH.
Solution: Install GCC, G++, and Java OpenJDK as outlined in Section 8 and ensure their binary directories are listed in system PATH.
Cause: Dependencies were not fully installed.
Solution: Clean node_modules and re-install:
rm -rf node_modules package-lock.json
npm install
Cause: .env is missing, not in the project root, has no JWT_SECRET, or uses the old published example secret.
Solution: Ensure .env exists next to package.json with JWT_SECRET set to a fresh random value (openssl rand -base64 48). Changing the secret logs every user out once; it does not change any password.
The repository includes a production Dockerfile and docker-compose.yml.
# 1. Build and start the container in detached mode
docker-compose up -d --build
# 2. Push database schema inside the container
docker-compose exec app npx prisma db push
# 3. Seed initial Admin account inside the container
docker-compose exec app npm run db:seed
# 4. Check container status
docker-compose ps
The application will be accessible at http://your-server-ip:3000.
Developed for Chaitanya Bharathi Institute of Technology (CBIT). All rights reserved.