How prateek-code-dev/book-my-event works
Primary components
• Client Application:
• Built with React (using Vite and Tailwind CSS), it handles the user interface.
• Contains key elements such as pages (Home, Login, Register, Booking, Event Details), components (project-specific UI pieces like DateSelector, Modal, ReportCard, etc.), state management with Redux slices, routing (ProtectedRoute, PublicRoute), and service layer for API calls.
• Server Application:
• A Node.js/Express backend with clearly defined routes for events, bookings, payments (RazorPay integration), and user management.
• Organized with controllers, models, middleware (for authentication and authorization), and helper functions.
• Includes a configuration for connecting to the database.
• Database:
• While not explicitly named, a DB configuration file suggests a connection to a persistent data store (e.g., MongoDB or another RDBMS).
• External Services:
• RazorPay used for payment integration, as indicated by the razorPayController and route.
Relationships
• The Client interacts with the Server via RESTful API calls (services in the client folder call endpoints defined in the server routes).
• The Server processes these requests through controllers, applies business logic, uses middleware for security (validating tokens and admin privileges), and interacts with the database.
• Payment requests are routed to RazorPay-related controllers.
• Redux in the client maintains session/authentication state and global state (e.g., booking and event info).
Architectural patterns and design principles
• Separation of concerns:
• Client (UI, state management, external service integration) is kept separate from the Server (business logic, data handling, authentication, and external payment integration).
• Layered architecture:
• In the server side, there’s a clear layering: Routes → Controllers → Models and Helpers.
• Use of middleware in Express to handle authentication and authorization.
• Modular design in the client: distinct directories for components, pages, contexts, routes, and services.