A comprehensive digital examination platform for NSW HSC Chemistry with AI-powered grading capabilities.
- Interactive Exam Interface: Quarto/learnr-based frontend with chemical equation editing
- AI-Powered Grading: Dual AI provider support (OpenAI o1-mini + Google Gemini 2.5 Pro)
- Chemical Structure Drawing: JSME editor integration for drawing molecular structures
- Real-time LaTeX Preview: Live rendering of chemical equations with mhchem
- Comprehensive Feedback: Detailed scoring and improvement suggestions
- PDF Report Generation: Professional exam results with downloadable reports
- Scalable Infrastructure: Rust backend with SurrealDB and Fly.io deployment
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Quarto/learnr │ │ Rust Backend │ │ AI Services │
│ Frontend │───▶│ REST API │───▶│ OpenAI/Gemini │
│ │ │ │ │ │
│ - Exam Interface│ │ - Submission API │ │ - Auto Grading │
│ - LaTeX Preview │ │ - File Storage │ │ - Feedback Gen │
│ - Chem Drawing │ │ - SurrealDB │ │ │
└─────────────────┘ └──────────────────┘ └─────────────────┘
- Rust 1.75+
- Node.js 18+
- Quarto CLI
- OpenAI API Key
- Google Gemini API Key
-
Clone the repository:
git clone https://github.com/stem-teacher/grader.git cd grader -
Setup backend:
cd backend cp .env.example .env # Edit .env with your API keys cargo run
-
Setup frontend:
cd frontend npm install quarto preview chemistry-exam.qmd --port 3000
- Click "Code" → "Create codespace on main"
- Wait for setup to complete
- Add your API keys to
backend/.env - Run the development servers
grader/
├── frontend/ # Quarto/R frontend
│ ├── chemistry-exam.qmd # Main exam document
│ ├── _quarto.yml # Quarto configuration
│ └── assets/ # CSS, JS, and images
├── backend/ # Rust API server
│ ├── src/
│ │ ├── handlers/ # HTTP request handlers
│ │ ├── services/ # Business logic
│ │ └── models/ # Data structures
│ └── Cargo.toml
├── marking-guidelines/ # AI grading prompts
├── deployment/ # Docker and Fly.io config
└── .github/workflows/ # CI/CD automation
# Backend (.env)
OPENAI_API_KEY=your-openai-key
GEMINI_API_KEY=your-gemini-key
DATABASE_URL=memory # or /data/surrealdb for production
STORAGE_PATH=./storageThe system uses a dual-provider approach:
- Primary: OpenAI o1-mini for detailed reasoning
- Fallback: Google Gemini 2.5 Pro for reliability
Marking guidelines are loaded from marking-guidelines/review-prompt.md.
-
Install Fly.io CLI:
curl -L https://fly.io/install.sh | sh -
Deploy:
flyctl auth login flyctl apps create hsc-chemistry-grader flyctl volumes create hsc_chemistry_data --size 10 flyctl secrets set OPENAI_API_KEY="your-key" flyctl secrets set GEMINI_API_KEY="your-key" flyctl deploy
Automatic deployment triggers on push to main:
- Runs tests
- Builds and deploys to Fly.io
- Creates release tags
Configured for 200 concurrent users:
- Compute: 2 CPU cores, 2GB RAM
- Database: SurrealDB with RocksDB persistence
- Storage: 10GB volume + optional S3 replication
- Monitoring: Health checks and metrics
- API keys stored as Fly.io secrets
- HTTPS enforced for all traffic
- Input validation on all endpoints
- CORS configured for frontend domain
- Rate limiting to prevent abuse
# Backend tests
cd backend && cargo test
# Frontend build test
cd frontend && npm run build- Students: Access exam via submission code
- Chemical Equations: Use LaTeX notation with mhchem
- Structure Drawing: JSME editor with SMILES export
- Submission: Automatic grading begins on submit
- Results: View in browser or download PDF
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests where appropriate
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: Support Email
- Live Demo: [Coming Soon]
- Documentation: Wiki
- API Docs: OpenAPI Spec
Built with ❤️ for NSW HSC Chemistry education.