Pago Quiz Engine
Pago Quiz is a standalone NestJS service built to handle quiz and assessment logic across multiple TecSolPro platforms. It exposes a GraphQL API via Apollo Server, uses TypeORM with MySQL for data persistence, and implements DataLoader to prevent N+1 query problems in nested GraphQL queries. JWT authentication via Passport guards protected resolvers. GraphQL subscriptions handle real-time quiz events. The code-first schema approach means the schema.gql file is auto-generated from TypeScript decorators, keeping the source of truth in the code. We also added Swagger for REST documentation alongside the GraphQL endpoint.
The Result
A reusable, high-performance quiz microservice consumed by multiple TecSolPro platforms through a single GraphQL API.
Tech Stack
4
Modules
8
Technologies
6
Highlights
Applications in This Project.
This project is built as 1 interconnected application, each with a distinct responsibility.
pago-quize
NestJS v11 / GraphQLQuiz & assessment microservice
What It Does.
Code-first GraphQL schema with Apollo Server v5
DataLoader for N+1 query prevention
GraphQL subscriptions for real-time quiz events
How It's Built.
Frontend
Backend / API
Database & Cache
Services & Infra
Under the Hood.
Every module shipped in Pago Quiz Engine — what it does and the features it covers.
Auth Module
JWT + Passport guards protecting all GraphQL mutations and sensitive queries.
What's Included
- GraphQL mutations: login, register
- JWT strategy (jwt.strategy.ts)
- JwtAuthGuard protecting resolvers
- bcryptjs password hashing
- class-validator DTO validation
Quiz Management
Create, update, publish, and score quizzes with multiple question types and time limits.
What's Included
- Quiz CRUD (resolver + service)
- Multiple question types
- Scoring rules configuration
- Time limit settings
- Quiz publish/draft workflow
Assessment & Scoring
Track user attempts, calculate scores, store results with per-question breakdowns, and emit real-time events.
What's Included
- User attempt tracking
- Per-question score breakdown
- Score calculation service
- GraphQL subscriptions for real-time results
- DataLoader for N+1 prevention on nested queries
Users Module
User entity management with TypeORM repository pattern and Swagger + GraphQL dual documentation.
What's Included
- Users resolver + service + repository
- TypeORM user entity
- GraphQL queries/mutations for user CRUD
- Swagger REST docs alongside GraphQL
- NestJS DI module isolation
The Interesting Parts.
Key architectural decisions, patterns, and technical details worth knowing.
Code-first GraphQL schema: schema.gql auto-generated from TypeScript decorators — always in sync with code
DataLoader prevents N+1 query problems in nested GraphQL resolvers — critical for quiz+question+option chains
GraphQL subscriptions via subscriptions-transport-ws deliver real-time quiz events to connected clients
NestJS modular architecture: auth, users, quizzes, questions each in isolated modules with DI
Swagger REST docs exposed alongside the GraphQL endpoint for API consumers who prefer REST
bcryptjs password hashing + class-validator DTO validation on every resolver input
Core Models & Tables.
The primary database models that power Pago Quiz Engine.
User (TypeORM)
Auth user entity
Quiz
Quiz with scoring rules
Question
Quiz question
Option
Question option/answer
Attempt
User quiz attempt
Score
Per-question score record
Want Something Like This?
We've built systems like this before — we know the pitfalls, the patterns that work, and how to scope it correctly from day one.