How chiennguye/doantotnghiep works
Project type and purpose
• This is a full-stack web application for a milk-tea ordering business, consisting of:
• A customer-facing React/Redux SPA ("hhtlmilkteauser")
• An admin React/Redux SPA ("hhtlmilkteaadmin")
• A Spring Boot REST + WebSocket monolith ("hhtlmilkteaapi")
• A relational database (configured via JPA/Hibernate)
• External payment & media services (Momo, VNPay, Cloudinary, Google Maps)
File structure
• Two parallel React apps under /hhtlmilkteauser and /hhtlmilkteaadmin each with:
• Public folder (index.html, assets)
• src/components, src/services (API wrappers), src/store (Redux actions & reducers)
• Common utilities (APIClient.js, Notification.js, Constant.js)
• Backend under /hhtlmilkteaapi with:
• controller layer (REST & WebSocket endpoints)
• service layer (business logic, Cloudinary upload, URL shortener)
• repository layer (Spring Data JPA interfaces)
• entity + payload DTOs for requests/responses
• security config (JWT filter, entry point, user details)
• Database seeding under seed
• application.properties, Dockerfile, Procfile for cloud deployment
README for insights
• Contains login/test credentials for EmailJS, Momo sandbox, bank details
• Build hints (--openssl-legacy-provider) and peer-dep fixes
• Cloudinary and third-party integrations
Main components & interactions
a. Frontends (User SPA, Admin SPA)
– Host static assets (Docker/Nginx)
– Use React Router for navigation, Redux for client state
– Call backend via REST (Axios/APIClient) and WebSocket for real-time updates
b. Backend monolith
– Exposes REST endpoints (Auth, Product, Order, ChatBot, Notification, etc.)
– JWT-based authentication & authorization (roles via ERole)
– WebSocket channel for group orders/chat
– Business services (order processing, payment callbacks, URL shortening)
– Persists to relational DB via JPA repositories
c. Database
– Tables for users, roles, products, orders, add-options, sale-offs, etc.
– Seed data on startup
d. External services
– Momo & VNPay (payment gateways)
– Cloudinary (image upload)
– Google Maps (address autocomplete/geo)
– EmailJS (notifications)
Architectural patterns & design principles
• Frontends: component-driven UI, container/presentation, DRY common modules
• State management: Redux (actions → reducers → store)
• Backend: layered architecture (Controller → Service → Repository)
• Security: JWT filter, role-based access, CORS config
• Real-time: WebSocket for live events
• Deployment: Docker containers, Procfile for Heroku/GCP
[User SPA] [Admin SPA]
↘ ↙
[API Server (Spring Boot)]
↓
[Database]
• Rectangle (blue) for frontends
• Rectangle (green) for API Server
d. Annotations:
• “Seed data” under Database