# 1. Clone project
git clone https://github.com/bisosad1501/DATN.git
cd DATN
# 2. Setup Backend (Docker services)
chmod +x setup.sh
./setup.sh
# 3. Setup Frontend
cd Frontend-IELTSGo
./setup-team.sh # Script tự động setup cho team
# Script sẽ tự động:
# ✓ Check & install pnpm nếu chưa có
# ✓ Copy .env.example → .env.local
# ✓ Install dependencies (pnpm install)
# ✓ Check backend status
# ✓ Hỏi có muốn chạy dev server khôngAccess:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
- PgAdmin: http://localhost:5050
Frontend Documentation:
- 📖 Setup Guide:
Frontend-IELTSGo/SETUP_GUIDE.md(chi tiết nhất) - 🚀 Quick Start:
FRONTEND_TEAM_SETUP.md(ở root) - 🏗️ Architecture:
Frontend-IELTSGo/ARCHITECTURE.md
# 1. Clone project
git clone https://github.com/bisosad1501/DATN.git
cd DATN
# 2. Chạy script tự động (tất cả trong 1 lệnh!)
chmod +x setup.sh
./setup.sh
# ✅ Script sẽ tự động:
# - Kiểm tra Docker & Docker Compose
# - Tạo .env file (nếu chưa có)
# - Build tất cả Docker images
# - Start database & infrastructure
# - Chạy migrations
# - Start tất cả services# Chỉ cần 1 lệnh!
chmod +x update.sh
./update.sh
# ✅ Script sẽ tự động:
# - Pull code mới từ git
# - Rebuild các services đã thay đổi
# - Chạy migrations mới (nếu có)
# - Restart services# 1. Tạo .env từ template
cp .env.example .env
# 2. Build và start services
docker-compose up -d --build
# 3. Chạy migrations
docker-compose up migrations
# 4. Kiểm tra status
docker-compose psChi tiết: Xem TEAM_SETUP.md hoặc QUICK_START.md
Migrations tự động chạy khi dùng ./setup.sh hoặc ./update.sh
# Chạy manual (nếu cần)
./scripts/run-all-migrations.sh
# Hoặc via Docker
docker-compose up migrations
# Check migrations đã apply
docker exec -i ielts_postgres psql -U ielts_admin -d course_db -c \
"SELECT * FROM schema_migrations ORDER BY applied_at DESC LIMIT 5;"Migration Files: database/migrations/*.sql (numbered: 001, 002, ...)
Docs: database/README.md và database/migrations/README_MIGRATION_*.md
- Migration 011: Xóa field
video_watch_percentage - Migration 012: Enable dblink extension (cross-database queries)
Hệ thống học IELTS trực tuyến với kiến trúc microservices, được xây dựng bằng Golang và PostgreSQL.
Tech Stack:
- Backend: Go 1.21+ (Microservices)
- Frontend: Next.js 14, TypeScript, TailwindCSS (trong folder
Frontend-IELTSGo/) - Database: PostgreSQL 15
- Cache: Redis
- Message Queue: RabbitMQ
┌─────────────────────────────────────────────────────────────┐
│ API Gateway │
│ (Port: 8080) │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────┼─────────────────────┐
│ │ │
┌───────▼────────┐ ┌───────▼────────┐ ┌───────▼────────┐
│ Auth Service │ │ User Service │ │ Course Service │
│ (Port: 8081) │ │ (Port: 8082) │ │ (Port: 8083) │
└────────────────┘ └────────────────┘ └────────────────┘
│ │ │
┌───────▼────────┐ ┌───────▼────────┐ ┌───────▼────────┐
│Exercise Service│ │ AI Service │ │Notification Srv│
│ (Port: 8084) │ │ (Port: 8085) │ │ (Port: 8086) │
└────────────────┘ └────────────────┘ └────────────────┘
- Routing requests đến các microservices
- Authentication middleware
- Rate limiting
- Load balancing
- Đăng ký, đăng nhập
- JWT token generation & validation
- Phân quyền: Student, Instructor, Admin
- Refresh token mechanism
- Quản lý profile học viên
- Dashboard tracking tiến trình
- Learning statistics
- Study goals & reminders
- Quản lý courses, modules, lessons
- Video lectures (4 skills: Listening, Reading, Writing, Speaking)
- Learning materials & resources
- Course enrollment
- Bài tập Listening & Reading
- Question bank management
- Auto-grading cho trắc nghiệm
- Submission history
- Writing evaluation (Task Achievement, Coherence, Lexical, Grammar)
- Speaking evaluation (Speech-to-Text + NLP)
- Pronunciation analysis
- Feedback generation
- Push notifications (Android)
- Email notifications
- In-app notifications
- Study reminders
Mỗi service có database riêng (Database per Service pattern):
- auth_db: Authentication data
- user_db: User profiles & progress
- course_db: Course content & materials
- exercise_db: Questions & submissions
- ai_db: AI evaluations & feedback
- notification_db: Notification queue
- Language: Go 1.21+
- Database: PostgreSQL 15
- Cache: Redis
- Message Queue: RabbitMQ
- Containerization: Docker & Docker Compose
- API Documentation: Swagger/OpenAPI
# Clone repository
git clone <repo-url>
cd DATN
# Start all services with Docker Compose
docker-compose up -d
# Check services status
docker-compose ps
# View logs
docker-compose logs -fDATN/
├── api-gateway/
├── services/
│ ├── auth-service/
│ ├── user-service/
│ ├── course-service/
│ ├── exercise-service/
│ ├── ai-service/
│ └── notification-service/
├── shared/
│ ├── config/
│ ├── database/
│ ├── middleware/
│ ├── models/
│ └── utils/
├── database/
│ ├── migrations/
│ └── seeds/
├── docker-compose.yml
└── README.md
Xem file .env.example để cấu hình môi trường.
Sau khi start services, truy cập:
- Swagger UI: http://localhost:8080/swagger
# Run unit tests
go test ./...
# Run integration tests
go test -tags=integration ./...| Service | Database | Tables | Purpose |
|---|---|---|---|
| Auth Service | auth_db |
9 tables | Authentication, roles, permissions, JWT tokens |
| User Service | user_db |
10 tables | User profiles, learning progress, achievements |
| Course Service | course_db |
12 tables | Courses, lessons, videos, enrollments |
| Exercise Service | exercise_db |
11 tables | Exercises, questions, answers, submissions |
| AI Service | ai_db |
10 tables | Writing/Speaking evaluations, AI processing |
| Notification Service | notification_db |
8 tables | Notifications, push/email delivery |
Total: 60 tables across 6 databases
Xem chi tiết: Database Documentation
POST /auth/register- Đăng kýPOST /auth/login- Đăng nhậpPOST /auth/refresh- Refresh tokenPOST /auth/logout- Đăng xuất
GET /users/profile- Xem profilePUT /users/profile- Cập nhật profileGET /users/progress- Tiến trình học tậpGET /users/achievements- Thành tựu
GET /courses- Danh sách khóa họcGET /courses/:id- Chi tiết khóa họcPOST /courses/:id/enroll- Đăng ký khóa họcGET /courses/:courseId/lessons/:lessonId- Xem bài học
GET /exercises- Danh sách bài tậpPOST /exercises/:id/start- Bắt đầu làm bàiPOST /exercises/attempts/:id/submit- Nộp bài
POST /ai/writing/submit- Nộp bài WritingGET /ai/writing/submissions/:id- Kết quả chấm WritingPOST /ai/speaking/submit- Nộp bài SpeakingGET /ai/speaking/submissions/:id- Kết quả chấm Speaking
GET /notifications- Danh sách thông báoPUT /notifications/:id/read- Đánh dấu đã đọcPOST /notifications/register-device- Đăng ký push notification
Xem chi tiết: API Documentation
- ✅ Database schema design
- ✅ Docker infrastructure setup
- 🔄 Basic CRUD APIs
- 🔄 Authentication & Authorization
- 🔄 User management
- ⏳ Course management
- ⏳ Video streaming
- ⏳ Exercise system (Listening/Reading)
- ⏳ Progress tracking
- ⏳ Writing AI evaluation
- ⏳ Speaking AI evaluation (Speech-to-Text + NLP)
- ⏳ Pronunciation analysis
- ⏳ Feedback generation
- ⏳ Notification system
- ⏳ Achievement system
- ⏳ Android app
- ⏳ Payment integration
- ⏳ Live classes
- ⏳ Performance optimization
- ⏳ Caching strategy
- ⏳ Load testing
- ⏳ CI/CD pipeline
- JWT-based authentication
- Password hashing with bcrypt
- Role-based access control (RBAC)
- Rate limiting
- SQL injection prevention
- XSS protection
- CORS configuration
- Audit logging
- Refresh token rotation
Key environment variables (xem .env.example để biết đầy đủ):
# Database
POSTGRES_USER=ielts_admin
POSTGRES_PASSWORD=your_secure_password
# JWT
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRY=24h
# AI Services
OPENAI_API_KEY=your_openai_api_key
# Notifications
FCM_SERVER_KEY=your_fcm_key
SMTP_HOST=smtp.gmail.com- Proper indexing on frequently queried columns
- Connection pooling
- Read replicas for heavy read operations
- Materialized views for analytics
- Redis for session management
- Cache frequently accessed data (courses, users)
- Cache invalidation on updates
- RabbitMQ for async processing
- AI evaluation jobs
- Email sending
- Notification delivery
# Create feature branch
git checkout -b feature/auth-service
# Commit changes
git add .
git commit -m "feat: implement JWT authentication"
# Push to remote
git push origin feature/auth-service
# Create Pull Request on GitHubfeat:- New featurefix:- Bug fixdocs:- Documentationstyle:- Code style changesrefactor:- Code refactoringtest:- Testschore:- Maintenance
go test ./...go test -tags=integration ./...Sử dụng Postman hoặc curl để test APIs
- Fork the project
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT License