FLYER · Ecosystem PRD · v1.0

🗺️ Kiến trúc & hệ sinh thái FLYER

Toàn cảnh 6 nền tảng công khai (flyer.vn, flyer.us, exam.flyer.us, teacher.flyer.us, ieltsguru.ai, teado.ai) + shell học Study nhúng trong exam + các tool nội bộ (roadmap, agent, meeting, ketoan…). Tài liệu tham chiếu duy nhất về ai đang chạy trên gì, dữ liệu chảy đi đâu, deploy ra sao, khi có sự cố tìm ai — cho toàn team Product và ai cần một điểm nhìn tổng thể về hệ thống.

Phiên bản
1.0
Ngày
26/08/2026
Owner
Nam (PM) · Tùng (Product)
Scope
Public + internal ecosystem
Nguồn
Quét codebase branch main/dev + read-replica prod DB + PRD nội bộ hiện có

1Ecosystem map — bức tranh 1 phút

FLYER có hai "mặt tiền" chính chia theo địa lý và mục đích:

🇻🇳 Thị trường Việt Nam

  • flyer.vn — landing sales-driven cho HS/PH VN
  • exam.flyer.us — ứng dụng học chính (Phòng thi ảo, Cambridge/IELTS)
  • teacher.flyer.us — GV / trung tâm quản lý
  • ieltsguru.ai — sản phẩm luyện IELTS chuyên sâu

🌎 Thị trường quốc tế

  • flyer.us — marketing landing EN + ES (LatAm)
  • teado.ai — thương hiệu AI-first cho GV LatAm (Colombia, Mexico, Peru…)
  • teacher.teado.ai — ứng dụng teacher rebrand (chung backend)

Sơ đồ khối

┌──────────────────────────────────────────────────────────────────────┐
│                       CÁC "MẶT TIỀN" (frontend)                      │
├──────────────────────────────────────────────────────────────────────┤
│ Marketing / Landing                                                  │
│   • flyer.vn        (LadiPage clone, HTML tĩnh, VI)                  │
│   • flyer.us        (Next.js, EN + ES)                               │
│   • teado.ai        (Next.js EN/VI/ES, Vercel)                       │
│                                                                      │
│ Học sinh                                                             │
│   • exam.flyer.us   (Phòng thi ảo · Cambridge/IELTS mock · gamify)   │
│      └─ study.exam.flyer.us  (Duolingo-style micro-frontend)         │
│   • ieltsguru.ai    (IELTS mock 4 kỹ năng + AI grade + AI Mentor)    │
│                                                                      │
│ Giáo viên / Trung tâm                                                │
│   • teacher.flyer.us  (partner-web · 228 route · Antd + GraphQL)     │
│   • teacher.teado.ai  (cùng partner-web, khác brand)                 │
│   • parent.flyer.us   (cùng partner-web, khác persona)               │
│                                                                      │
│ Internal (nội bộ)                                                    │
│   • roadmap.flyer.vn   • agent.flyer.vn   • meeting.flyer.vn         │
│   • hr.flyer.vn        • ketoan.flyer.vn  • marketing.flyer.vn       │
│   • cs.flyer.vn        • funnel.flyer.vn  • data.flyer.vn            │
└─────────────────────────────┬────────────────────────────────────────┘
                              │
                              ▼
┌──────────────────────────────────────────────────────────────────────┐
│                        BACKEND CHUNG (K8s prod)                      │
├──────────────────────────────────────────────────────────────────────┤
│  4 tầng API cùng chạy song song:                                     │
│  ┌───────────────┐ ┌───────────────┐ ┌──────────────┐ ┌────────────┐ │
│  │ GraphQL v1    │ │ GraphQL v2    │ │ REST v3      │ │ REST v4    │ │
│  │ Hasura        │ │ gqlgen (Go)   │ │ flyer-       │ │ teacher-   │ │
│  │ (legacy proxy)│ │ (chính)       │ │ backend-rust │ │ api (Go)   │ │
│  │               │ │               │ │ (182 endpt)  │ │ (11 endpt) │ │
│  └───────┬───────┘ └───────┬───────┘ └──────┬───────┘ └─────┬──────┘ │
│          └─────────────────┴────────────────┴───────────────┘        │
│                              │                                       │
│                    PostgreSQL 17 (Hasura)                            │
│                    - 284 bảng public                                 │
│                    - Read-replica ap-southeast-1 (analytics)         │
│                                                                      │
│  Sidecars:  imgproxy · slack notifier · birthday bot cron            │
└──────────────────────────────────────────────────────────────────────┘
📈 Quy mô toàn hệ sinh thái (24/08/2026 · read-replica prod) 1,68M hồ sơ HS 480k tài khoản 26,0M lượt làm bài 40.320 trường 21.107 giáo viên 703 tên miền white-label

