Chuypang AI System Architecture

Layered Architecture Overview

1. Frontend Layer

Client Web (Next.js)

Multi-role interface for Candidate, Coach, Headhunter, and HR with form flows, diagnosis display, AI output rendering, and gamification UI

Next.jsTailwind CSSi18nextSSR + CSR

CMS Admin Panel (Next.js)

Manages program content, AI feedback catalog, and expert matching with access control via Cognito Admin roles

Next.jsAWS CognitoAdmin Panel

2. Backend API Layer (NestJS)

Central Controller

Handles routing logic, data validation, DB access, and role-based access control. Manages BullMQ async queues for AI job dispatch

NestJSTypeScriptJWTRedis + BullMQ

Data & Storage

PostgreSQL/RDS for persistent data, AWS S3 for file storage, and AWS Cognito for authentication

PostgreSQLAWS S3AWS Cognito

3. AI Orchestrator Layer (Node.js)

Dedicated Express Service

Receives structured JSON from backend via queue, routes to prompt logic, applies Zod validation, and selects appropriate AI agent

Node.jsExpressZod ValidationJSON Processing

Directory Structure

/orchestrator
├── prompts/
│ ├── phase1/
│ ├── phase2/
│ └── shared/
├── validators/
├── routers/
└── services/
PromptsValidatorsRoutersServices

4. AI Agent Layer (External LLMs)

OpenAI GPT-4o

Default model for structured output and core features with high accuracy and performance

GPT-4oDefault ModelStructured Output

OpenAI GPT-3.5 Turbo

Used for low-cost, fast inference tasks with quick response times

GPT-3.5 TurboLow-costFast Inference

Grok (xAI)

Optional integration for alternative response models and future flexibility

GrokxAIAlternative Model

5. Infrastructure & Monitoring

Core Infrastructure

Redis for job queue buffer, PostgreSQL for data storage, AWS S3/EFS for documents, and AWS Cognito for authentication

RedisPostgreSQLAWS S3AWS Cognito

Monitoring & Security

Cloudflare/ALB for routing and security, GPT token usage tracking, and failed schema validation auditing

CloudflareALBToken TrackingAudit Logs

End-to-End Flow Summary

1. Frontend Request

Client or CMS sends user request (e.g., resume diagnosis)

2. Backend Processing

API validates request and sends job to Redis queue

3. AI Orchestration

Orchestrator consumes job, loads prompt, and validates input

4. AI Processing

Calls appropriate AI agent and validates output via Zod

5. Response Delivery

Output sent to backend → stored in DB or returned to frontend

6. User Display

Frontend displays result with full formatting and feedback