WELIFE � K? ho?ch k? thu?t ho�n ch?nh
Audit t? 39 b? UI mockup + PDF Mobile App UI trong th? m?c g?c.
Stack: BE NestJS + JWT + Swagger | FE React Native | Deploy Ubuntu.
1. K?t lu?n audit (t?ng quan s?n ph?m)
WELIFE l� si�u ?ng d?ng (super-app) lifestyle + ?� th? Vi?t Nam, g?m 3 ph�a client d�ng chung m?t API:
| App |
??i t??ng |
Vai tr� |
| WELIFE (Consumer) |
Ng??i d�ng cu?i |
B?n ??, ??t xe, F&B, KS, ph�ng tr?, ?? xe, x?ng, ATM, nh� thu?c, y t?, tr??ng h?c, v�, Reels/Social, AI |
| WELIFE Partner |
??i t�c kinh doanh |
Qu?n l� theo ng�nh: F&B, KS, b�i xe, tr?m x?ng, nh� thu?c, ph�ng tr? (Landlord), tr??ng, ph�ng kh�m |
| WELIFE Driver |
T�i x? |
Online/offline, nh?n chuy?n, v�, ?�nh gi� |
Bottom nav Consumer (th?ng nh?t t? UI): Map � Reels � Social � Contact/Inbox � T�i kho?n
2. Ph�n t�ch BE / FE (ranh gi?i c?ng)
???????????????????????????????????????????????????????????????
? FE (React Native) � ch? UI, state, g?i API/WS, maps SDK ?
? apps/mobile Consumer ?
? apps/partner Partner (multi-vertical) ?
? apps/driver Driver ?
???????????????????????????????????????????????????????????????
? HTTPS REST + WebSocket + JWT
???????????????????????????????????????????????????????????????
? BE (NestJS) � business logic, auth, DB, payment, media ?
? apps/api ?
? PostgreSQL + PostGIS � Redis � Object Storage � Nginx ?
???????????????????????????????????????????????????????????????
?
Ubuntu Server
FE kh�ng: t�nh gi� c??c, matching t�i x?, tr? v�, OCR bi?n s?, duy?t KYC, aggregation doanh thu.
BE kh�ng: layout m�n h�nh, navigation stack, camera UI (ch? nh?n file/metadata).
3. B?n ?? module theo UI ?� audit
3.1 N?n t?ng d�ng chung (Platform)
| Module UI |
BE module |
Ghi ch� |
| Splash, Onboarding, OTP phone, OAuth |
auth |
OTP + JWT access/refresh |
| H? s?, eKYC, x�a TK (OTP), logout |
users |
RBAC roles |
| V� WELIFE, n?p/r�t/chuy?n, th? NH |
wallet |
Ledger b?t bi?n |
| L?ch s? GD, th?ng k� chi ti�u |
transactions |
Filter theo d?ch v? |
| ??a ch? ?� l?u (Nh�/CTY) |
addresses |
Geo |
| Favorites / ?� l?u |
favorites |
Polymorphic target |
| Th�ng b�o, FAQ, ticket h? tr? |
notifications, support, cms |
|
| Upload ?nh/video/gi?y t? |
media |
S3/MinIO |
| B?n ?? POI g?n b?n |
places + PostGIS |
Core discovery |
| Tr? l� AI |
assistant |
LLM + RAG tr�n places |
| ?i?u kho?n / Privacy |
cms |
|
3.2 Consumer � d?ch v? d?c (Verticals)
| Vertical (UI) |
BE module |
Entities ch�nh |
| Ch? ???ng / Navigation |
routing |
Proxy Google/Mapbox + cache |
| G?i xe (Bike/Car/Car+) |
rides |
Trip, Quote, DriverMatch |
| B�i ?? xe |
parking |
Lot, Slot, Booking, PricingRule |
| Tr?m x?ng / Tr?m s?c |
fuel |
Station, FuelPrice, Amenity |
| ATM |
atm |
Atm, Bank, Status, Fee |
| ?n u?ng / C� ph� / Tr� s?a |
fnb |
Merchant, Menu, Order |
| Si�u th? / Ch? |
grocery |
Store, Product, Cart, Order |
| Nh� thu?c + toa thu?c |
pharmacy |
Pharmacy, Medicine, Prescription |
| B?nh vi?n / B�c s? / Ti�m ch?ng |
health |
Facility, Doctor, Appointment, HealthProfile |
| Kh�ch s?n |
hotels |
Hotel, RoomType, Booking |
| Ph�ng tr? / C?n h? |
rentals |
Listing, ViewingAppointment, Report |
| Tr??ng h?c |
schools |
School, ConsultationBooking |
| Reels / Social |
social |
Post, Comment, Follow, Hashtag |
| Chat / Contact |
chat |
Conversation, Message |
| QR / H�a ??n / T?i nh� |
utilities |
Phase sau |
3.3 Partner apps (c�ng API, role kh�c)
| Partner UI |
BE scope |
| F&B Partner / Business |
Menu CRUD, orders WS, analytics, space/tables |
| Hotel Partner |
Room types, calendar, check-in, promotions |
| Parking Partner |
Slot grid, OCR entry/exit, pricing, staff RBAC |
| Gas Station Partner |
Inventory liters, pump, price update, KYC onboarding |
| Pharmacy Partner |
Batch/expiry, verify prescription, stock |
| Landlord / Property |
Listing KYC, leads, revenue collection |
| Clinic Partner |
Patients, vitals, prescriptions, schedule |
| School Partner |
Students, tuition, attendance, programs |
3.4 Driver
| UI |
BE |
| Online toggle, accept trip, slide confirm |
rides + WS gateway |
| Wallet driver, r�t ti?n, fee platform |
wallet (account_type=DRIVER) |
| Ratings + reply |
reviews |
4. Ki?n tr�c BE NestJS (ho�n thi?n)
4.1 C?u tr�c th? m?c API
apps/api/
src/
main.ts # Swagger + global pipes/filters
app.module.ts
common/ # guards, decorators, dto, filters
config/
modules/
auth/
users/
media/
places/
wallet/
transactions/
notifications/
support/
favorites/
addresses/
rides/
parking/
fuel/
atm/
fnb/
grocery/
pharmacy/
health/
hotels/
rentals/
schools/
social/
chat/
reviews/
promotions/
analytics/
partners/ # onboarding KYC chung
assistant/
cms/
gateway/ # Socket.io realtime
prisma/ ho?c typeorm/
4.2 Auth & b?o m?t
- ??ng nh?p: S?T + OTP (primary), Google/Apple/Facebook (optional).
- JWT Access (15m) + Refresh (30d) l?u Redis/DB, rotate khi refresh.
- Roles:
USER | DRIVER | PARTNER_OWNER | PARTNER_STAFF | ADMIN | DOCTOR | LANDLORD.
- Guards:
JwtAuthGuard, RolesGuard, PartnerScopeGuard (ch? data thu?c c?a h�ng).
- Soft-delete account + OTP confirm (?�ng UI x�a TK).
- Rate-limit OTP / login; Helmet; CORS whitelist app.
4.3 Swagger
- Path:
/docs (Bearer JWT).
- Tag theo module: Auth, Users, Places, Rides, Orders, Wallet�
- M?i endpoint: DTO request/response, status codes, v� d? VN.
4.4 Database
| Th�nh ph?n |
C�ng ngh? |
| Primary DB |
PostgreSQL 16 + PostGIS |
| Cache / OTP / session |
Redis |
| Search (sau) |
Meilisearch / ES (phase 2) |
| Queue |
BullMQ (OTP SMS, push, matching) |
| Files |
MinIO (dev) / S3 (prod) |
Nguy�n t?c model:
places = POI chung (type: cafe|restaurant|parking|gas|atm|hotel|pharmacy|school|hospital�).
- Vertical tables m? r?ng 1-1 ho?c 1-n t?
places.id.
orders / bookings / trips t�ch theo domain (kh�ng nh?i 1 b?ng kh?ng l?).
wallet_ledger append-only (kh�ng UPDATE s? d? tr?c ti?p).
4.5 Realtime (b?t bu?c theo UI)
| S? ki?n |
Channel |
| Matching / v? tr� t�i x? |
trip:{id} |
| ??n F&B / grocery / pharmacy m?i |
partner:{storeId} |
| Chat |
conversation:{id} |
| Occupancy b�i xe |
parking:{lotId} |
4.6 T�ch h?p ngo�i
| D?ch v? |
M?c ?�ch |
| Google Maps / Mapbox |
Geocode, route, ETA |
| SMS OTP (ESMS / Twilio / Viettel) |
Auth |
| MoMo / ZaloPay / VNPay |
Thanh to�n |
| FCM |
Push |
| LLM API |
Tr? l� AI + medical assistant |
| OCR (plate) |
Parking Partner entry |
5. API surface ?u ti�n (Phase 0�1)
Phase 0 � Foundation (tu?n 1�3)
POST /api/v1/auth/otp/send
POST /api/v1/auth/otp/verify
POST /api/v1/auth/refresh
POST /api/v1/auth/logout
GET /api/v1/users/me
PATCH /api/v1/users/me
POST /api/v1/media/upload
GET /api/v1/places/nearby?lat=&lng=&type=&radius=
GET /api/v1/places/:id
GET /api/v1/cms/terms
GET /api/v1/cms/privacy
Phase 1 � Core consumer (tu?n 4�8)
# Addresses / Favorites
CRUD /api/v1/addresses
CRUD /api/v1/favorites
# Rides
POST /api/v1/rides/quotes
POST /api/v1/rides
GET /api/v1/rides/:id
POST /api/v1/rides/:id/cancel
POST /api/v1/rides/:id/rate
WS /rides
# Wallet
GET /api/v1/wallet
POST /api/v1/wallet/topup
POST /api/v1/wallet/withdraw
GET /api/v1/transactions
# F&B + Orders chung pattern
GET /api/v1/merchants
GET /api/v1/merchants/:id/menu
POST /api/v1/orders
GET /api/v1/orders/:id
# Parking / Fuel / ATM (discovery)
GET /api/v1/parking/lots/nearby
GET /api/v1/fuel/stations/nearby
GET /api/v1/atms/nearby
Phase 2 � Vertical c�n l?i + Partner
Hotels, Rentals, Pharmacy+Prescription, Health, Schools, Social/Reels, Partner dashboards, Driver app, Analytics.
6. K? ho?ch FE React Native
6.1 Repo apps
| App |
Tech g?i � |
apps/mobile |
Expo (dev nhanh) ho?c RN CLI |
apps/partner |
C�ng design system, deep-link theo partnerType |
apps/driver |
Background location + WS |
6.2 Ki?n tr�c FE
src/
app/ # navigation (tabs + stacks)
features/ # auth, map, rides, wallet, ...
shared/ # ui kit, hooks, api client
services/api.ts # axios + interceptors JWT
services/socket.ts
store/ # Zustand ho?c RTK Query
- Maps:
react-native-maps
- Video Reels:
expo-av / react-native-video
- i18n: vi (default), en sau
- Kh�ng nh�ng secret payment; ch? g?i BE.
6.3 Mapping tab Consumer ? feature folders
| Tab |
Feature |
| Map |
features/map, features/places, entry verticals |
| Reels |
features/social/reels |
| Social |
features/social/feed |
| Contact |
features/chat |
| T�i kho?n |
features/profile, wallet, settings |
7. Deploy Ubuntu (production)
Internet ? Nginx (TLS) ? NestJS (PM2 cluster ho?c Docker)
? Socket.io (sticky session)
? PostgreSQL + PostGIS
? Redis
? MinIO / S3
Docker Compose (khuy?n ngh?): api, postgres, redis, minio, nginx.
CI: build ? test ? image ? deploy VPS.
Env: .env kh�ng commit; secret JWT / DB / SMS / payment tr�n server.
Monitoring: health /api/v1/health, logs PM2/Docker, backup Postgres daily.
8. L? tr�nh tri?n khai ?? xu?t
| Phase |
Th?i gian |
Deliverable |
| P0 |
2�3 tu?n |
Monorepo, Auth OTP+JWT, Swagger, Users, Places nearby, Media, CMS, Ubuntu Docker |
| P1 |
4�5 tu?n |
Rides + Driver basic, Wallet, F&B order, Parking/Fuel/ATM discovery, Favorites |
| P2 |
4�6 tu?n |
Hotels, Rentals+Landlord, Pharmacy Rx, Health booking, Schools |
| P3 |
4�6 tu?n |
Partner apps ??y ?? dashboard/analytics, Social/Reels, Chat, AI assistant |
| P4 |
li�n t?c |
T?i ?u matching, search, compliance (eKYC, health data), scale |
9. Nguy�n t?c ?u ti�n khi code
- Modular monolith NestJS tr??c � t�ch microservice sau khi traffic l?n.
- M?i API public qua Swagger tr??c khi FE integrate.
- M?i ti?n qua ledger wallet + idempotency key.
- Geo query ch? qua PostGIS (
ST_DWithin).
- Partner data lu�n filter theo
storeId / ownership.
- FE/BE t�ch repo folder r�; contract = OpenAPI t? Swagger.
10. Mapping file thi?t k? (tham chi?u)
| Nh�m UI |
File JPG ti�u bi?u |
| Home map + all services |
0293�, 61a37�, 47da� |
| Auth / profile / AI |
bfb028� |
| Ride + driver |
090d�, 7b769� |
| F&B consumer + partner |
44ba�, 1970�, 2debc�, ad9d�, c884� |
| Cafe discovery |
0beb� |
| Grocery |
160bc� |
| Parking C + Partner |
25af�, 031df�, 1b586�, 5ad2� |
| Gas |
2905�, 7971� |
| ATM |
6c9b� |
| Hotel C + Partner |
934d�, 14e5�, 40e7� |
| Rental + Landlord |
0ea6�, 2e017�, cfcf� |
| Pharmacy C + Partner |
24c3�, 51ff�, 56cd� |
| Health C + Doctor |
f16b�, 679af�, 884bc� |
| Schools C + Partner |
706f�, f311� |
| Wallet / Support |
6183�, 1eabc� |
| Social Reels |
9a111� |
| System states |
868c� |
| Navigation |
b6ccd� |
PDF WELIFE - Mobile App UI-*.pdf = b?n g?c Figma/export ??y ?? m�n h�nh.