API backend cho ứng dụng quản lý sự kiện theo lịch Dương và Âm lịch, hỗ trợ người dùng cá nhân hóa và đồng bộ hóa với Google Calendar.
- Node.js + Express
- Prisma + PostgreSQL
- TypeScript
- JWT Auth
- Google OAuth 2.0
- Zodios API schema
npm installTạo file .env và thêm:
DATABASE_URL=postgresql://user:password@localhost:5432/calendar_db
JWT_SECRET=your_jwt_secret
SESSION_SECRET=your_secret
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_CALLBACK_URL=http://localhost:3001/api/auth/google/callbacknpx prisma migrate dev
npx prisma generatenpm run devnpm run build
npm start- Đăng ký, đăng nhập (email + password)
- Đăng nhập bằng Google OAuth
- Sinh JWT token, xác thực middleware
- Quản lý User / Event liên kết qua userId
- API tạo/sửa/xoá/lấy sự kiện cá nhân
- Chặn sửa/xoá event của người khác
- Lưu accessToken + refreshToken từ Google
- Đồng bộ tạo/sửa/xoá sự kiện với Google Calendar
- Tự động refresh access token khi hết hạn
- Webhook để đồng bộ ngược từ Google Calendar về app
- Nhắc lịch (notification hoặc email trước sự kiện)
- Tùy chọn chia sẻ lịch với người khác
- Dashboard admin (thống kê, theo dõi user)
- Tự chọn timezone + cấu hình giờ nhắc
- Lịch công việc nhóm (đa người dùng)
- Rate limit, audit log cho request
src/
├── app.ts # Entrypoint chính
├── routes/ # Các router Express
├── controllers/ # Xử lý request
├── middlewares/ # Auth, error handling
├── lib/ # Prisma, JWT, utils
├── services/ # Google Calendar, email...
└── config/ # Passport config