# Estato (Real Estate Management Dashboard)

> A full-stack MERN real estate operations platform with CRUD, Google Auth, live charts, and Cloudinary image management, built on the Refine framework with Material UI.

Section: Custom SaaS Platforms

Page: https://mburhan.com/case/estato-real-estate-management-dashboard

## Project Overview

Estato is a full-stack real estate management platform designed to help real estate teams manage property listings, agent information, and portfolio performance from a centralized dashboard. Built using the MERN stack, TypeScript, and the Refine framework, it combines property management, analytics, and authentication in a unified interface.

The platform provides complete property CRUD operations, allowing agents to create, view, update, and delete listings with structured details such as property type, location, price, description, and images. Cloudinary handles property image uploads and delivery, while MongoDB Atlas stores property records and agent information.

The dashboard presents key operational metrics, monthly revenue trends, property referral sources, and recently added listings. Google OAuth provides individual user authentication, while agent directories and profile pages help teams view agent information and property portfolios. Built with Material UI and ApexCharts, Estato also supports light and dark modes for a flexible user experience.

### Project Details

- **Project Type:** Full-Stack MERN Application Case Study
- **Product:** Estato — Real Estate Management Dashboard
- **Frontend:** React 18, TypeScript, Refine Framework, Material UI, ApexCharts
- **Backend:** Node.js, Express, ESM Modules
- **Database:** MongoDB Atlas with Mongoose ODM
- **Authentication:** Google OAuth, Google Identity Services, JWT, localStorage
- **Media Storage:** Cloudinary for property image uploads and delivery
- **Frontend Hosting:** Vercel — [mern-dashboard-app.vercel.app](https://mern-dashboard-app.vercel.app/)
- **License:** MIT

Image: The Estato dashboard: revenue, property, agent and customer tiles, a monthly revenue chart and a property referrals breakdown. (https://mburhan.com/case-content/estato/image1.png)

## Why We Built This

Real estate teams often manage property listings, agent information, and performance data across disconnected tools. Property records sit in listing portals, agent performance is tracked in spreadsheets, and photos are scattered across emails or local drives. Without a centralized dashboard, getting a complete view of operations becomes difficult.

**The core challenges Estato was designed to solve:**

- **Fragmented Property Data:** Listings were spread across multiple platforms without a consistent structure for property type, location, price, and description.
- **Limited Agent Visibility:** Managers lacked a clear overview of agent portfolios and how properties were distributed across the team.
- **Inefficient Listing Management:** Creating and editing listings without standardized forms, structured property types, and direct image uploads was time-consuming.
- **Lack of Centralized KPIs:** Tracking properties for sale and rent, total customers, and total agents required manual effort across multiple systems.
- **Limited Referral Insights:** Teams lacked a centralized view of which channels, including social media, marketplaces, websites, and digital ads, generated enquiries.
- **Unmanaged Authentication:** Shared credentials limited individual accountability and made it difficult to associate listings with specific agents.

**Our goal** was to build a unified MERN-stack dashboard where agents could sign in with Google and manage their own property listings, while managers could monitor key metrics, revenue trends, referral sources, and the entire agent directory from one place.

### What this system does

Estato is a full-stack MERN application that gives real estate teams a complete operations interface: live analytics, a full property CRUD system, an agent directory, individual profiles, and Google-authenticated access. The Refine framework handles data fetching, routing, and auth integration; Material UI provides the component layer; ApexCharts and custom donut charts deliver the analytics.

### Operations dashboard

- Four donut-style KPI tiles at the top of the home page give instant visibility: Properties for Sale (live count from the API), Properties for Rent, Total Customers, and Total Agents, each with a percentage ring showing the proportion against a target
- Total Revenue area chart (ApexCharts) renders monthly revenue data across the full year with a smooth curve and gradient fill
- Property Referrals horizontal bar chart shows the contribution of each lead source: Social Media (64%), Digital Ads (80%), Websites (50%), Marketplace (40%), and Others (15%).
- Latest Properties section beneath the charts shows the 4 most recently added properties as live cards pulled from the API in real time

### Property management (full CRUD)

- All Properties page renders the full listing catalogue as a responsive card grid, with live search by title, filter by 8 property types (Apartment, Villa, Farmhouse, Condos, Townhouse, Chalet, Studio, Duplex), price sort toggle, and server-side pagination with a configurable page-size selector (5, 10, 20, 30, 40, 50, All)
- Property Detail page shows the full-size property photo, property type with a 5-star rating, title, location, price, and description on the left. The right sidebar shows the creator agent’s avatar, name, property count, and location. Context-aware action buttons adapt based on the logged-in user: Message and Call for other agents’ listings; Edit and Delete for the current user’s own listings
- Create Property form collects title, property type, description, location, price, and photo. The photo is read into base64 via the FileReader API and submitted to the backend, which uploads it to Cloudinary and stores the CDN URL
- Edit Property form pre-populates all existing field values and allows any field to be changed, including the photo. If the photo is unchanged, the existing Cloudinary URL is preserved
- Delete uses a Mongoose session transaction to remove the property document and simultaneously pull it from the creator’s allProperties array, keeping both collections in sync atomically

### Agent management

- Agents List page displays every registered user as an agent card with their Google avatar, name, email address, and total property count
- Agent Profile page shows the full agent detail view via the shared Profile component, including the agent’s complete property portfolio
- My Profile page uses the same shared Profile component for the currently authenticated user, with data fetched by their own MongoDB user ID

### Authentication

- The login page renders a Google Sign-In button using the Google Identity Services API. The credential response is a signed JWT
- parseJwt utility decodes the Google JWT on the client to extract name, email, avatar (picture), and sub (user ID) from the payload
- On every login, the user profile is POST-ed to /api/v1/users, which is idempotent: it returns the existing MongoDB document if the email already exists, or creates a new user record if not
- The raw Google credential token is stored in localStorage as token. Axios’s request interceptor attaches it as Authorization: Bearer <token> to every subsequent API call
- On logout, token and user are removed from localStorage and google.accounts.id.revoke() is called to invalidate the Google session

### Light and dark mode

- ColorModeContextProvider wraps the entire application and exposes a setColorMode function through React context
- The current mode is stored in localStorage to persist the user’s preference across sessions. On first load, the system’s prefers-color-scheme media query is checked to set the default
- Two custom Material UI themes are defined: overridedLightTheme and overridedDarkTheme, each extending Refine’s built-in theme objects with custom palette overrides. The active theme is passed to ThemeProvider at runtime

### Benefits

- Single source of truth for the portfolio: every property, agent, and relationship lives in one MongoDB database with a consistent schema, accessible from any device
- Live KPIs on every login: four dashboard tiles give the team instant situational awareness without opening a single spreadsheet
- Consistent listing creation: the structured form with defined property types ensures every listing is created to the same standard, with a real photo uploaded directly to Cloudinary
- Role-aware property actions: agents can only edit or delete their own listings; other agents’ listings show contact options instead
- Atomic data integrity: create and delete operations use Mongoose session transactions to keep the Property collection and the User.allProperties array perfectly synchronised
- Zero password management: Google OAuth means no passwords to store, reset, or manage; every agent has their own authenticated identity
- Scalable Refine architecture: adding a new resource (reviews, messages, enquiries) requires registering it in App.tsx; the data provider, routing, and UI scaffolding are automatically available
- Dark/light mode out of the box: system preference is respected on first load; the preference is then stored in localStorage and toggleable at any time

### How it works

- Agent visits the login page and clicks ‘Sign in with Google’. Google Identity Services returns a signed JWT credential
- parseJwt decodes the JWT client-side to extract the user’s name, email, and avatar. The profile is POST-ed to /api/v1/users, which creates or finds the user in MongoDB
- Token stored in localStorage; Axios interceptor attaches it as a Bearer token to every subsequent request. Refine’s checkAuth hook reads localStorage on each route change to decide whether to redirect to login
- Dashboard loads and fires a useList call to /api/v1/properties (pageSize: 4) for the Latest Properties grid. The 4 KPI donut tiles and both ApexCharts components render with static or aggregate data
- All Properties page uses Refine’s useTable hook, which manages current page, page size, sorter, and filters as state and translates them into query params on the API call (_start, _end, _sort, _order, title_like, propertyType)
- Creating a property: the agent fills the form. On photo selection, FileReader reads the file as a base64 data URL. On submit, onFinish POSTs the full payload (including the base64 photo and the agent’s email) to /api/v1/properties
- Server receives the POST, finds the user by email, uploads the base64 photo to Cloudinary, receives back a CDN URL, then opens a Mongoose session and atomically creates the Property document and pushes its _id to user.allProperties
- Property Detail page calls useShow to fetch /api/v1/properties/:id with the creator user document populated. Action buttons (Edit/Delete vs Message/Call) are conditionally rendered by comparing user.email with propertyDetails.creator.email
- Deleting a property opens a browser confirmation dialog. On confirm, useDelete fires a DELETE request. The server opens a Mongoose session, removes the Property document, and pulls its _id from creator.allProperties, then commits the transaction
- Agent and profile pages call useList / useShow against /api/v1/users, which returns user documents with all properties populated. The shared Profile component renders the same layout for both Agent Profile and My Profile

### System architecture

Image (https://mburhan.com/uploads/57879cdfb2132e3f23ae7a37.png)

### Page inventory

Estato consists of 9 pages, each a React TypeScript component managed by Refine’s routing and data layer.

| Page | File | Key Content |
| --- | --- | --- |
| Dashboard (Home) | home.tsx | 4 PieChart KPI tiles, TotalRevenue ApexChart, PropertyReferrals bar chart, Latest Properties card grid (4 items live from API). |
| All Properties | all-properties.tsx | Full property grid with search by title, filter by 8 property types, sort by price (asc/desc), page size selector, Previous/Next pagination. |
| Property Details | property-details.tsx | Full-width photo, property type + 5-star rating, title, location, price, description. Agent sidebar: avatar, name, property count, location, Google Map, Book Now, Message/Edit + Call/Delete buttons. |
| Create Property | create-property.tsx | Delegates to shared Form component. Handles image file selection (FileReader to base64), attaches logged-in user email before submitting to API. |
| Edit Property | edit-property.tsx | Same shared Form component as Create. Pre-populates existing property data. Allows photo re-upload; photo URL preserved if unchanged. |
| Agents List | agent.tsx | Grid of all users (agents) from /api/v1/users. Each AgentCard shows avatar, name, email, and property count. Clicking navigates to agent profile. |
| Agent Profile | agent-profile.tsx | Full agent detail using shared Profile component. Shows avatar, name, email, properties count and full property list. |
| My Profile | my-profile.tsx | Logged-in user’s own profile using the same shared Profile component. Data fetched from /api/v1/users/:userId. |
| Login | login.tsx | Google Sign-In button using Google Identity Services. On success, JWT decoded, user POSTed to /api/v1/users, token stored in localStorage. |

### Data models

Two Mongoose schemas define the complete data layer. The bidirectional relationship between Property and User is maintained by the server using session transactions on create and delete operations.

| Collection | Field | Type | Notes |
| --- | --- | --- | --- |
| Property | title | String (required) | Listing headline |
| Property | description | String (required) | Full description text |
| Property | propertyType | String (required) | Apartment, Villa, Farmhouse, Condos, Townhouse, Chalet, Studio, or Duplex |
| Property | location | String (required) | Free-text location / address |
| Property | price | Number (required) | Numeric value (rendered as $price per day in the UI) |
| Property | photo | String (required) | Cloudinary CDN URL after base64 upload |
| Property | creator | ObjectId → User | Populated on read to include full user document |
| User | name | String (required) | Full name from Google profile |
| User | email | String (required) | Google account email; used as unique identifier |
| User | avatar | String (required) | Google profile picture URL |
| User | allProperties | \[ObjectId\] → Property | Bidirectional reference array; maintained via Mongoose transactions |

### Note

The User schema does not require a password field because authentication is handled entirely by Google OAuth. The email address serves as the unique identifier and is used both for login matching and for associating new properties with the correct creator.

### API reference

All endpoints are prefixed with /api/v1/ and served by the Express server on port 8080. No authentication middleware is currently applied server-side; auth is enforced client-side by Refine’s checkAuth hook and the Axios Bearer token interceptor.

| Method | Endpoint | Description |
| --- | --- | --- |
| GET | /api/v1/properties | List all properties. Supports _start, _end, _sort, _order, title_like, propertyType query params. Returns x-total-count header for Refine pagination. |
| GET | /api/v1/properties/:id | Fetch a single property with creator user populated (name, email, avatar, allProperties). |
| POST | /api/v1/properties | Create a new property. Uploads photo to Cloudinary via base64. Uses Mongoose session transaction to atomically create property and push to user.allProperties. |
| PATCH | /api/v1/properties/:id | Update an existing property. Re-uploads photo to Cloudinary. Falls back to original photo URL if upload fails. |
| DELETE | /api/v1/properties/:id | Delete a property. Uses Mongoose session transaction to remove from DB and pull from creator’s allProperties array atomically. |
| GET | /api/v1/users | List all users (agents). Supports _end for limit. Returns full user documents including allProperties references. |
| POST | /api/v1/users | Create or find a user by email (idempotent). Called on every Google OAuth login to ensure the user record exists in MongoDB. |
| GET | /api/v1/users/:id | Fetch a single user by MongoDB _id with allProperties populated. Used by agent profile and my profile pages. |

### Technology stack

The complete dependency surface for both client and server packages:

| Layer | Package / Version | Role |
| --- | --- | --- |
| UI Framework | @pankod/refine-core ^3.103 | Data fetching (useList, useShow, useDelete, useGetIdentity), auth provider, routing |
| Component Library | @pankod/refine-mui ^3.63 | Material UI integration for Refine: layout, notifications, theme provider |
| Forms | @pankod/refine-react-hook-form | react-hook-form integration for create/edit property forms with Refine’s onFinish lifecycle |
| Routing | @pankod/refine-react-router-v6 | React Router v6 adapter; all navigation uses useNavigate, useParams |
| Data Provider | @pankod/refine-simple-rest | Maps Refine resource operations to REST calls against the Express API |
| Charts | apexcharts + react-apexcharts ^1.4 | TotalRevenue (area chart) and PropertyReferrals (horizontal bar chart) |
| Charts (KPI) | Custom PieChart component | 4 donut-style KPI tiles on the dashboard (Properties for Sale/Rent, Customers, Agents) |
| HTTP | axios ^0.28 | All API calls; Axios interceptor attaches Bearer JWT token to every outbound request |
| Loading State | react-loader-spinner ^5.4 | Consistent loading indicator shown across all async pages via the shared Loader component |
| Icons | @mui/icons-material ^5.15 | Star, Place, Phone, ChatBubble, Edit, Delete, Add, VillaOutlined, PeopleAltOutlined |
| Server | express ^4.18 | REST API, CORS, JSON body parsing (50 MB limit for base64 photo uploads) |
| ODM | mongoose ^6.9 | Schemas, validation, populate, and session-based transactions |
| Media | cloudinary ^1.33 | Receives base64-encoded image from client, stores and returns CDN URL |
| Dev Server | nodemon ^2.0 | Auto-restarts Express server on file changes during development |

### Project structure

Image (https://mburhan.com/uploads/2522bdf9b41d4dc9dda90553.png)

### Setup & environment

Required environment variables to run Estato locally:

| Variable | Location | Description |
| --- | --- | --- |
| REACT_APP_GOOGLE_CLIENT_ID | client/.env | Google Cloud Console OAuth 2.0 Client ID |
| REACT_APP_GOOGLE_CLIENT_SECRET | client/.env | Google Cloud Console OAuth 2.0 Client Secret |
| REACT_APP_SERVER_URL | client/.env | Backend base URL e.g. http://localhost:8080/api/v1 |
| MONGODB_URL | server/.env | MongoDB Atlas connection string |
| CLOUDINARY_CLOUD_NAME | server/.env | Cloudinary account cloud name |
| CLOUDINARY_API_KEY | server/.env | Cloudinary API key |
| CLOUDINARY_API_SECRET | server/.env | Cloudinary API secret |

Image: The Agents page, with agent cards showing listings, revenue and experience. (https://mburhan.com/case-content/estato/image4.png)
