How dharmesh53/havns works
Main Components
• Client/Browser: Represents the end-user interface that interacts with the application via pages (e.g., homepage, signin, signup, dashboard, hall details).
• Next.js Frontend: Built using React, this renders UI components including halls listings, maps (using Leaflet), image components, and review sections.
• API Backend: The Next.js API routes (under app/api) handle business logic such as authentication, booking management, hall details, user actions, reviews, and more.
• Database/Data Models: The “models” directory contains definitions (hall, meeting, photos, review, user) that likely interface with a persistence layer.
• External Integrations:
• Stripe for payment processing.
• Zoom integration for virtual tour management.
• Cloudinary (mentioned in the README) for handling hall images.
• Leaflet (in components/map) for map integration.
• Possibly Redis for caching/fast lookups, as indicated in utils/redis.js.
• Additional Services: Mail and token management in utils for sending emails and authentication purposes.
a. Frontend (Client:
• UI pages like dashboard, private pages for host actions (booking, listing, meeting requests) and public pages for hall information.
b. API Layer:
• Out the directory structure under app/api with relevant endpoints (auth, booking, zoom, stripe, wishlist, etc.). Each route corresponds to a service (e.g., authentication routes, booking endpoints, hall data CRUD operations).
c. Data Storage:
• A DB or persistence layer associated with the models. Represent how API endpoints read/write data to these models.
d. External Services:
• API back-end to external systems like Stripe for checkout, Zoom for meeting management, and Cloudinary for image storage.
• Integration with mapping services (Leaflet) for hall location details.
e. Context & State Management:
• That React context and hooks (as seen in the context/ and hooks/ directories) manage state that is shared across components.
Architectural Patterns and Design Principles
• Separation of Concerns: The project cleanly separates frontend presentation (components and pages) from API logic.
• Modular API: Each API endpoint has its own route.js file and follows a modular structure (authentication, booking, meeting, etc.).
• Server-Side Rendering (SSR) and Client-Side Routing: Given that it’s a Next.js application, some pages are pre-rendered, while others might be client-managed.
• External integrations are abstracted through util functions (e.g., sendmail.js, token.js) ensuring loose coupling.
Elements
• Clear labels for:
• Client Browser / UI (Next.js pages, React components such as Nav, Feed, Hallcard)
• API Backend Layers (each API folder such as auth, booking, zoom, stripe)
• Database models (hall.js, user.js, etc.)
• External integrations (Stripe, Zoom, Cloudinary, Leaflet maps)
• From client to API endpoints
• From API endpoints to Database and External Services