2Persona & use case chính

PersonaNền tảng chính vàoViệc chínhNhóm sản phẩm
HS Cambridge Pre-A1 → B1exam.flyer.us + study.exam.flyer.usLuyện đề chứng chỉ + học từ vựng qua level mapExam · Study
HS IELTS 15+ieltsguru.aiMock test 4 kỹ năng, chấm AI, đọc góp ý MentorIELTS Guru
Phụ huynhparent.flyer.us (dashboard) + exam.flyer.us (làm bài hộ con)Xem báo cáo, kích hoạt gói, đóng học phíPartner-web
Giáo viên tự doteacher.flyer.usTạo lớp, giao bài, chấm AI cho HS mìnhPartner-web
Trung tâm / school ownerteacher.flyer.us (school-portal)Quản lý nhiều CN, học phí, thiết lập white-labelPartner-web + finance
GV Mỹ Latinh (LatAm)teado.ai → teacher.teado.aiCùng như teacher.flyer.us, brand khác, tiếng TBNTeado rebrand
Đại lý / mẹ bỉm bán khoáagent.flyer.vnXem hoa hồng, giới thiệu HS, tracking leadAgent portal
Nội bộ FLYERroadmap, hr, ketoan, meeting, cs, marketing, data.flyer.vnVận hành sản phẩm/HR/tài chính/CS/BIInternal tools
Điểm cần nhớ: exam & teacher & ielts & teado chia sẻ cùng backend — cùng database, cùng user table, cùng auth cookie. Bốn frontend nhưng một hệ dữ liệu. Đổi backend là ảnh hưởng cả bốn.

3Chi tiết 6 nền tảng công khai

3.1 flyer.vn — Landing sales cho VN

Marketinghttps://flyer.vnLive
LoạiChi tiết
FrameworkHTML tĩnh 302KB + assets/ (~30MB) — clone LadiPage 100%
Nguồn/Users/tungtony/Downloads/flyer-vn
Ngôn ngữChỉ tiếng Việt
Nhiệm vụBán chứng chỉ + 3 giá trị FLYER, dẫn khách đăng ký khoá học và cài ứng dụng
Sản phẩm quảng báFLYER Test, FLYER PRO, Bingo AI, FLYER LMS, Teado AI, IELTS Guru, Trường Số
CTA chính"SĂN DEAL NGAY!", "Trải nghiệm MIỄN PHÍ", "Đăng ký ngay"
BackendKhông có (tĩnh); form gửi qua endpoint hard-coded của LadiPage
DeployStatic host (linh động — CF Pages/Nginx/S3)
Hand-offNút login/đăng ký dẫn ra exam.flyer.us hoặc ứng dụng store

3.2 flyer.us — Landing quốc tế (EN + ES)

Marketinghttps://flyer.usLive
LoạiChi tiết
FrameworkNext.js Ứng dụng Router + TypeScript + pnpm
Nguồn/Users/tungtony/Downloads/flyer.us
Ngôn ngữEN mặc định + /es (Spanish rollout cho LatAm)
RouteỨng dụng Router — /, /es, một vài trang nội dung. Không có /api, không có middleware, không có route auth.
BackendStatic SSG — không tự phục vụ dữ liệu, gọi API bên ngoài từ client nếu cần
DeployVercel (không Dockerfile, không wrangler.toml → zero-config Vercel)
Hand-offNút CTA dẫn tới exam.flyer.us / teacher.flyer.us

3.3 exam.flyer.us — Phòng thi ảo (core học viên)

Corehttps://exam.flyer.usLive

Đây là ứng dụng học chính của FLYER trên thị trường VN — nơi HS làm mock test Cambridge/IELTS, luyện tập, thi đua, xếp hạng. Gamification nặng: coin, kim cương, streak, khiên chứng chỉ. Study micro-frontend nhúng trong đây thành study.exam.flyer.us.

Codebase flyer-webs/apps/exam hiện bị block đọc trong session này (macOS TCC trên thư mục Downloads). Chi tiết dưới đây dựa vào WebFetch homepage sản phẩm + memory nội bộ + shell chia sẻ với study.

Menu chính (từ homepage)

Menu (VI)Ý nghĩaBảng backend nghi ngờ
Thách đấuPhòng đấu realtime nhiều ngườichallenges, challenge_players (1,07M all-time · 87k/30d)
Luyện tậpPractice v2 (không chấm thật)user_attempts.type_attempt='practice'
Xếp hạngBảng xếp hạng theo tuần/thángchallenge_ranking, rollup tables
Lịch sửLịch sử làm bàiuser_attempts
Trường của tôiDanh sách lớp HS joinclass_students
Nhiệm vụDaily challenges, streak, kim cươnglearner_daily_challenges, daily_rewards
Thông báoPush + inboxnotifications, notification_events
Kiểm tra trình độPlacement testuser_attempts.type_attempt='placement_test' (11.764/30d)
Sổ tayTrang hướng dẫn / help centerstatic
Thầy cô / Phụ huynhDeep-link sang teacher/parent

