How theinfiniteprins/shaadisync works
Main Components
• Backend: Built using Node.js and Express.js and contains several key sub-components:
• API endpoints (located in backend/api, with index.js as an entry point).
• Authentication (files under backend/auth with signin.js and signup.js indicating user login and registration logic).
• Controllers (in backend/controllers, managing different domain areas such as Admin, Artist, Payment, Reviews, User and transactions).
• Models (in backend/models, representing MongoDB collections for Artists, User transactions, OTP management, etc.).
• Middleware (in backend/middleware, ensuring route protection and role-based authentication).
• Configuration files (e.g., db.js for DB connection, mailSender.js for email, and config.js for generic configurations).
• Routes (organized in backend/routes to connect controllers to endpoints).
• Frontend: Built using React.js and Tailwind CSS:
• Core React components (in frontend/src/components) that manage UI elements like Artist cards, navbars, sidebars, and forms.
• Layouts and Pages (under frontend/src/layouts and frontend/src/pages) which establish route-based navigation with separation for Admin, Artist, and User.
• Context and routing (frontend/src/context and frontend/src/routes) to manage state (like authentication) and URL mappings.
• Configuration for styling (Tailwind) and bundling (vite.config.js).
• External Services and Integrations:
• Cloudinary for image uploads.
• Stripe for handling payments.
• MongoDB as the primary database.
• JWT for authentication management.
Depicting Interactions & Relationships
• For the Frontend, highlight the components, layouts, and pages. Emphasize the integration with the backend API (using RESTful calls) and how context is used to manage authentication.
• Database: Represent MongoDB as another component that interacts primarily with the backend models.
• External systems such as Cloudinary (for image uploads) and Stripe (for payments) connected to the backend.
• Optionally, include a representation of the Admin Dashboard and how it interacts with both the frontend (Admin layout and pages) and the backend (specific admin routes and controllers).
Architectural Patterns & Design Principles
• Follow an MVC (Model-View-Controller) style on the backend – clearly separate the routing layer, controller logic, data models, and middleware.
• On the frontend, apply the component-based architecture typical in React applications. Note the use of centralized state management using React Context (AuthContext).
• Separation of concerns, with distinct folders handling configuration, authentication, and business logic.
• Security practices like JWT-based authentication in middleware and protected routes.