How ledaithanhlong/dacn_jurni works
Project Type & Purpose
• This is a full-stack “tour booking and management” web application (“Jurni”) built on the MVC pattern.
• Frontend: React (Vite) with Tailwind CSS, rendering views and consuming REST APIs.
• Backend: Node.js + Express + Sequelize ORM, exposing REST endpoints and implementing business logic.
• Database: MySQL (via Sequelize migrations/models).
• External services: Cloudinary (media uploads), VNPay/MoMo (payments), email/SMS notifications.
File Structure Analysis
• Top level: two peers, frontend/ and backend/.
• backend/src:
• config/ (database, cloudinary, env)
• models/ & migrations/ (Sequelize ORM + schema evolution)
• controllers/ (business logic per resource: users, hotels, flights, cars, activities, bookings, favorites, vouchers, notifications)
• routes/ (Express routers mapping HTTP paths to controllers)
• middlewares/auth.js (JWT or session-based auth)
• server.js (app bootstrap & listening)
• frontend/src:
• components/ (shared UI pieces + admin views)
• pages/ (route-level React pages)
• routes/App.jsx (React Router mapping)
• assets: index.html, styles.css, tailwind.config.js
Key Architectural Insights from README
• Strict MVC separation on backend, with client-server HTTP API.
• Payment integration (VNPay/MoMo) implies external API calls.
• Cloudinary for media.
• User roles & authorization (admin vs. end-user).
• Uses Sequelize migrations → relational schema (ERD).
a. Main Components
• Web Client (Browser)
• CDN/Static Hosting (serving frontend assets via Vite build)
• API Gateway / Express Backend
• Database (MySQL)
• External Services:
• Cloudinary (image storage)
• Payment Providers (VNPay, MoMo)
• Notification service (email/SMS – can be 3rd-party or in-house microservice)
b. Relationships & Data Flow
1. User → Browser UI → HTTP(S) → Express API
2. Express controllers ↔ Sequelize ORM → MySQL
3. Express → Cloudinary SDK
4. Express ↔ Payment gateways (redirects/callback)
5. Express → Notification service
c. Architectural Patterns
• MVC and layered architecture (routing → controller → service/ORM → database)
• Stateless REST API (JWT or session cookies)
• Externalized configuration (env variables via src/config/env.js)
• Role-based access control via auth middleware
d. Key Technologies
• Frontend: React, Vite, Tailwind CSS, React Router
• Backend: Node.js, Express, Sequelize, JWT/Auth middleware
• Database: MySQL
• External: Cloudinary, VNPay/MoMo, possibly Nodemailer/twilio
Detailed Capture of Essential Elements
• Authentication flow: login → JWT token → protected routes.
• File-upload flow: user → Express upload route → cloudinary.config.
• Migration/model layer for schema management.
• Major REST resources: /users, /hotels, /flights, /activities, /bookings, /vouchers, /favorites, /notifications.
• Middlewares (auth) lying between routes and controllers.