An AI-powered rubric generation system for Snap! programming assignments using Angular 18 frontend and Node.js backend with RAG (Retrieval-Augmented Generation).
- Stakeholder overview of the database plan: docs/db-plan.md
snapclass-rubrics-generator/
βββ client/ # Angular 18 frontend (Production-ready)
β βββ src/
β β βββ app/
β β β βββ core/ # Core functionality (interceptors, guards)
β β β β βββ interceptors/
β β β β βββ error.interceptor.ts
β β β β βββ logging.interceptor.ts
β β β βββ shared/ # Shared resources (models, components)
β β β β βββ models/
β β β β βββ rubric.model.ts
β β β βββ services/ # API services
β β β β βββ rubric-api.service.ts
β β β βββ pages/ # Feature pages/components
β β β β βββ home/
β β β β βββ rubric-display/
β β β βββ app.component.*
β β β βββ app.config.ts
β β β βββ app.routes.ts
β β βββ environments/ # Environment configurations
β β β βββ environment.ts
β β β βββ environment.development.ts
β β βββ index.html
β βββ angular.json
β βββ package.json
β
βββ server/ # Node.js backend (Production-ready)
βββ src/
β βββ config/ # Configuration files
β β βββ env.config.js
β β βββ cors.config.js
β βββ controllers/ # Request handlers
β β βββ rubric.controller.js
β βββ services/ # Business logic
β β βββ ai.service.js
β β βββ rag.service.js
β β βββ prompt.service.js
β β βββ rubric.service.js
β βββ routes/ # API routes
β β βββ index.js
β β βββ rubric.routes.js
β βββ middleware/ # Express middleware
β β βββ error.middleware.js
β β βββ logger.middleware.js
β βββ app.js # Express app configuration
β βββ server.js # Server entry point
βββ data/ # Data files
β βββ all_assignments.json
βββ .env.example # Environment template
βββ SnapManual.pdf # RAG document (not in git)
βββ package.json
- AI-Powered Generation: Uses Llama 3.1 70B via Hugging Face for intelligent rubric creation
- RAG Pipeline: Retrieves relevant context from Snap! programming manual using vector search
- Row-Level Regeneration: Regenerate entire category objectives while preserving point scales
- Interactive Editing: Double-click cells to edit, with inline controls
- Tier-Aware AI: Understands scoring tiers and maintains consistency across objectives
- Responsive UI: Clean, modern interface with expandable instruction panels
- Production-Ready Architecture: Proper separation of concerns with MVC pattern
- Error Handling: Global error middleware with detailed logging
- Environment Configuration: Separate configs for development and production
- Node.js 18+ and npm
- Angular CLI 18
- Hugging Face API token (for Llama 3.1 70B access)
- Ollama (for local embeddings)
-
Navigate to server directory:
cd server -
Install dependencies:
npm install
-
Add the Snap! Manual PDF:
- Download or copy
SnapManual.pdfto theserver/directory - This file is required for the RAG pipeline but not included in git (it's large)
- Download or copy
-
Create
.envfile from template:cp .env.example .env
-
Edit
.envand add your Hugging Face token:HF_TOKEN=your_hugging_face_token_here PORT=3001 NODE_ENV=development
-
Start the server:
# Development mode (with auto-reload) npm run dev # Production mode npm start
Server runs on
http://localhost:3001
-
Navigate to client directory:
cd client -
Install dependencies:
npm install
-
Start development server:
npm start # or ng serveFrontend runs on
http://localhost:4200 -
Build for production:
npm run build # Output: dist/client-angular/
-
Generate Rubric:
- Open
http://localhost:4200 - Enter assignment title, description, and optional requirements
- Click "Generate Rubric"
- Open
-
Edit Objectives:
- Double-click any cell to edit text and points
- Click the β icon in the cell's bottom-right to edit
- Save changes with the checkmark button
-
Regenerate Row:
- Click the π button in any category (bottom-right corner)
- Enter optional instruction for AI guidance
- Click "Generate" to regenerate all objectives in that row
- Category and point values remain unchanged
-
Regenerate Entire Rubric:
- Click "Edit & Regenerate All" at the top
- Modify assignment details if needed
- Click "Regenerate Entire Rubric"
- Angular 18 - Standalone components architecture
- TypeScript - Type-safe development
- RxJS - Reactive data handling
- HTTP Interceptors - Error handling and logging
- Environment-based Configuration - Dev/Prod separation
- Node.js + Express - REST API server with MVC architecture
- LangChain - RAG pipeline orchestration
- Hugging Face Inference - Llama 3.1 70B Instruct
- Ollama Embeddings - Local vector embeddings
- MemoryVectorStore - In-memory vector search (904 chunks)
- PDFLoader - Snap! manual ingestion
- Layered Architecture - Controllers β Services β Models
-
Health Check
GET /api/health- Server health status
-
Rubric Generation
POST /api/rubric/generate- Generate complete rubric{ "title": "Assignment Title", "description": "Assignment description", "question": "Optional requirements" }
-
Rubric Regeneration
-
POST /api/rubric/regenerate-row- Regenerate entire category{ "title": "Assignment Title", "description": "Assignment description", "categoryName": "Category Name", "categoryReasoning": "Category purpose", "objectives": [...], "instruction": "Optional AI guidance" } -
POST /api/rubric/regenerate-cell- Regenerate single objective{ "title": "Assignment Title", "description": "Assignment description", "categoryName": "Category Name", "categoryReasoning": "Category purpose", "allObjectives": [...], "existingObjective": {...}, "instruction": "Optional AI guidance" }
-
# Required
HF_TOKEN=your_hugging_face_token_here
# Optional (with defaults)
PORT=3001
NODE_ENV=development
CORS_ORIGIN=*
# AI Model Configuration
AI_MODEL=meta-llama/Llama-3.1-70B-Instruct
MAX_TOKENS=2048
TEMPERATURE=0.7
# RAG Configuration
DOC_PATH=SnapManual.pdf
CHUNK_SIZE=500
CHUNK_OVERLAP=50
SEARCH_RESULTS=5Edit src/environments/environment.ts for production:
export const environment = {
production: true,
apiUrl: '/api', // Relative URL for production
apiTimeout: 60000,
};Edit src/environments/environment.development.ts for development:
export const environment = {
production: false,
apiUrl: 'http://localhost:3001/api',
apiTimeout: 60000,
};- Set environment variables on your server
- Install dependencies:
npm install --production - Start server:
npm start - Ensure
SnapManual.pdfis in the server directory
- Build for production:
npm run build - Deploy
dist/client-angular/folder to your web server - Configure server to serve
index.htmlfor all routes (SPA routing) - Update
environment.tswith production API URL
Consider containerizing both frontend and backend for easier deployment.
- Backend initializes vector store at startup (904 chunks from Snap! manual)
- Point values are preserved during regeneration to maintain table alignment
- Objectives sorted descending by points (highest quality β lowest)
- HTTP interceptors provide automatic error handling and request/response logging
- Modular service architecture allows easy testing and maintenance
- Frontend:
4200(development) - Backend:
3001(configurable via .env)
npm start- Start production servernpm run dev- Start development server with auto-reload
npm start- Start development servernpm run build- Build for productionnpm test- Run unit testsng serve- Alternative to start dev serverng build --configuration production- Production build
- Controllers: Handle HTTP requests/responses
- Services: Business logic and orchestration
- Config: Centralized configuration management
- Middleware: Cross-cutting concerns (logging, errors)
- Routes: API endpoint definitions
- Core Module: Singleton services and app-wide functionality
- Shared Module: Reusable components and models
- Feature Modules: Lazy-loaded page components
- Interceptors: HTTP request/response transformation
- Environment Files: Configuration per environment
MIT
[Your Name/Team]