How rikibanik/heritage_hub works
Main Components
• Frontend (Two distinct applications):
• Client: This is the user-facing React application. It handles user authentication (including OTP and Google OAuth), ticket booking, profile management, and payment integration interfaces.
• Author: A separate React application for authors that includes modules for museum management, ticket/slot management, and dashboard views.
• Backend Server:
• A Node.js/Express application that handles the API endpoints for authentication, ticket booking, payment (integrated with Razorpay), role-based access control, and communication with the database.
• Database:
• MongoDB, which stores collections for users, authors, admins, tickets, venues, slots, OTPs, and blacklisted tokens.
• External Services and Third-Party Integrations:
• Authentication via Google OAuth2 and OTP via Nodemailer.
• Payment gateway integration using Razorpay.
• Hosting and file storage (AWS S3 for media assets and possibly AWS for deployment).
Relationships and Interactions
• The two frontend applications (client and author) interact with the backend server via RESTful API calls.
• The backend server communicates with the database to retrieve/update data (ticket bookings, user details, museum venues, etc.).
• Payment processing: The client initiates payment actions which are handled by the server via specific routes and services (e.g., the razorpay controller/service).
• Authentication flow: The server validates user credentials through different strategies (OTP, password, OAuth2) and manages sessions/tokens.
• Admin functionalities are partly rendered via server-side EJS views for dashboards and listings.
Architectural Patterns and Design Principles
• Separation of concerns: The project distinctly separates presentation (two frontend applications), business logic (server controllers, services, middleware), and data persistence (MongoDB).
• Role-based access control: Different flows and API endpoints exist for users, authors, and admins.
• Modularity: The backend code is organized in controllers, services, middleware, and models. Similarly, frontend components are grouped (e.g., home, dashboard, museum, RegLog) that indicate component-based architecture (React).
• Scalability: With divided responsibilities and external integration (e.g., payment, authentication, AWS services), the design can scale as each module can be scaled independently.
Relevant Technologies, Frameworks, and Libraries
• Frontend: React.js (developed using Vite), Tailwind CSS for styling, and component-based design patterns.
• Backend: Node.js, Express.js, and custom middleware for auth/security.
• Database: MongoDB interacting via defined models.
• External Tools: Razorpay for secure payments, Google OAuth via googleConfig utility, and use of Nodemailer for OTP-based authentication.
• Build Tools/Configurations: ESLint, PostCSS, Tailwind CSS, and Vite configurations on both frontend components.
Instructing the Principal Software Engineer
• Labels for each component:
• Client (User Frontend)
• Author (Author Management Frontend)
• Backend Server (REST API, Authentication Module, Payment Module, Admin Module)
• Database (MongoDB with collections for users, authors, tickets, venues, etc.)
• External Services (Google OAuth, Razorpay, AWS S3)
• A two-way connection between the Backend and MongoDB.
• Connections from the Backend to external services (OAuth, payment gateway, AWS).