A RESTful API built with Express.js and Supabase for managing property listings. This service provides endpoints for creating, reading, updating, and deleting property listings with features like location tracking, price management, and property details.
Interactive API documentation is available at:
http://localhost:8080/api-docs
This documentation provides detailed information about all available endpoints, request/response formats, and example payloads.
backend
├── src
│ ├── app.js # Application entry point
│ ├── controllers
│ │ └── propertyController.js # Property CRUD operations
│ ├── routes
│ │ └── propertyRoutes.js # API route definitions
│ └── utils
│ ├── db.js # Supabase connection utility
│ └── logger.js # Logging utility
├── seeder
│ ├── seed_1.sql # San Francisco property seeds
│ └── seed_2.sql # New York property seeds
├── package.json
└── README.md
- Node.js
- Express.js
- Supabase (Database)
- dotenv (Environment Configuration)
-
Clone the repository:
git clone <repository-url> cd backend
-
Install dependencies:
npm install
-
Environment Configuration: Create a
.env
file in the root directory with your Supabase credentials:SUPABASE_URL=your_supabase_url SUPABASE_KEY=your_supabase_key PORT=8080
-
Start the server:
# Development mode with hot reload npm run dev # Production mode npm start
POST /properties
- Create a new property listingGET /properties
- Retrieve all propertiesGET /properties/:id
- Retrieve a specific propertyPUT /properties/:id
- Update a propertyDELETE /properties/:id
- Delete a property
{
"title": "Luxury Penthouse",
"price": 8500000,
"lat": 40.767778,
"lng": -73.971111,
"image_url": "https://example.com/image.jpg",
"bedrooms": 4,
"bathrooms": 4.5,
"description": "Stunning penthouse with panoramic views"
}
The project includes seed files for populating the database with sample properties:
seed_1.sql
: San Francisco propertiesseed_2.sql
: New York properties
To run the seeds, execute the SQL files in your Supabase SQL editor.
The project uses nodemon
for development, which automatically restarts the server when files change.
This project is licensed under the ISC License.