# rtemplo/property-pulse-nextjs architecture

> Architecture diagram of the GitHub repository rtemplo/property-pulse-nextjs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rtemplo/property-pulse-nextjs
- Repository: https://github.com/rtemplo/property-pulse-nextjs

## Overview

##### Project type and purpose
- This is a full-stack web application built with Next.js (App Router) for browsing, adding, editing, bookmarking, and messaging around real-estate properties.
- Key features: property listing/search, user authentication (NextAuth), image uploads (Cloudinary), messaging between users, bookmark/saved properties, user profile management.

##### File structure
- app/
- Hosts Next.js “App Router” pages and layouts (app/layout.tsx, app/loading.tsx, app/page.tsx)
- Feature folders: messages, profile, properties (with dynamic routes and subpages)
- API routes under app/api/auth using NextAuth
- components/
- Reusable UI pieces: Navbar, Hero, PropertyCard, Forms, MessageCard, BookmarkButton, Spinner, etc.
- models/
- Mongoose schemas: User, Property, Message
- config/
- Database connection (config/database.ts)
- Cloudinary config (config/cloudinary.ts)
- utils/
- Auth session helpers, type guards, conversion utilities
- context/
- GlobalContext for client-side state (e.g., theme, notifications)
- public/ & assets/ & _theme_files/
- Static assets and theme templates (CSS, JS, images)
- middleware.ts
- Authentication and route guards at the edge

