Technology Stack
Relevant source files
The following files were used as context for generating this wiki page:The PeP5 project is a comprehensive examination platform built on a modern, distributed architecture. It consists of a .NET-based web application backend, a secure Windows Presentation Foundation (WPF) desktop client for students, and integrations with third-party services for advanced features like code execution and AI-powered grading. The entire system is designed for cloud-native deployment on Google Cloud Platform (GCP).
This document outlines the core technologies, frameworks, and services that constitute the PeP5 ecosystem, from the backend services to the client application and deployment infrastructure.
High-Level Architecture
The system is composed of several key components that interact to deliver the examination experience. The student interacts with the secure WPF ExamApp, which communicates with the PeP5 backend API. The backend handles business logic, data persistence, and orchestrates calls to external services for code execution and AI evaluation.
The following diagram illustrates the main components and their interactions.
Backend (PeP5 Web Application)
The backend is an ASP.NET Core web application responsible for all business logic, data management, and API endpoints.
Sources: PeP5.csproj, Data/ApplicationDbContext.cs
Core Frameworks & Libraries
| Technology | Version/Type | Purpose | Source |
|---|---|---|---|
| .NET | 8.0 | Core application framework | PeP5.csproj:6 |
| ASP.NET Core | 8.0 | Web framework for building APIs | PeP5.csproj:11 |
| Entity Framework Core | 6.0.36 | Object-Relational Mapper (ORM) for database interaction | Migrations/20251130100008_InitialCreate.Designer.cs:13 |
| EF Core SQL Server Provider | 6.0.36 | Allows EF Core to connect to SQL Server | PeP5.csproj:14 |
| ASP.NET Core Identity | - | User authentication and authorization | Data/ApplicationDbContext.cs:7 |
Database
The application uses a SQL Server database, managed via Entity Framework Core. The database schema includes tables for traditional exams (multiple choice) and more complex programming exams.
Sources: Data/ApplicationDbContext.cs:10-33, Models/ProgrammingExamModels.cs
Database Schema (Programming Exams)
The diagram below shows the key entities and relationships for the programming exam feature.
External Service Integrations
The backend leverages external APIs to provide advanced functionality.
Code Execution (Piston API)
Student code is executed remotely and securely using the Piston API. The CodeExecutionService is responsible for this integration.
- Service:
CodeExecutionService - Endpoint:
https://emkc.org/api/v2/piston/execute
Sources: Services/CodeExecutionService.cs:140
The service supports multiple programming languages, which are mapped to Piston's specific language versions.
| Language Enum | Piston Language | Piston Version | Entry Point |
|---|---|---|---|
Java | java | 15.0.2 | Main.java |
Python | python | 3.10.0 | main.py |
CSharp | csharp | 6.12.0 | Program.cs |
CPlusPlus | c++ | 10.2.0 | main.cpp |
JavaScript | javascript | 18.15.0 | main.js |
TypeScript | typescript | 5.0.3 | main.ts |
C | c | 10.2.0 | main.c |
SQL | sqlite3 | 3.36.0 | script.sql |
Sources: Services/CodeExecutionService.cs:405-416, Models/ProgrammingExamModels.cs:79-91
The following diagram shows the sequence of executing a test case.
AI Code Evaluation (OpenAI)
The platform uses the OpenAI API for automated code evaluation and feedback generation. The OpenAIService handles all interactions with the OpenAI API.
- Service:
OpenAIService - Default Model:
gpt-4o-mini(configurable viaPlatformSettings)
Sources: Services/OpenAIService.cs:111, 513
The service can generate programming tasks and evaluate student code submissions. The evaluation flow sends the task instructions and student code to the AI model and parses the structured JSON response containing scores and feedback.
Frontend (PeP.ExamApp)
The student-facing application is a native Windows desktop application built with WPF, designed to provide a secure and controlled examination environment.
Sources: PeP.ExamApp/PeP.ExamApp.csproj
Core Frameworks & Libraries
| Technology | Version/Type | Purpose | Source |
|---|---|---|---|
| .NET | 8.0-windows | Core application framework for Windows | PeP.ExamApp/PeP.ExamApp.csproj:4 |
| WPF | - | UI framework for building the desktop app | PeP.ExamApp/PeP.ExamApp.csproj:5 |
| WebView2 | 1.0.2277.86 | Embeds web content (the exam interface) within the WPF app | PeP.ExamApp/PeP.ExamApp.csproj:12 |
The application includes several pages for the user flow, such as login, exam code entry, and anti-cheat checks, before launching the exam in a WebView2 control.
Sources: PeP.ExamApp/Pages/LoginPage.xaml.cs, PeP.ExamApp/Pages/ExamCodePage.xaml.cs, PeP.ExamApp/Pages/AntiCheatPage.xaml.cs, PeP.ExamApp/DesignTimeStubs.g.cs:113-117
Build, Deployment, and Infrastructure
The project is designed for deployment on Google Cloud Platform and uses a combination of PowerShell, Docker, and Inno Setup for its build and deployment pipeline.
Infrastructure
The application is deployed using the following GCP services:
| Service | Purpose | Configuration Notes |
|---|---|---|
| Cloud Run | Hosts the containerized ASP.NET Core backend. | Configured for auto-scaling from 0 to 10 instances. |
| Cloud SQL for SQL Server | Provides a managed SQL Server database instance. | Uses db-custom-1-3840 tier. |
| Cloud Storage | Stores and serves the PeP.ExamApp installer files publicly. | Bucket is configured for public read access. |
| Secret Manager | Securely stores the database connection string. | |
| Cloud Build | Builds the Docker image for the backend application. | Triggered by gcloud builds submit. |
| Artifact Registry | Stores the built Docker images. | A repository named pep-docker is used. |
Sources: DEPLOY-GCLOUD.md, deploy-gcloud.ps1
Build & Installation Pipeline
Backend Deployment
The backend is containerized using Docker and deployed to Cloud Run. The deploy-gcloud.ps1 script automates this process.
Sources: deploy-gcloud.ps1
Client Installer
The WPF client application is packaged into a .exe installer using Inno Setup. A PowerShell script (build-installer.ps1) automates the build process.
- Update Version: The script updates the version in the
.csprojfile. - Publish App: It runs
dotnet publishto create a self-contained application package. - Build Installer: It invokes the Inno Setup command-line compiler (
ISCC.exe) to build the finalSetup.exe. - Generate Checksum: A SHA256 checksum is created for the installer to be used by the auto-updater.
Sources: PeP.ExamApp/Installer/build-installer.ps1, PeP.ExamApp/Installer/README.md
The application also features an auto-update mechanism. The ExamAppController exposes an endpoint (GET /api/exam-app/update) that provides information about the latest version of the client application, which is read from configuration.
Sources: Controllers/ExamAppController.cs:29-47, PeP.ExamApp/Installer/README.md:65-77