A modern, full-stack real estate platform built with Next.js that allows users to browse, search, and manage property listings with interactive maps and comprehensive filtering options.
- User Authentication: Secure sign-up/sign-in with Clerk
- Property Management: Add, edit, and view real estate listings
- Interactive Maps: Google Maps integration for property locations
- Advanced Search: Address-based search with Google Places API
- Property Filtering: Filter by bedrooms, bathrooms, parking, property type
- Image Upload: Upload and manage property photos
- Agent Profiles: View and manage real estate agent information
- Responsive Design: Mobile-first design with Tailwind CSS
- Real-time Updates: Live notifications and data updates
- Framework: Next.js
- Styling: Tailwind CSS
- UI Components: ShadCn
- Icons: Lucide React
- Forms: Formik
- Notifications: Sonner
- Maps: Google Maps API
- Authentication: Clerk
- Database: Supabase PostgreSQL
- Storage: Supabase Storage
- APIs: Google Maps API, Google Places API
- Language: JavaScript/TypeScript
- Linting: ESLint
- Package Manager: npm
You'll also need accounts for:
- Clerk - Authentication
- Supabase - Database and Storage
- Google Cloud Platform - Maps and Places APIs
Create a .env.local file in the root directory with the following variables:
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
# Supabase
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
# Google APIs
NEXT_PUBLIC_GOOGLE_PLACES_API_KEY=your_google_places_api_keyThis project uses Clerk for user authentication, providing:
- Email/password authentication
- Social login options
- User profile management
- Session management
- Protected routes
- Create a Clerk account
- Create a new application
- Get your publishable key and secret key from the dashboard
- Add the keys to your
.env.localfile - Configure redirect URLs in Clerk dashboard:
- Sign-in URL:
/sign-in - Sign-up URL:
/sign-up - After sign-out URL:
/sign-in
- Sign-in URL:
- Middleware protection for routes
- User context available throughout the app
- Automatic redirects for unauthenticated users
The application uses Supabase PostgreSQL for data storage with the following structure:
CREATE TABLE listing (
id SERIAL PRIMARY KEY,
address TEXT NOT NULL,
coordinates JSONB,
createdBy TEXT NOT NULL,
bedroom INTEGER DEFAULT 0,
bathroom INTEGER DEFAULT 0,
parking INTEGER DEFAULT 0,
propertyType TEXT,
type TEXT,
active BOOLEAN DEFAULT true,
agentName TEXT,
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW(),
utilities JSONB
);CREATE TABLE listingImages (
id SERIAL PRIMARY KEY,
listing_id INTEGER REFERENCES listing(id) ON DELETE CASCADE,
url TEXT NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);- Create a Supabase account
- Create a new project
- Get your project URL and anon key from the dashboard
- Add the credentials to your
.env.localfile - Run the SQL commands above in the Supabase SQL editor
- Set up Row Level Security (RLS) policies as needed
Supabase Storage is used for managing property images:
- In your Supabase dashboard, go to Storage
- Create a bucket named
listingimages - Configure bucket policies for public access to images
- Set up appropriate upload restrictions (file size, file types)
-- Allow public access to view images
CREATE POLICY "Public Access" ON storage.objects
FOR SELECT USING (bucket_id = 'listingimages');
-- Allow authenticated users to upload images
CREATE POLICY "Authenticated Upload" ON storage.objects
FOR INSERT WITH CHECK (bucket_id = 'listingimages' AND auth.role() = 'authenticated');- Image upload with unique filenames
- Public URL generation
- Automatic image optimization
- Secure file management
The application integrates with Google APIs for location services:
- Interactive map display
- Property markers
- Map controls and styling
- Responsive map containers
- Address autocomplete
- Geocoding services
- Place details
- Country restrictions (Canada)
- Create a Google Cloud Platform account
- Enable the following APIs:
- Maps JavaScript API
- Places API
- Geocoding API
- Create API credentials
- Add your API key to
.env.local - Configure API key restrictions in GCP console
realtor-block/
βββ app/ # Next.js App Router
β βββ (routes)/ # Route groups
β β βββ add-new-listing/ # Add property page
β β βββ edit-listing/ # Edit property pages
β β βββ view-listing/ # Property details pages
β β βββ agent/ # Agent profile pages
β β βββ agents/ # Agents listing page
β βββ _components/ # Shared components
β β βββ GoogleAddressSearch.jsx
β β βββ GoogleMapView.jsx
β β βββ Header.jsx
β β βββ Listing.jsx
β β βββ MarkerItem.jsx
β βββ sign-in/ # Authentication pages
β βββ sign-up/
β βββ globals.css # Global styles
β βββ layout.jsx # Root layout
β βββ page.jsx # Home page
β βββ Provider.jsx # App providers
βββ @/ # Alias for components/ui
βββ components/ # UI components
βββ lib/ # Utility functions
βββ utils/ # Utility files
β βββ supabase/
β βββ client.js # Supabase client
βββ public/ # Static assets
βββ middleware.js # Clerk middleware
βββ package.json
- Fork the repository
- Create a feature branch (
git checkout -b feature) - Commit your changes (
git commit -m 'Added feature') - Push to the branch (
git push origin feature) - Open a Pull Request