CHEATSHEET
1-Page Compressed
Toàn bộ prep gói trong 1 trang. In ra mang theo interview. Click section để jump tới page chi tiết.
🎯 Universal Clarify (chọn 5-8)
- ① Functional scope + out-of-scope
- ② Scale: DAU, RPS peak, Read:Write
- ③ Latency p50/p95/p99
- ④ Consistency strong/eventual
- ⑤ Multi-tenant isolation
- ⑥ Auth/permission/RBAC
- ⑦ Real-time poll/push
- ⑧ Data lifecycle (retention, GDPR)
- ⑨ Mobile/offline
- ⑩ 3rd-party/webhook
- ⑪ Compliance (PII, audit, region)
- ⑫ SLA/DR/RTO/RPO
- ⑬ Cost/OSS-SaaS
- ⑭ Team stack familiarity
→ Chi tiết
⚡ 5-Step Design Framework
- 1. Clarify (5m) — chọn 5-8 từ Universal
- 2. API (5m) — endpoint, request/response, auth
- 3. Data model (10m) — tables, FK, index
- 4. Architecture (5m) — client → API → DB + cache/queue
- 5. Trade-offs (5m) — gì optimized, gì sacrificed, failure mode
💡 Nói ra suy nghĩ. Chấm reasoning, không đáp án.
⚙️ Backend Stack Quick
- REST: GET 200/206 · POST 201/202 · PUT/PATCH 200/204 · DEL 204
- Status: 400 bad · 401 unauth · 403 forbidden · 404 NF · 409 conflict · 422 validation · 429 rate · 5xx
- JWT: access 15m (memory) + refresh 7d (httpOnly cookie, rotate)
- Index: equality TRƯỚC range.
(user_id, created_at DESC)
- Transaction: multi-table write →
$transaction
- N+1: log SQL →
include/select. DataLoader cho GraphQL.
- Cache: Cache-aside default. TTL + jitter. Lock cho stampede.
- Queue: BullMQ. Idempotency key. Retry exp backoff. Per-channel queue.
→ Chi tiết BE
🎨 Frontend Stack Quick
- Hooks: useState · useEffect (cleanup!) · useMemo (đo trước) · useCallback (chỉ khi pass to memo)
- TanStack Query: staleTime (fresh window) vs gcTime (memory). Key factory. Invalidate sau mutation.
- Optimistic:
onMutate set, onError rollback.
- RSC: default server.
"use client" cho interactive leaf.
- Next caching: request memo · data cache · route cache · router cache.
revalidateTag.
- Perf: Profiler đo trước. Code split. Virtual list. Bundle analyzer.
- CWV: LCP < 2.5s · INP < 200ms · CLS < 0.1
- JWT lưu: memory (NOT localStorage)
→ Chi tiết FE
🏢 Multi-tenancy ★
| Pattern | Pros | Cons |
| Shared schema (tenant_id col) | Cheap, scale dễ | Leak risk |
| Schema per tenant | Isolation tốt | Migration n× |
| DB per tenant | Strict isolation | Cost cao |
Enforce: Middleware inject tenantId từ JWT + Postgres RLS safety net.
🧭 SOLID
- Single Responsibility — 1 lý do thay đổi
- Open/Closed — extend, không sửa (strategy)
- Liskov — subclass dùng được như parent
- Interface segregation — interface nhỏ > bloat
- Dependency inversion — abstraction, inject
→ Ví dụ
📏 YAGNI · KISS · DRY
- YAGNI — đừng build feature trước khi cần. NOT cho security/schema/PII.
- KISS — đơn giản > clever. Function < 30 line.
- DRY — 1 source of truth. Nhưng AHA > DRY — wait 3-4 lần để biết pattern.
⚡ Quick-fire
- SQL/NoSQL: SQL = JOIN+transaction. NoSQL = write-heavy+flex schema.
- JWT/Session: JWT stateless+mobile. Session-Redis revoke.
- PUT/PATCH: PUT replace full. PATCH partial.
- 401/403: 401 = ai. 403 = không có quyền.
- Microservice: chỉ khi team > 2-3 squad + scale độc lập.
- Idempotency: POST → idempotency-key header.
- Cache stampede: lock + SWR + jitter TTL.
- Read replica: read-after-write về primary.
💬 Behavioral STAR
Situation → Task → Action → Result. ~3 min/câu.
- Bug khó: race / leak / N+1 / stampede — không "typo"
- Disagreement: listen → data → spike thử cả 2
- Why Base.vn: impact (1000+ DN) + stack overlap + multi-tenant + sản phẩm thực + 1-2 product cụ thể
🦀 Rust pitch (sales_agent)
"Em build Rust backend với Axum + sqlx — scan card, parse contact, push HubSpot. Pattern giống NestJS: module-per-feature, repo tách handler, error enum → HTTP qua trait. Rust ép em handle Option/Result, ít bug null. Pick Rust vì job xử ảnh + AI nặng — tokio concurrent tốt, footprint nhỏ."
→ Code examples
🎯 Mock Design Q (30 min/câu)
Trade-offs để nói: shared schema + RLS · queue per channel · presigned S3 URL · state machine · data-driven config
✅ Pre-interview Checklist
- ☐ Test camera, mic, internet
- ☐ Mở sẵn IDE để share screen
- ☐ Notepad ghi câu hỏi clarify
- ☐ Mở sẵn page này (cheatsheet)
- ☐ Coffee xong, nước cạnh tay
- ☐ STAR stories review 1 lần
- ☐ "Why Base.vn?" answer review
- ☐ Join 5-10 phút sớm
- ☐ Hít sâu — biết mình giỏi