Nền tảng xem quẻ và chiêm nghiệm với các trải nghiệm như gieo quẻ Dịch, Tarot, Tử vi, theo dõi lịch sử, quản lý hồ sơ và gói dịch vụ trả phí. Hệ thống có trang quản trị để kiểm soát người dùng, giao dịch và cấu hình API.
- Gieo quẻ Kinh Dịch, hiển thị quẻ và diễn giải nội dung bằng LLM.
- Tarot và các phiên trải nghiệm divination.
- Lập lá số Tử vi, lịch âm, quản lý hồ sơ sinh (ngày/giờ sinh).
- Tài khoản người dùng (đăng ký, đăng nhập, OAuth).
- Lịch sử phiên, credits, gói Premium/Pro.
- Thanh toán qua PayOS, webhook xử lý giao dịch.
- Admin dashboard: người dùng, lịch sử, cấu hình API, tarot, giao dịch.
- Next.js (App Router), React, TypeScript
- Supabase (Auth + Postgres + Storage)
- Prisma ORM
- PayOS SDK
- Node.js 18+ (khuyến nghị 20+)
- Tài khoản Supabase
- Tài khoản PayOS
- Cài dependency
npm install- Tạo file môi trường
copy .env.example .env.local- Cập nhật biến môi trường trong
.env.local
# Database
DATABASE_URL=postgresql://user:password@host:5432/db
# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=xxx
SUPABASE_SERVICE_ROLE_KEY=xxx
# Encryption
ENCRYPTION_KEY=your-32-character-encryption-key-here
# AI APIs or config at ADMIN DASHBOARD (recommended)
GEMINI_API_KEY=xxx
OPENAI_API_KEY=xxx
# PayOS
PAYOS_CLIENT_ID=xxx
PAYOS_API_KEY=xxx
PAYOS_CHECKSUM_KEY=xxx
- Khởi tạo database + seed dữ liệu
npm run db:setup- Chạy dev server
npm run devMở http://localhost:3000 để sử dụng.
-
Tạo project Supabase và lấy các thông tin sau:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYSUPABASE_SERVICE_ROLE_KEYDATABASE_URL(Postgres connection string)
-
Bật Auth providers theo nhu cầu (Email/Password, Google).
- Redirect URL cho OAuth:
https://<domain>/auth/callback
- Redirect URL cho OAuth:
-
(Khuyến nghị) Tạo Storage bucket chứa ảnh quẻ dịch.
- Tên bucket:
64_QUE - Đặt quyền public nếu muốn truy cập trực tiếp qua URL.
- Tên bucket:
-
Chạy
npm run db:setupđể đẩy schema và seed dữ liệu.
-
Tạo ứng dụng PayOS và lấy:
PAYOS_CLIENT_IDPAYOS_API_KEYPAYOS_CHECKSUM_KEY
-
Thiết lập webhook trên PayOS:
- URL webhook:
https://<domain>/api/payment/webhook - Với môi trường local, có thể dùng ngrok để public URL tạm thời.
- URL webhook:
-
Kiểm tra webhook:
- Gọi
GET /api/payment/webhookđể xác nhận endpoint hoạt động.
- Gọi
.
├─ prisma/ # Schema + migrations + seed
├─ public/ # Static assets
├─ scripts/ # Script tiện ích (set admin, cleanup, seed)
├─ skills/ # Skills nội bộ
├─ src/
│ ├─ app/ # Next.js App Router
│ ├─ components/ # UI components
│ ├─ lib/ # Helpers, integrations (Supabase, PayOS, Prisma)
│ ├─ stores/ # Zustand stores
│ └─ types/ # TypeScript types
├─ 64-YiYing-cards.zip # 64 quẻ dịch (ảnh)
├─ 78-Tarot-cards.zip # 78 lá Tarot (ảnh)
└─ README.md
npm run db:setup- push schema + seed dữ liệunpm run db:seed- chỉ seed dữ liệunpm run history:cleanup- dọn lịch sử rỗngnode scripts/set-admin.js <email>- set quyền admin cho user