Tài liệu
Nhật ký kỹ thuật
Mỗi quyết định lớn được ghi lại ngay lúc đưa ra, kèm phương án đã cân nhắc và hệ quả phải gánh. Danh sách dưới đây đọc thẳng từ thư mục docs/adr trong repo.
ADR 0001 · 2026-09-20 · accepted
pnpm monorepo with Next.js for the web app
The capstone ships three role portals plus a public marketing/catalog surface, and later a REST API
ADR 0002 · 2026-09-20 · accepted — points 2 and 3 superseded by ADR-0003
API cross-cutting concerns: traceability, errors, validation
The NestJS app existed as a bootstrap with a health route. Before any feature module lands, the
ADR 0003 · 2026-09-21 · accepted — supersedes points 2 (RFC 7807) and 3 (no envelope) of ADR-0002
One response envelope for success and failure
ADR-0002 returned bare payloads on success and RFC 7807 problem documents on failure. In use this
ADR 0004 · 2026-09-21 · accepted
Prisma on PostgreSQL 17 with pgvector
The platform stores relational data (users, courses, quizzes, attempts) and, from phase 3, text
ADR 0005 · 2026-09-21 · accepted
BullMQ worker on Redis, with Zod job contracts
Parsing a PDF, embedding its chunks and drafting quiz questions take seconds to minutes and call
ADR 0006 · 2026-09-21 · accepted
Docker Compose behind Caddy, one origin
The system is five processes: web, api, worker, Postgres and Redis. The demo and the final defence
ADR 0007 · 2026-09-21 · accepted
JWT access tokens with rotating refresh tokens
The API serves three roles (admin, instructor, student) and, later, a mobile client. It needs
ADR 0008 · 2026-09-21 · accepted; replaces the "dark default" in earlier versions of DESIGN-DNA.md
Light is the default theme
The first version of docs/design/DESIGN-DNA.md made dark the default, "exactly as in the
ADR 0009 · 2026-09-21 · accepted
Supabase as hosted Postgres for staging
Local development runs Postgres in Docker (ADR-0006). A deployed environment needs a managed
ADR 0010 · 2026-09-27 · accepted; supersedes the Rayo-based parts of DESIGN-DNA.md (§1–§7, §9)
LearnUp as the visual reference for the product UI
The first landing page was an agency-style rebuild of the Rayo template: oversized display type,
ADR 0011 · 2026-09-27 · accepted; amends ADR-0010
Clone the reference templates 1:1 first, adapt second
ADR-0010 rebuilt the LearnUp layouts directly in SmartLearn's token set, with Vietnamese copy and
ADR 0012 · 2026-10-02 · proposed — team and mentor review pending
Carve the product out of the clones (ADR-0011 pass two)
ADR-0011 cloned the LearnUp site and the Fuse "Project" dashboard 1:1 as mockups, with the
ADR 0020 · 2026-09-27 · proposed — accepted after team and mentor review
Domain model and migration plan
The scope brief and 32 user stories need about forty tables. Eight parallel designs disagreed on
ADR 0021 · 2026-09-27 · accepted
Email and password self-registration, no verification, no reset
Until now the only way into the system was the seeded admin: ADR-0007 built login, refresh and
ADR 0022 · 2026-09-27 · accepted
Client data fetching with TanStack Query behind a BFF
The web app is server-first: tokens live in three httpOnly cookies and the browser never sees
ADR 0023 · 2026-09-27 · accepted
Modal sign-in/up with social-login placeholders
ADR-0021 chose email + password self-registration and dropped Google OAuth; DESIGN-DNA §7 rejected a
ADR 0024 · 2026-09-27 · accepted
Password reset by email
ADR-0021 shipped self-registration and explicitly rejected a password reset flow: "a reset is an
ADR 0025 · 2026-09-28 · accepted
Google OAuth sign-in
ADR-0021 dropped Google OAuth to save time and ADR-0023 shipped the social buttons as visual
ADR 0026 · ·
ADR-0026: Backend hosting — Render (API), Supabase (Postgres), Upstash (Redis)
The API, worker, Postgres and Redis run only on the developer's machine. We need
ADR 0027 · 2026-09-29 · accepted
`packages/ai` as the LLM core; `packages/domain` for pure domain logic
AGENTS.md rule 4 promised an ai/ module owning caching, budget, retries and logging, but it
ADR 0028 · 2026-09-29 · accepted
Authorization layer beyond the platform Role
JwtAuthGuard + @Roles() answer "which platform role is this?" only. M2+ asks
ADR 0030 · 2026-09-29 · accepted
Redis-backed throttling and refresh-rotation single-flight
Review items 1 and 2 (docs/research/architecture-review-2026-09.md). The throttler counted in
ADR 0031 · 2026-09-29 · accepted
Migrations over directUrl, before the deploy rolls; demo seed fails closed
Runtime uses the Supabase transaction pooler (6543, PgBouncer), which cannot run
ADR 0032 · 2026-09-29 · accepted
API call timeouts, one safe retry, and a "waking" state for cold starts
The API runs on Render's free plan (ADR-0026), which spins down when idle and takes ~50 s to
ADR 0033 · 2026-09-29 · accepted
Client identity behind the BFF, and `trust proxy` per host
The throttler keys every limit on req.ip (ADR-0030), and LOGIN_THROTTLE is 5 a minute. Two
ADR 0034 · 2026-10-08 · proposed — Able-to; pending team/mentor sign-off (esp. the LI-6 boundary)
Community & points-economy scope (extended plan v2.1, draft M6d)
The extended feature plan (docs/spec/feature-plan-v2.1) adds organizations, a
ADR 0035 · ·
ADR-0035: Confirmed lesson progress and accessible invitation enrollment
ADR 0036 · ·
ADR-0036: Student-only resource reading and durable resume
ADR 0037 · 2026-10-31 · accepted
Hybrid course retrieval, one shared implementation, and abstain by default
Retrieval for the AI Tutor ranked chunks by pgvector cosine only, although
ADR 0038 · 2026-11-17 · accepted
Immutable assignment snapshots and teacher-first rubrics
Project-submission assignments are generated from three moving parts: what the instructor asked for,
ADR 0039 · 2026-11-21 · accepted
Production-Grade AI Learning Intelligence Architecture
ADR 0039 · 2026-11-20 · accepted
The worker runs inside the API container on production
Production is one Render free web service running the API. Render background workers are paid, so
ADR 0040 · 2026-11-21 · accepted
Community posts are reviewed by an admin before they are public
The community hub (posts, course shares, likes, comments, profiles) is meant to stay academic.
ADR 0041 · 2026-11-21 · accepted
Points wallet: one writer, a locked balance row and an idempotent ledger
Points are earned, spent, refunded and adjusted by several features (#124 admin adjust, #125
ADR 0042 · 2026-11-21 · accepted
Buying points: a payment-provider interface, a signed mock gateway, a one-transaction grant
Students buy points with money (PTS-04). The first gateway is a mock for the demo; the VNPay
ADR 0043 · 2026-11-21 · accepted
Joining a points-priced course: one transaction, paid once per student
The course builder already stored Course.pointPrice, but nothing enforced it. A paid join must
ADR 0044 · 2026-11-21 · accepted; partly superseded by ADR-0057 (the free quota counts AI uses, and the
One AI usage log from AiClient events; the free monthly quota charged before the call
The admin monitoring page read a JSON blob in AppSetting seeded with sample rows; nothing wrote
ADR 0045 · 2026-11-21 · accepted; the repeatable BullMQ job is replaced by an in-process timer (ADR-0059)
Stuck point purchases expire; admins see every top-up
A student who closes the payment page leaves a PointPurchase PENDING forever, and a callback
ADR 0046 · 2026-11-21 · accepted
Refunding a paid course: taken down, or closed early by its instructor
A student who paid points to join a course (ADR-0043) lost them if the course was then taken down
ADR 0047 · 2026-11-21 · accepted
Reports, moderation, and reversing the reward of a hidden post
Comments are not reviewed before they appear, and an approved post can still turn out to break
ADR 0048 · 2026-11-21 · superseded by ADR-0057 (AI is paid in points directly; the exchange is retired).
Points → AI credits: one transaction under the wallet lock, limits counted there
Students earn points; the AI tutor is limited by a free monthly quota, then by purchased credits
ADR 0049 · 2026-11-21 · proposed; the credit unit is superseded by ADR-0057, which keeps the value
An AI credit is priced from a cost basis: one typical tutor answer, sold at about 2.5×
The points economy and the AI quota use placeholder numbers. gemini-3.5-flash is deprecated and
ADR 0050 · 2026-11-22 · accepted
One daily AI token budget in Redis, per ICT day; per-process fallback when Redis is down
AI_DAILY_TOKEN_BUDGET was counted by a MemoryBudgetStore in every process, and the api even
ADR 0051 · 2026-11-22 · accepted (live sandbox run pending credentials)
VNPay sandbox: a second payment provider, the IPN grants, the return URL shows
Students buy points (PTS-04). ADR-0042 put the gateway behind PaymentProvider and shipped a
ADR 0052 · 2026-11-22 · accepted. The tier counts and the price rule are the first estimate of ADR-0049
A points course's AI tutor allowance is a per-week bucket, charged before the personal quota
A course a student pays points to join should carry AI tutor answers, so a heavy learner does not
ADR 0053 · 2026-11-22 · accepted
The API container applies pending migrations at boot
ADR-0031 runs prisma migrate deploy in CI before it triggers the Render deploy, and the
ADR 0054 · 2026-11-22 · accepted; the price is in points since ADR-0057 (60 points, or one free AI use). The price (10 credits), the cap (2 reviews) and the 60k-token input ceiling
AI project review: a proposal the instructor approves, charged to the course owner's quota
The worker already asks the model for free-text feedback on every graded project (GRADING_FEEDBACK,
ADR 0055 · 2026-11-23 · accepted
Gemini only, model fixed by env; the admin page keeps the kill switch and sampling
The admin AI page offered a provider picker (Gemini, OpenAI, Fake), a fallback provider, a chat
ADR 0056 · 2026-11-23 · accepted. The site shell (header, footer, landing page) uses both. The other
Slate and cobalt palette, and one full-width page container
The owner had two complaints. First, content sits in a narrow column with wide empty bands on
ADR 0057 · 2026-11-23 · accepted
One currency, points: AI is paid from the points wallet after the free monthly uses
A user had to understand two units: points (earned, bought, spent on courses) and AI credits
ADR 0058 · 2026-11-24 · accepted
The admin console uses the main palette and the full-width container
The /admin/dashboards/* console kept a second, light-only palette (--fz-* in tokens.css),
ADR 0059 · 2026-11-24 · accepted
BullMQ on a metered Redis: quiet when idle, paused when Redis is unusable
Production Redis is Upstash's free plan: 500 000 commands a month, every command counted,
ADR 0060 · 2026-11-24 · accepted
Showcase content pack, applied by the API at boot
Production needs content a visitor can browse (courses now, blog posts later). The dev seed
ADR 0061 · 2026-11-24 · accepted
Showcase projects and course materials
The showcase courses need a project to submit and materials to download. A project is a
ADR 0062 · 2026-11-25 · accepted
ZIP projects run their test cases, hidden ones counted only
A ZIP project submission never ran a test. The api enqueued spec.testCases: [] (C# too), and
ADR 0063 · 2026-11-30 · accepted
Online quiz proctoring: signals, not locks
Quizzes now come in two delivery modes (Quiz.deliveryMode): ONLINE (single/multi choice,
ADR 0063 · 2026-11-26 · accepted
Production on one VPS, deployed by a webhook on push to main
The free tiers ran out of road: GitHub Actions is budget-blocked (every run is a
ADR 0064 · ·
ADR-0064: Outbound email through Resend's SMTP, starting with submission alerts
Course owners asked to hear by email, not only under the bell, when a student submits a project
ADR 0065 · ·
ADR-0065: One notification pipeline, and an email policy under a daily quota
Instructors, students and admins need to hear about more events (grading, receipts, AI provider
Kết quả đo lường RAG nằm ở trang đo lường.