##### Detailed capture of essential elements
- Middleware.ts as an edge function for route protection
- Flow of static assets from public/ and assets/ to the client via CDN
- Dynamic routing for properties/[id], nested under the app folder

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Client
  subgraph "Client"
    Browser["Browser/Mobile"]:::ui
  end

  %% Next.js Server
  subgraph "Next.js Server"
    direction TB

    subgraph "Frontend (App Router)"
      direction TB
      Layout["app/layout.tsx"]:::frontend
      Page["app/page.tsx"]:::frontend
      Loading["app/loading.tsx"]:::frontend
      ErrorPage["app/error.tsx"]:::frontend
      NotFound["app/not-found.tsx"]:::frontend
      MessagesPage["app/messages/page.tsx"]:::frontend
      ProfilePage["app/profile/page.tsx"]:::frontend
      PropsPage["app/properties/page.tsx"]:::frontend
      AddPropPage["app/properties/add/page.tsx"]:::frontend
      PropDetail["app/properties/[id]/page.tsx"]:::frontend
      PropEdit["app/properties/[id]/edit/page.tsx"]:::frontend
      SavedProps["app/properties/saved/page.tsx"]:::frontend
      SearchResults["app/properties/search-results/page.tsx"]:::frontend
    end

    subgraph "Backend (API & Logic)"
      direction TB
      AuthRoute["app/api/auth/[...nextauth]/route.ts"]:::api
      Middleware["middleware.ts"]:::api
      DBConfig["config/database.ts"]:::config
      CloudConfig["config/cloudinary.ts"]:::external

      subgraph "Models"
        UserModel["models/User.ts"]:::model
        PropModel["models/Property.ts"]:::model
        MsgModel["models/Message.ts"]:::model
      end

      subgraph "Business Logic (Actions)"
        AddProp["app/actions/addProperty.ts"]:::logic
        UpdateProp["app/actions/updateProperty.ts"]:::logic
        DeleteProp["app/actions/deleteProperty.ts"]:::logic
        BookmarkProp["app/actions/bookmarkProperty.ts"]:::logic
        CheckBookmark["app/actions/checkBookmarkStatus.ts"]:::logic
        AddMsg["app/actions/addMessage.ts"]:::logic
        DeleteMsg["app/actions/deleteMessage.ts"]:::logic
        MarkRead["app/actions/markMessageAsRead.ts"]:::logic
        UnreadCount["app/actions/getUnreadMessageCount.ts"]:::logic
      end
    end
  end

  %% External Services
  subgraph "External Services"
    direction TB
    MongoDB["MongoDB Atlas"]:::db
    CloudinaryService["Cloudinary"]:::external
    OAuth["OAuth Providers"]:::external
    CDN["CDN / Static Assets"]:::external
  end

  %% Data Flows
  Browser -->|"SSR/SSR hydration"| Layout
  Browser -->|"GET/POST API calls"| AuthRoute
  Browser -->|"GET/POST API calls"| AddProp
  Browser -->|"session check"| Middleware
  Layout --> Page
  Page --> PropDetail
  Page --> PropsPage
  AuthRoute -->|"validate session"| OAuth
  AuthRoute -->|"read/write user"| UserModel
  AuthRoute -->|"issue token"| Middleware
  AddProp -->|"save()/create() "| PropModel
  UpdateProp -->|"update() "| PropModel
  DeleteProp -->|"delete() "| PropModel
  BookmarkProp -->|"update user bookmarks"| UserModel
  CheckBookmark -->|"read user bookmarks"| UserModel
  AddMsg -->|"create() "| MsgModel
  DeleteMsg -->|"delete() "| MsgModel
  MarkRead -->|"update() "| MsgModel
  UnreadCount -->|"count() "| MsgModel
  AuthRoute --> DBConfig
  AddProp --> DBConfig
  UpdateProp --> DBConfig
  DeleteProp --> DBConfig
  AddMsg --> DBConfig
  DeleteMsg --> DBConfig
  MarkRead --> DBConfig
  UnreadCount --> DBConfig
  AddProp -->|"uploadImage() "| CloudConfig
  CloudConfig --> CloudinaryService
  DBConfig --> MongoDB
  Browser -->|"fetch static"| CDN

  %% Click Events
  click Layout "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/layout.tsx"
  click Page "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/page.tsx"
  click Loading "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/loading.tsx"
  click ErrorPage "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/error.tsx"
  click NotFound "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/not-found.tsx"
  click MessagesPage "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/messages/page.tsx"
  click ProfilePage "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/profile/page.tsx"
  click PropsPage "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/properties/page.tsx"
  click AddPropPage "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/properties/add/page.tsx"
  click PropDetail "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/properties/[id]/page.tsx"
  click PropEdit "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/properties/[id]/edit/page.tsx"
  click SavedProps "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/properties/saved/page.tsx"
  click SearchResults "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/properties/search-results/page.tsx"
  click AuthRoute "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/api/auth/[...nextauth]/route.ts"
  click Middleware "https://github.com/rtemplo/property-pulse-nextjs/blob/main/middleware.ts"
  click DBConfig "https://github.com/rtemplo/property-pulse-nextjs/blob/main/config/database.ts"
  click CloudConfig "https://github.com/rtemplo/property-pulse-nextjs/blob/main/config/cloudinary.ts"
  click UserModel "https://github.com/rtemplo/property-pulse-nextjs/blob/main/models/User.ts"
  click PropModel "https://github.com/rtemplo/property-pulse-nextjs/blob/main/models/Property.ts"
  click MsgModel "https://github.com/rtemplo/property-pulse-nextjs/blob/main/models/Message.ts"
  click AddProp "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/actions/addProperty.ts"
  click UpdateProp "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/actions/updateProperty.ts"
  click DeleteProp "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/actions/deleteProperty.ts"
  click BookmarkProp "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/actions/bookmarkProperty.ts"
  click CheckBookmark "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/actions/checkBookmarkStatus.ts"
  click AddMsg "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/actions/addMessage.ts"
  click DeleteMsg "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/actions/deleteMessage.ts"
  click MarkRead "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/actions/markMessageAsRead.ts"
  click UnreadCount "https://github.com/rtemplo/property-pulse-nextjs/blob/main/app/actions/getUnreadMessageCount.ts"

  %% Styles
  classDef ui fill:#cde8ff,stroke:#2a5f9e,color:#000;
  classDef frontend fill:#e0f7ff,stroke:#1e788d,color:#000;
  classDef api fill:#d6f5d6,stroke:#2f8f2f,color:#000;
  classDef config fill:#fef2c0,stroke:#d4a017,color:#000;
  classDef model fill:#ffeed6,stroke:#d48f10,color:#000;
  classDef logic fill:#f0dbf0,stroke:#a14fa1,color:#000;
  classDef db fill:#ffdfdf,stroke:#d12f2f,color:#000;
  classDef external fill:#e8d6ff,stroke:#6a2fa1,color:#000;
```