Gamification hiển thị header

Stack ước lượng (theo pattern chung với study/ielts trong flyer/webs)

3.4 teacher.flyer.us — Ứng dụng giáo viên / trung tâm

Corehttps://teacher.flyer.usLive

Repo partner-web — monolith frontend cho 3 domain: teacher.flyer.us, parent.flyer.us, tools.teado.ai (host header rewrite).

LoạiChi tiết
FrameworkNext.js Pages Router (chưa migrate Ứng dụng Router), TypeScript strict off, Node 24.13
Kích thước228 file page · 756 component
UI kitAnt Design 6 + FlyerComponentsV2 + Emotion + Tailwind + MUI override
StateApollo Client (GraphQL) + React Query (REST) + Jotai (client)
Provider tree14 tầng — ConfigProvider → ReactQuery → QueryParam → Cache → Theme × 2 → RemoteConfig → Notistack → FlyerProvider (Apollo+Auth+User) → Teado → Guard → OnboardingUser → ContentPolicyGate → PreRoute → Routes → Data → BankAccount → BankHub → Recap → Component
4 tầng APIGraphQL v1 (Hasura, ~200 op) · GraphQL v2 (gqlgen, tăng dần) · REST v3 (Rust, 182 endpoint) · REST v4 (Go, 11 endpoint — chỉ Đá Tri Thức + Library)
AuthCookie HTTP-only + X-Session-Token cross-domain qua ?sessTok=. Google/Facebook/OTP.
Multi-tenantschoolId trong context; SwitchSchoolMutation đổi trường. Custom domain white-label — 703 trường đã APPROVED.
DeployDocker multi-stage → registry.flyer.vn/flyer/partner-web → K8s (kubectl rollout thủ công)
Runtime envreact-env inject PUBLIC_* lúc pod start → 1 image dùng chung dev/staging/prod
ObservabilityDatadog Logs + RUM · Slack side-car báo deploy

Route highlights (20 tính năng lớn phía teacher)

Có PRD riêng cho mỗi cái ở /tinh-nang. Nhóm nhanh:

Nội dung & giao bài

  • Khám phá đề, Tạo đề (Builder)
  • Chương trình / lộ trình
  • Giao bài tập · Giao tự động
  • Thư viện của tôi

Chấm & đánh giá

  • Chấm điểm AI (Speaking+Writing)
  • Trợ Giảng AI (Bingo Chat/Call)
  • Kiểm tra đầu vào (placement)
  • Báo cáo & Phân tích (18 report)

Vận hành lớp

  • Quản lý lớp (11 tab)
  • Học sinh (batch 50)
  • Điểm danh · Chuyên cần
  • Dạy Trực Tuyến (calendar)

Gamification lớp

  • Khen thưởng (Đá Tri Thức) — v4 API mới
  • Quà tặng (FLYER Gifts)
  • Thách đấu — 1,07M all-time
  • Quản lý kỳ thi (Cambridge/IELTS)

Tài chính

  • Tài chính & Học phí
  • Phiếu thu, Zalo ZNS
  • BankHub / SePay / VNPay
  • Ví xu, gói dịch vụ

Setup & portal

  • Thiết lập trường học
  • Phân quyền · White-label
  • Cổng đa chi nhánh
  • Onboarding 5 bước

3.5 ieltsguru.ai — Sản phẩm IELTS chuyên sâu

Corehttps://ieltsguru.aiLive

📄 PRD chi tiết đầy đủ 14 mục có sẵn — dưới đây chỉ tóm tắt.

LoạiChi tiết
FrameworkNext.js Ứng dụng Router (tách khỏi monorepo webs → repo standalone webs-ielts, pnpm 11.22)
Nguồn/Users/tungtony/Downloads/webs-ielts
Port dev3005
Sản phẩmMock test 4 kỹ năng (Listening / Reading / Writing / Speaking) + Practice + Chấm AI Writing/Speaking + AI Mentor
Kho đề production1.789 parts · 3.550 câu hỏi · 4 kỹ năng
Usage (24/08)207.767 lượt all-time · 11.612 lượt/30d · 661 HS active/30d · 28.195 HS all-time
Chấm AIWriting → task 1/2 rubric IELTS, provider Claude/DeepSeek fallback · Speaking → RecordRTC → transcribe → chấm 4 tiêu chí
MonetizationGói FLYER IELTS PRO (subscription) + kim cương lẻ trả cho từng lần chấm AI
4 lớp gate độc lập(1) login gate · (2) subscription gate · (3) kim cương/quota chấm · (4) content-policy
AuthChia sẻ cookie .flyer.us với exam/teacher → login 1 lần dùng chung
i18nEN + VI
DeployDocker standalone → K8s flyer-apps

