A web-based platform for AP Java students to write, run, and submit code with AI tutoring assistance and automated grading powered by Claude AI.
- No Login Required: Students simply enter their name to get started
- Markdown Assignment Prompts: Teachers can use markdown formatting (bold, lists, code blocks) in assignment instructions
- Advanced Code Editor: CodeMirror-powered editor with:
- Syntax highlighting for Java (keywords, strings, comments, etc.)
- Auto-indent and smart formatting
- Line numbers
- Bracket matching and auto-closing
- Maximized editor space (600px height)
- Font Size Control: Choose between Small (A-), Medium (A), and Large (A+) text sizes
- Dark Mode: Toggle between light and dark themes (preference saved)
- Interactive Coding: Write and run Java code directly in the browser with any class name
- Interactive Console: Real-time console with Scanner support - type input directly when program prompts
- WebSocket-based execution: Live output streaming as the program runs
- Flexible Class Names: System automatically detects and uses the student's class name
- AI Tutor: Ask questions and receive markdown-formatted hints (not direct answers) from Claude
- Brief Feedback Mode: Toggle for shorter, more concise AI responses (2-3 sentences)
- Smart Context: AI tutor automatically receives your code and console output for better assistance
- Maximized Chat Area: Larger chat space (600px height, 500px width) for better readability
- Instant Feedback: Submit code and receive immediate grading and detailed feedback
- Assignment Management: View and work on teacher-assigned problems
- Dark Mode: Toggle between light and dark themes (preference saved)
- Assignment Management: Create, edit, and delete coding assignments with prompts and detailed rubrics
- Edit Assignments: Modify assignment title, prompt, and rubric after creation
- Delete Assignments: Remove assignments and all related submissions/chat history with confirmation
- API Key Management: Securely configure your Claude API key
- Submission Viewing: View and review all student submissions with full code display
- AI-Powered Grading: Automatically grade all submissions or individual ones using Claude
- Student Roster: Track all registered students and their progress
- Class Overview: View grades and feedback across the entire class
- Question Logging: All student questions are logged to
studentQuestions.txtwith full context (code, output, errors) - Questions Tab: View all student questions directly in the dashboard with their code context
- Enhanced Submission Details: Click any submission to view student code, grade, and detailed feedback in a modal
- Black & Gold Theme: Student interface uses Purdue University's black and gold color scheme
- Node.js (v14 or higher)
- Java Development Kit (JDK) installed on the server (for code execution)
- Claude API Key from Anthropic
For detailed step-by-step instructions to replicate this project on a new computer, see replicateProject.txt.
Quick Start:
-
Clone or download this repository
-
Install dependencies:
npm install
-
Verify Java is installed:
java -version javac -version
If Java is not installed, download and install the JDK from Oracle or use OpenJDK.
-
Start the server:
npm start
For development with auto-restart:
npm run dev
-
Access the application:
- Open your browser and navigate to
http://localhost:3000 - Choose between Student Portal or Teacher Dashboard
- Open your browser and navigate to
- Go to the Teacher Dashboard (
http://localhost:3000/teacher.html) - Enter the teacher password: SMCSChief
- Navigate to the Settings tab
- Enter your Claude API key (get one from Anthropic Console)
- Click Save API Key
- Go to the Assignments tab and create your first assignment
- Navigate to the Student Portal (
http://localhost:3000/student.html) - Enter your name (no password needed)
- Select an assignment from the dropdown
- Write your Java code in the editor (starts with a Hello World template)
- Note: You can use any class name - the system automatically detects it!
- Click Run Code to test your solution
- Use the AI Tutor chat for hints and guidance
- The tutor automatically sees your code and any errors you encountered
- Click Submit for Grading when ready
- Receive instant feedback and grade
- Go to Teacher Dashboard > Assignments tab
- Fill in:
- Title: Name of the assignment
- Prompt: What students need to accomplish
- Rubric: Detailed grading criteria
- Click Create Assignment
Option 1: Grade All Submissions
- Go to the Assignments tab
- Click Grade All Submissions for an assignment
- Claude will automatically grade all ungraded submissions
Option 2: View Individual Submissions
- Go to the Submissions tab
- Filter by assignment if needed
- View individual submissions and their grades/feedback
AA Java Student Server/
├── server.js # Express server with all API endpoints
├── database.js # SQLite database initialization
├── package.json # Node.js dependencies
├── apjava.db # SQLite database (created on first run)
├── studentQuestions.txt # Log of all student questions with context (created on first question)
├── public/ # Frontend files
│ ├── index.html # Landing page
│ ├── student.html # Student portal interface
│ └── teacher.html # Teacher dashboard interface
├── startHere.txt # Project requirements and notes
├── replicateProject.txt # Step-by-step guide to replicate this project
└── README.md # This file
POST /api/students- Register a new studentGET /api/students- Get all studentsGET /api/students/:id- Get student by ID
POST /api/assignments- Create new assignmentGET /api/assignments- Get all assignmentsGET /api/assignments/:id- Get assignment by IDPUT /api/assignments/:id- Update an assignmentDELETE /api/assignments/:id- Delete an assignment and all related data
POST /api/run-code- Compile and run Java code
POST /api/chat- Send message to AI tutor
POST /api/submit- Submit code for gradingGET /api/submissions/assignment/:assignmentId- Get submissions for an assignmentGET /api/submissions/student/:studentId- Get submissions for a studentGET /api/submissions/:id- Get single submission with full details
POST /api/grade-all/:assignmentId- Grade all ungraded submissions for an assignment
POST /api/settings/api-key- Save Claude API keyGET /api/settings/api-key-status- Check if API key is configured
GET /api/student-questions- Get all student questions from log file with parsed context
POST /api/teacher/login- Teacher login with password validationGET /api/teacher/check-auth- Check if teacher is authenticatedPOST /api/teacher/logout- Destroy teacher session
Current Implementation (Development):
- Java code runs directly on the server (suitable for trusted educational environments)
- Teacher dashboard protected with server-side password validation
- Password: SMCSChief (stored server-side, never sent to browser)
- Session-based authentication using express-session
- Session cookies are httpOnly to prevent XSS attacks
- API key stored in SQLite database
- No authentication required for students
For Production Use, Consider:
- Docker containers for isolated code execution
- User authentication and authorization
- Rate limiting for API calls
- Encrypted storage for API keys
- HTTPS/SSL certificates
- Input validation and sanitization
Every time a student asks a question to the AI tutor, the system automatically logs it to studentQuestions.txt in the project root directory. Each log entry includes:
- Timestamp: When the question was asked
- Student Name and ID: Who asked the question
- Assignment Title and ID: What they were working on
- Question: The actual question text
- Code: Their current code (if available)
- Output: Console output from their last run (if available)
- Error: Any error messages (if available)
Example log entry:
================================================================================
Timestamp: 2025-11-06T21:30:45.123Z
Student: John Smith (ID: 5)
Assignment: Arrays and Loops Practice (ID: 2)
Question: Why is my loop not stopping?
Code:
public class Main {
public static void main(String[] args) {
for (int i = 0; i < 10; i--) {
System.out.println(i);
}
}
}
================================================================================
This log file helps teachers:
- Understand common student difficulties
- Identify patterns in questions
- Review what students are struggling with
- Improve future assignments based on question trends
Note: The file is automatically created when the first question is asked and is excluded from git by default.
- students: Student information (id, name, created_at)
- assignments: Assignment details (id, title, prompt, rubric, created_at)
- submissions: Code submissions (id, student_id, assignment_id, code, feedback, grade, submitted_at)
- chat_history: AI tutor conversations (id, student_id, assignment_id, role, message, created_at)
- settings: Application settings (key, value) - stores API key
- Ensure JDK is installed:
java -versionandjavac -version - Check that Java is in your system PATH
- Verify the student's code has a public class with a main method
- Verify Claude API key is configured in Teacher Dashboard > Settings
- Check that the API key is valid in the Anthropic Console
- Ensure you have API credits available
- Delete
apjava.dband restart the server to recreate the database - Check file permissions in the project directory
Potential features to add:
User Experience:
- Keyboard shortcuts (Ctrl+S to save, custom keybindings)
- Auto-save functionality
- Mobile-responsive design improvements
- Font size adjustment in code editor
- Additional CodeMirror themes and customization options
- Code folding for large programs
Security & Infrastructure:
- User authentication for students
- Docker-based code execution for better security
- Rate limiting and input validation
Features:
- Support for multiple programming languages
- Test case validation with hidden tests
- Code plagiarism detection
- Assignment deadlines and late submission handling
- Code version history
- Export grades to CSV
- Collaborative coding features
Analytics:
- Detailed analytics and progress tracking
- Student performance dashboards
- Common error analysis from question logs
- Time tracking per assignment
MIT License
For issues or questions, please create an issue in the project repository.