3.6 teado.ai — Thương hiệu AI-first cho LatAm

Marketing + platformhttps://teado.ai · teacher.teado.aiLive

Teado là bước đi mở thị trường Mỹ Latin — cùng backend FLYER, thương hiệu & UX rebrand. Có 2 phần:

3.6.a Landing teado.ai (marketing)

LoạiChi tiết
FrameworkNext.js 16.1.6 Ứng dụng Router, React 19, Tailwind 3.4, shadcn/Radix
Packageflyer-teado-landing v1.0.0
Nguồn/Users/tungtony/Downloads/teado-landing-page
RouteỨng dụng Router · /[lang]/ với en | vi | es. Marketing 1 trang: Hero + Features + Partners + Footer
i18n3 ngôn ngữ · dictionary static ~500 dòng · storage teado-locale
Geo-redirect edgemiddleware.ts: VN → /vi · 19 nước LatAm+ES → /es · còn lại → /en. Đọc x-vercel-ip-country hoặc cf-ipcountry.
BackendKhông có · CTA dẫn ra teacher.teado.ai/signup · form B2B qua Tally.so
MediaArcade demo iframe + MP4 features từ cl.teado.ai/video/*.mp4
DeployVercel — output: 'standalone', đọc VERCEL_GIT_COMMIT_SHA

3.6.b Platform teacher.teado.ai

Cùng repo partner-web với teacher.flyer.us — chỉ khác host header. next.config rewrite host = tools.teado.ai/flyer-ai. Full stack đã mô tả ở §3.4.

3.7 study.flyer.us · study.exam.flyer.us — Duolingo micro-frontend

Micro-frontendhttps://study.flyer.usLive

📄 PRD chi tiết đầy đủ 10 mục. Tóm tắt:

LoạiChi tiết
FrameworkNext.js 16.2 Ứng dụng Router + Turbopack, React 19
Kích thướcChỉ 3 màn: Map / Lesson / Result — 1.420 LOC cho runner
Content916 level · 142 unit · 19.559 part · 14 DuolingoPartType
Usage226.202 STUDY/30d · 11.993 HS active/30d
MediaHLS + Howler + wavesurfer + RecordRTC + Rive (bản đồ) + Lottie + YouTube + Framer
Bọc trongexam shell (streak/coin/kim cương ở shell, không có trong repo Study)

4Tool nội bộ & landing phụ

Ngoài 6 platform khách hàng, có nhiều tool nội bộ chạy trên Cloudflare Pages / Vercel — mostly một-mình-một-repo, tự deploy bằng wrangler pages deploy hoặc push Git.

DomainMục đíchStackAuth
roadmap.flyer.vnRoadmap board (sprint/item/vote/comment) + hub PRDCF Pages + D1 + FunctionsGoogle login @flyer.us
agent.flyer.vnPortal đại lý (Downloads/flyer-agent-portal)Next 14 + CF Pages + D1 · PBKDF2 authPBKDF2 email/pass
meeting.flyer.vnĐặt phòng họp nội bộ + Google CalCF Pages + D1 + FunctionsGoogle Workspace
hr.flyer.vnHR portal — birthday, salary, orgCF Pages (chuyển từ Vercel)Allowlist 3 email admin
ketoan.flyer.vnLive sync Cashflow + Bảng lương từ Google SheetsCF Pages Functions + SA readerGoogle login
marketing.flyer.vnDashboard usage + hash-tab SPA + /studyCF Pages ~18MB SPA · cron 08:30Google login
cs.flyer.vnChurn dashboard từ CS Master.xlsxCF Pages tĩnhGoogle login
funnel.flyer.vnB2B Leads Velocity funnelCF Pages · data.js nhập tayGoogle login
data.flyer.vnContent coverage audit — Pre-A1→C2 + 4k link vocabCF Pages + Functions gateGoogle login gate server-side
academic.flyer.vnContent coverage dashboardCF PagesGoogle login
b2b.flyer.vnDashboard B2B (Pipedrive)CF Pages · launchd cron 3x/ngàyGoogle login
b2c.flyer.vnBáo cáo B2C Plan 2026 (8 tỷ)VercelPW gate tạm
lms.flyer.vnLMS trung tâm (đổi từ schools.flyer.vn)CF Pages tĩnh · 301 từ schools
about.flyer.vnTrang about công ty (bilingual)CF Pages zip-drop · i18n.js DICT
builder.flyer.vnBuilder Academy — đào tạo ProductCF Pages tĩnh
robot.flyer.vnLanding đặt trước Bingo RobotCF Pages + KV backendAdmin.html gate

5Kiến trúc backend chung

4 tầng API — di sản của quá trình migrate

LớpURL frontendRewrite tớiNgôn ngữVai trò hiện tại
GraphQL v1/api/graphqlPUBLIC_GRAPHQL_API — HasuraHasura (proxy Postgres)Legacy, ~200 op, giữ cho các query kế thừa từ Hasura
GraphQL v2/api/v2/graphqlPUBLIC_GRAPHQL_API_V2 — gqlgenGo (gqlgen)Chính, mọi module mới đều dùng, số op tăng dần
REST v3/api/v3/*flyer-backend-rust:3000Rust182 endpoint — flow nghiệp vụ legacy: auth, exam, checkpoint, tuition, wallet, package
REST v4/api/v4/*teacher-api:8081GoChỉ 11 endpoint: /library + /wisdom-stones/* (Đá Tri Thức). Template cho module mới.
Quy tắc chọn tầng khi phát triển tính năng mới:
  1. Ưu tiên REST v4 cho module mới, cắt tách khỏi legacy (Go rõ ràng, dễ scale ngang).
  2. Nếu module dùng dữ liệu nhiều mảnh liên quan (student + class + attempt) — dùng GraphQL v2 tránh N+1.
  3. Chỉ đụng REST v3 khi phải sửa flow legacy đang chạy (auth, tuition đang phụ thuộc).
  4. Không viết endpoint mới ở GraphQL v1.

Frontend luôn đi qua Next.js rewrites

Trình duyệt không gọi thẳng backend service. Mọi request đi qua /api/* của Next.js rồi Next inject X-Session-Token, gắn cookie same-origin, log request và tránh CORS.

Cluster K8s

Domain routing

Ba domain teacher.flyer.us, parent.flyer.us, tools.teado.ai đều trỏ vào cùng pod partner-web; phân biệt bằng host header + rewrite trong next.config.js. Tương tự study.flyer.usstudy.exam.flyer.us cùng vào pod study.

6Database & data model

Nguồn thật

InstanceVai tròTruy cập
Postgres 17.9 primary (Hasura)Write path — mọi ghi từ APINội bộ K8s, chỉ backend service
Read-replica flyer-read.c1rwfafj3m9s.ap-southeast-1.rds.amazonaws.comAnalytics, dashboard, auditUser readonly_analyst_full (pg_read_all_datatất cả 284 bảng)

Bảng lõi (nhóm theo domain)

NhómBảng chínhSố dòng (ước lượng 08/2026)
Usersusers, learner_profiles, teacher_profiles, people480k tài khoản · 1,68M hồ sơ HS · 21k GV
Trường & lớpschools, classes, class_students, class_schedules, custom_domain40k trường · 123k lớp · 987k lượt HS trong lớp · 703 tên miền APPROVED
Contentcheck_points, questions, question_details, speaking_parts, writing_parts, duolingo_*42.704 checkpoint · 36k question · 916 duolingo level · 19.559 part
Attemptsuser_attempts, speaking_question_attempts, writing_part_attempts, duolingo_part_attempts26,0M lượt all-time · 1,26M lượt/tháng
Assign / homeworkassign_tests, assign_test_classes, assign_test_student, assign_test_profiles396k giao all-time · 31,5k/30d
Gamificationchallenges, challenge_players, challenge_ranking, learner_daily_challenges, daily_rewards, teacher_wisdom_stone_*1,07M thách đấu · 1,88M lượt tham gia · 1.227 lần trao đá
Paymenttuitions, tuition_transactions, group_invoices, vnpay_payments, in_app_payments, wallets, wallet_transactions, flyer_packages, teacher_packages16 phiếu thu (2 PAID · adoption ≈ 0 !) · 19.163 VNPay records · 43k ví
AI & chatai_conversation_sessions, ai_partner_conversations, ai_speaking_records, ai_writing_records965k phiên · 63k/30d (TOPIC 30k · CHAT 16,6k · CALL 16,4k)
Kỳ thi teacherteacher_exams, teacher_exam_sessions, teacher_exam_students, teacher_exam_student_scores131 kỳ thi (67 Cambridge + 62 IELTS + 2 khác)

Bẫy hay gặp khi audit / báo cáo

7Auth & multi-tenant

Cấu trúc phiên

Cơ chếTrường hợp dùng
Cookie HTTP-onlyNguồn phiên chính, backend cấp, domain .flyer.us hoặc .flyer.vn để chia sẻ giữa sub-app
X-Session-Token headerHand-off cross-domain (từ flyer.us landing → exam.flyer.us) qua query ?sessTok= hoặc hash
Anonymous learnerCookie NEXT_PUBLIC_ANONYMOUS_LEARNER_PROFILE_ID — HS chưa đăng nhập vẫn dùng được Study/Exam, khi nộp bài mới phải login

Cách đăng nhập

Multi-tenant hierarchy

User (1 tài khoản)
  ├── LearnerProfile 1..N (1 phụ huynh nhiều con)
  ├── TeacherProfile 0..N (GV làm nhiều trường)
  │     └── School (trường/trung tâm)
  │           └── CustomDomain? (703 trường đã có)
  └── Cookie phiên: .flyer.us (chia sẻ sang exam / teacher / study / ielts)

Guard component (teacher.flyer.us)

Trong app/Guard.tsx, mỗi route đổi:

  1. Chưa login & route cần auth → redirect login.
  2. Chưa xong onboarding → chuyển tới bước đang thiếu.
  3. URL có ?schoolId=X khác trường hiện tại → SwitchSchoolMutation.

8AI/ML stack

FLYER không tự train model. Toàn bộ AI đi qua provider LLM ngoài + prompt in-house. Có ít nhất 4 luồng AI khác nhau đang chạy production.

1. Chấm AI Writing

2. Chấm AI Speaking

3. Bingo AI (hội thoại)

4. AI Mentor / Trợ giảng AI

Prompt hosting

Prompt engineering nằm trong repo backend (không nhìn thấy được từ frontend). Version control qua Git; PM muốn chỉnh phải PR trực tiếp vào backend repo, không có UI cho việc này.

9Media & CDN

LoạiNguồn / thư việnCDN
Audio streamingHLS .m3u8 + progressive mp3 fallback (6s timeout)stream.flyer.us — dual CDN (Cloudflare mặc định, Cloudfront fallback qua localStorage.cdn_choice)
Sound effectHowler (Web Audio) — pressButton, typing, invalidKeybundle
Waveform từ vựngwavesurfer.js
Mic recordingRecordRTC · StereoAudioRecorderupload to backend → S3
Video interactiveYouTube embed (react-youtube)YouTube CDN
Animation nhân vậtRive .riv — map moverself-hosted /animations/
Micro-animationLottie .json — result banner, tooltip, voice pulseself-hosted /animations/
Ảnhimgproxy sidecar (K8s Service) — resize/convert on-the-flyURL /api/imgproxy/* hoặc rewrite /image/*
Video marketing (teado)MP4 staticcl.teado.ai
FontBe Vietnam Pro (self-hosted 4 weights × 2 latin/vietnamese)self-hosted /fonts/

Cơ chế "1 audio 1 lần"

Toàn ứng dụng học chỉ có một track chính chạy tại 1 thời điểm — GlobalAudioStore trong hooks/useGlobalAudio.ts giữ single-track control. Nhấn câu mới tự pause câu cũ. Tránh cảnh 2 câu hỏi cùng phát audio khi HS nhấn nhanh.

10Data flow — 3 sơ đồ chính

10.1 Luồng làm bài (HS attempt)

HS mở exam.flyer.us
   │
   ▼ chọn check_point (từ map/discovery)
StudyCheckPointQuery (GraphQL v2)  ─────►  gqlgen Go
   │                                          │
   ▼                                     read `check_points` + parts
duolingoStartAttempt / user_attempt_create
   │  mutation ─────────────────────►  Postgres INSERT `user_attempts`
   ▼                                          │
   Vòng lặp part:                             ▼
     - DuolingoSubmitPartAttempt      INSERT `duolingo_part_attempts`
     - hoặc REST v3 `/v3/…/submit`    INSERT `speaking_question_attempts` / `writing_part_attempts`
   ▼
DuolingoEndAttempt                    UPDATE `user_attempts.total_score`, .status
   │                                          │
   ▼                                          ▼
/result/[userAttemptId] ◄───── UserAttemptLessonQuery ─── join score_details
   │
   ▼ (Bingo call, Chấm AI Writing… → luồng AI riêng — §8)

10.2 Luồng GV giao bài + HS nhận

GV vào teacher.flyer.us/assigned-tests/new
   │
   ▼ chọn check_point + lớp
POST /api/v3/assign_tests { check_point_id, class_id, deadline, target[] }
   │
   ▼   flyer-backend-rust INSERT `assign_tests`, `assign_test_classes`, `assign_test_student`
   │   TRIGGER Zalo ZNS + push notification cho HS
   │
   ▼
HS click link Zalo hoặc mở app
   │
   ▼ deep-link: study.flyer.us/vi/{checkPointId}?assignTestCode=XYZ&target[]=...
   ▼ nếu HS đang mobile browser + có assignTestCode + không phải WebView
      └─► OpenInExamApp component tự chuyển sang app native
   ▼
HS làm bài (§10.1) → user_attempts được gắn với assign_test qua trigger
   │
   ▼
GV mở /report/... hoặc /assigned-tests/[id]
   │ query aggregate: bao nhiêu HS đã làm, điểm trung bình, HS chưa nộp
   ▼
Nếu HS chưa nộp qua deadline → cron gửi nhắc Zalo lại

10.3 Luồng thanh toán / kim cương

HS (VN) mua kim cương / gói PRO
   │
   ▼ chọn phương thức
   ├─ VNPay      ─► redirect merchant → callback POST /v3/vnpay/callback
   │                                  → INSERT `vnpay_payments` (status='SUCCESS')
   │                                  → UPDATE `wallets.balance`
   │
   ├─ Polar      ─► redirect polar.sh (dùng cho HS quốc tế)
   │
   ├─ In-app     ─► App Store / Google Play → server-to-server verify → `in_app_payments`
   │
   └─ Chuyển khoản tự động
       └─ BankHub / SePay → webhook match số dư → confirm
                        → INSERT `tuition_transactions`
                        → UPDATE `tuitions.payment_status='PAID'`

Center owner đóng học phí theo tháng cho lớp:
   GV tạo `group_invoices` cho lớp → gửi Zalo ZNS phụ huynh
   PH click → SePay/BankHub link → tự confirm

11Deployment & DevOps

3 target deploy khác nhau — mỗi cái làm việc gì

TargetAi deploy vào đâyDeploy bằngCI
Kubernetes prod (namespace production)partner-web (teacher/parent/teado tools) · exam · study · ielts · gqlgen v2 · rust v3 · teacher-api v4Docker → registry.flyer.vn → kubectl rollout restart deploy XKhông có GitHub Actions — thủ công qua pnpm build-prod && pnpm deploy-prod
Vercelteado.ai landing · flyer.us landing · b2c.flyer.vn · birthday bot cronGit push → auto buildVercel build gate
Cloudflare PagesToàn bộ tool nội bộ + flyer.vn clone + landing phụ (~15 project)wrangler pages deploy . hoặc auto khi push GitHubKhông có, thủ công
Không có CI global. Không có GitHub Actions gate lint/test/typecheck trước merge. Deploy đều chạy thủ công. Có nhắc trong nợ kỹ thuật (§14).

Runtime env injection

K8s apps dùng @beam-australia/react-env — entrypoint chạy react-env --env APP_ENV --prefix PUBLIC trước Next → sinh __ENV.js chứa PUBLIC_* tại thời điểm start pod. 1 image dùng chung dev/staging/prod, chỉ đổi ConfigMap.

Observability

12Ma trận phụ thuộc giữa các platform

PlatformNếu sập, ai chết theo?
Postgres primaryTất cả platform → 500 toàn hệ
Read-replicaChỉ analytics/dashboard nội bộ (marketing.flyer.vn, cs.flyer.vn, data.flyer.vn) — không ảnh hưởng khách
gqlgen v2 (Go)teacher, exam, study, ielts, teado → mất mọi query dữ liệu mới
flyer-backend-rust (REST v3)exam, teacher (partial) → auth, tuition, package flow chết
teacher-api Go (REST v4)Chỉ Đá Tri Thức + Library — mất tính năng thưởng đá, còn lại chạy
Hasura (GraphQL v1)Query legacy (một số dashboard cũ) — không critical
Cloudflare (proxy DNS)Toàn bộ subdomain flyer.vn/flyer.us đằng sau CF → sập là 522/1016 toàn hệ
VNPayHS VN không mua được kim cương/gói
PolarHS quốc tế không mua được — VN vẫn OK
Claude APIChấm AI Writing/Speaking chậm (fallback DeepSeek) hoặc timeout; Bingo Chat/Call ngừng
ElevenLabsBingo CALL không phát TTS được — CHAT/TOPIC vẫn OK
stream.flyer.us CDNAudio bài học không chạy — HS có option đổi sang Cloudfront qua localStorage
Zalo ZNSThông báo giao bài / phiếu thu không gửi — không ảnh hưởng làm bài
flyer.vn landingMarketing bị ảnh hưởng — production học/thi không đụng
teado.ai landingMarketing LatAm bị ảnh hưởng — teacher.teado.ai vẫn chạy

13API bên ngoài & tích hợp

LoạiNhà cung cấpDùng ở đâu
Payment VNVNPayexam/teacher — HS mua kim cương/gói
Payment quốc tếPolarieltsguru.ai + exam quốc tế
Payment TT tự độngBankHub, SePayteacher học phí + PH đóng gói
Payment cửa hàng ứng dụngApple App Store, Google PlayỨng dụng native
SMS OTPVendor VN (trong backend)Login OTP
Zalo Notification ServiceZalo ZNSGiao bài, nhắc học phí, thông báo
Google OAuthGoogleLogin user + tool nội bộ
Facebook OAuthMetaLogin HS/PH VN
Google CalendarGoogle APImeeting.flyer.vn tạo event họp
Google SheetsGoogle API (SA)ketoan.flyer.vn đọc Cashflow/Bảng lương
PipedriveREST APIb2b.flyer.vn dashboard sales
DatadogDatadogLogs + RUM
LLM APIAnthropic Claude · OpenAI · DeepSeekChấm AI, Bingo, Mentor
Whisper STTOpenAIChấm Speaking
TTSElevenLabsBingo CALL
Video demoArcadeteado.ai landing hero
Video CDNBunny? / cl.teado.aiteado.ai features MP4
Content formsTally.soteado.ai B2B lead form
DiscordDiscord Bot APIbirthday bot "I'm Bingo" nhắn tin riêng cho quản trị viên vào chủ nhật

14Nợ kỹ thuật & rủi ro nổi bật

Rủi roMứcGhi chú
Không có CI — không GitHub Actions gate lint/test/typecheckCaoMerge sai vào main → phải cần dev nghiêm khắc self-check
TypeScript strict tắt ở partner-web (ignoreBuildErrors: true)CaoBuild pass khi có type error → dễ merge bug
4 tầng API song songTrung bình1 entity có nhiều nguồn khác nhau → cache inconsistency
ExamLessonDetailsView 1.420 LOCCaoFile chạy runner khổng lồ, khó refactor. Mỗi part type mới đều phải chạm.
Provider tree 14 tầng ở partner-webTrung bìnhOnboarding kỹ sư mới lâu; mỗi login re-render toàn bộ
Slack side-car chặn boot partner-webTrung bìnhNếu Slack API 429/timeout → pod restart loop
Học phí adoption ≈ 0 — 16 tuition, 2 PAID toàn hệCaoCode đầy đủ, khách không dùng — cần điều tra go-to-market
Dạy Trực Tuyến adoption ≈ 0Trung bình7.390 calendar events NHƯNG 7.366 là ASSIGNMENT auto, chỉ 24 MEETING thật
VNPay có 19k records nhưng 0 status='PAID'Trung bìnhEnum có thể là SUCCESS/00, cần dev xác nhận
5.890 vocab A1 mồ côiTrung bìnhĐã build nhưng 99% chưa nối path — A1 chưa có Study path live
Middleware study chỉ chạy next-intl, KHÔNG auth ở edgeTrung bìnhSSR bot không cookie → HTML "map trống" → SEO/preview kém
Anonymous cookie 1 nămTrung bìnhHS ẩn danh có thể học 1 năm không đăng nhập; TTL hết mất tiến độ
Bundle size chưa đo định kỳ (partner-web)Cần theo dõiCKEditor + Antd + MUI cùng tồn tại đẩy vendor bundle rất lớn
Content pipeline lỗi chính tảĐang xử lýduolingo_parts 678 lỗi đã confirmed; IELTS 1.467 lỗi confirmed

15Checklist onboarding cho thành viên mới — 30 ngày đầu

Tuần 1: Truy cập & đọc tài liệu

Tuần 2: Chạy sản phẩm thật + audit số

Tuần 3: Nắm engineering

Tuần 4: Xử lý 1 sự vụ nhỏ end-to-end

Người cần biết (khi PM cũ không còn)

Vấn đềHỏi ai
Kiến trúc backend, database schemaTeam engineering (SLACK #eng-backend)
Deploy K8s, CI, image registryTeam DevOps
Content: đề bài, sách giáo trìnhTeam Content + CTV số hoá
Chấm AI: prompt, provider, quotaTeam AI (backend + product)
Zalo ZNS / SMS OTP / VNPayTeam Backend + Finance
Analytics, số liệu ad-hocData / read-replica
Domain / DNS / CF PagesTùng (Product) · Nam (PM)

Tài liệu bổ sung nên đọc

Lưu ý: Tài liệu này là snapshot 26/08/2026. Data volume, feature adoption và stack có thể đổi. Trước khi hành động dựa trên con số nào, verify lại bằng SQL trên read-replica.

← Danh mục PRD · Kiểm chứng production · System Design teacher · PRD Study · PRD IELTS · Roadmap board